Whamcloud - gitweb
LU-15459 llite: clear async errors on write commit sync 78/46178/4
authorVladimir Saveliev <c17830@cray.com>
Mon, 24 Jan 2022 17:13:59 +0000 (20:13 +0300)
committerOleg Drokin <green@whamcloud.com>
Mon, 31 Jan 2022 01:46:43 +0000 (01:46 +0000)
Async errors should be cleared after vvp_io_commit_sync(). Otherwise,
that will be done in ll_flush() called from
linux/fs/open.c:filp_close() and close(2) will fail. ll_flush()
replaces any error code with EIO which is confusing.

Test to illustrate the issue is added.
'P' mode is added to multiop. It is like 'w' but does only 1 write
call regardless to how many bytes were written.

HPE-bug-id: LUS-7529
Signed-off-by: Vladimir Saveliev <vlaidimir.saveliev@hpe.com>
Change-Id: I6b7a1465268999b48a50f3584f3821f4b088303d
Reviewed-on: https://review.whamcloud.com/46178
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alexander Boyko <alexander.boyko@hpe.com>
Reviewed-by: Andrew Perepechko <andrew.perepechko@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/vvp_io.c
lustre/tests/multiop.c
lustre/tests/sanity.sh

index 87ad197..baf28af 100644 (file)
@@ -1177,6 +1177,8 @@ int vvp_io_write_commit(const struct lu_env *env, struct cl_io *io)
 
        /* out of quota, try sync write */
        if (rc == -EDQUOT && !cl_io_is_mkwrite(io)) {
+               struct ll_inode_info *lli = ll_i2info(inode);
+
                rc = vvp_io_commit_sync(env, io, queue,
                                        vio->u.readwrite.vui_from,
                                        vio->u.readwrite.vui_to);
@@ -1184,6 +1186,9 @@ int vvp_io_write_commit(const struct lu_env *env, struct cl_io *io)
                        vio->u.readwrite.vui_written += rc;
                        rc = 0;
                }
+               if (lli->lli_clob != NULL)
+                       lov_read_and_clear_async_rc(lli->lli_clob);
+               lli->lli_async_rc = 0;
        }
 
        /* update inode size */
index 100d014..e206785 100644 (file)
@@ -103,6 +103,7 @@ char usage[] =
 "       v  verbose\n"
 "       V  open a volatile file\n"
 "       w[num] write optional length\n"
+"       P[num] like w, but only one write call\n"
 "       x  get file data version\n"
 "       W  write entire mmap-ed region\n"
 "       y  fsync\n"
@@ -685,6 +686,7 @@ int main(int argc, char **argv)
                        rc = fd;
                        break;
                case 'w':
+               case 'P':
                        len = atoi(commands + 1);
                        if (len <= 0)
                                len = 1;
@@ -715,6 +717,8 @@ int main(int argc, char **argv)
                                        fprintf(stderr,
                                                "short write: %lld/%u\n",
                                                rc, len);
+                               if (commands[0] == 'P')
+                                       break;
                                len -= rc;
                        }
                        break;
index aaf7c99..d37c6b5 100755 (executable)
@@ -3414,6 +3414,20 @@ test_27S() {
 }
 run_test 27S "don't deactivate OSP on network issue"
 
+test_27T() {
+       [ $(facet_host client) == $(facet_host ost1) ] &&
+               skip "need ost1 and client on different nodes"
+
+#define OBD_FAIL_OSC_NO_GRANT            0x411
+       $LCTL set_param fail_loc=0x20000411 fail_val=1
+#define OBD_FAIL_OST_ENOSPC              0x215
+       do_facet ost1 "$LCTL set_param fail_loc=0x80000215"
+       $LFS setstripe -i 0 -c 1 $DIR/$tfile
+       $MULTIOP $DIR/$tfile oO_WRONLY:P$((4 * 1024 * 1024 + 10 * 4096))c ||
+               error "multiop failed"
+}
+run_test 27T "no eio on close on partial write due to enosp"
+
 # createtest also checks that device nodes are created and
 # then visible correctly (#2091)
 test_28() { # bug 2091