Because of a implementation of generic_perform_write(), write(2)
may return 0 with no errno even if EDQUOT or ENOSPC actually
happend in it.
This patch fixes the issue with setting a proper errno to
ci_result and get it in ll_file_io_generic.
Signed-off-by: Hiroya Nozaki <nozaki.hiroya@jp.fujitsu.com>
Change-Id: I3fc986b57d703ad5fbf41e1ea8182d2d561e8005
Reviewed-on: http://review.whamcloud.com/15302
Tested-by: Maloo <hpdd-maloo@intel.com>
Tested-by: Jenkins
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
ll_stats_ops_tally(ll_i2sbi(inode),
LPROC_LL_WRITE_BYTES, result);
fd->fd_write_failed = false;
+ } else if (result == 0 && rc == 0) {
+ rc = io->ci_result;
+ if (rc < 0)
+ fd->fd_write_failed = true;
+ else
+ fd->fd_write_failed = false;
} else if (rc != -ERESTARTSYS) {
fd->fd_write_failed = true;
}
CDEBUG(D_VFSTRACE, "Writing %lu of %d to %d bytes\n", index, from, len);
lcc = ll_cl_find(file);
- if (lcc == NULL)
+ if (lcc == NULL) {
+ io = NULL;
GOTO(out, result = -EIO);
+ }
env = lcc->lcc_env;
io = lcc->lcc_io;
unlock_page(vmpage);
page_cache_release(vmpage);
}
+ if (io)
+ io->ci_result = result;
} else {
*pagep = vmpage;
*fsdata = lcc;
file->f_flags & O_SYNC || IS_SYNC(file->f_path.dentry->d_inode))
result = vvp_io_write_commit(env, io);
+ if (result < 0)
+ io->ci_result = result;
RETURN(result >= 0 ? copied : result);
}