Whamcloud - gitweb
LU-6732 llite: ll_write_begin/end not passing on errors 02/15302/6
authorHiroya Nozaki <nozaki.hiroya@jp.fujitsu.com>
Tue, 16 Jun 2015 05:41:00 +0000 (14:41 +0900)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 10 Dec 2015 17:45:43 +0000 (17:45 +0000)
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>
lustre/llite/file.c
lustre/llite/rw26.c

index 9b75dc2..285e360 100644 (file)
@@ -1151,6 +1151,12 @@ out:
                        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;
                }
index 8b37776..ae23b53 100644 (file)
@@ -639,8 +639,10 @@ static int ll_write_begin(struct file *file, struct address_space *mapping,
        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;
@@ -711,6 +713,8 @@ out:
                        unlock_page(vmpage);
                        page_cache_release(vmpage);
                }
+               if (io)
+                       io->ci_result = result;
        } else {
                *pagep = vmpage;
                *fsdata = lcc;
@@ -779,6 +783,8 @@ static int ll_write_end(struct file *file, struct address_space *mapping,
            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);
 }