Whamcloud - gitweb
LU-12378 ptlrpc: always reset generation for idle reconnect 52/35052/13
authorWang Shilong <wshilong@ddn.com>
Mon, 17 Jun 2019 06:58:34 +0000 (14:58 +0800)
committerOleg Drokin <green@whamcloud.com>
Sat, 14 Dec 2019 05:58:41 +0000 (05:58 +0000)
Idle reconnetion is common case and reconnections will
be quick mostly, so always reset generation for this case,
otherwise, it will make application fail just for Idle
reconnection feature.

Change-Id: Ia1531df6a3288663d832865e48a30b448b225766
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-on: https://review.whamcloud.com/35052
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ptlrpc/import.c
lustre/tests/sanity.sh
lustre/utils/lfs.c

index 3458c5b..96ab1d9 100644 (file)
@@ -1748,7 +1748,8 @@ static void ptlrpc_reset_reqs_generation(struct obd_import *imp)
                        rq_list) {
                spin_lock(&old->rq_lock);
                if (old->rq_import_generation == imp->imp_generation - 1 &&
                        rq_list) {
                spin_lock(&old->rq_lock);
                if (old->rq_import_generation == imp->imp_generation - 1 &&
-                   !old->rq_no_resend)
+                   ((imp->imp_initiated_at == imp->imp_generation) ||
+                    !old->rq_no_resend))
                        old->rq_import_generation = imp->imp_generation;
                spin_unlock(&old->rq_lock);
        }
                        old->rq_import_generation = imp->imp_generation;
                spin_unlock(&old->rq_lock);
        }
index 027271c..328a186 100644 (file)
@@ -22409,7 +22409,7 @@ test_811() {
 }
 run_test 811 "orphan name stub can be cleaned up in startup"
 
 }
 run_test 811 "orphan name stub can be cleaned up in startup"
 
-test_812() {
+test_812a() {
        [ $OST1_VERSION -lt $(version_code 2.12.51) ] &&
                skip "OST < 2.12.51 doesn't support this fail_loc"
        [ "$SHARED_KEY" = true ] &&
        [ $OST1_VERSION -lt $(version_code 2.12.51) ] &&
                skip "OST < 2.12.51 doesn't support this fail_loc"
        [ "$SHARED_KEY" = true ] &&
@@ -22430,7 +22430,31 @@ test_812() {
 
        stat $DIR/$tfile >/dev/null || error "can't stat file"
 }
 
        stat $DIR/$tfile >/dev/null || error "can't stat file"
 }
-run_test 812 "do not drop reqs generated when imp is going to idle (LU-11951)"
+run_test 812a "do not drop reqs generated when imp is going to idle (LU-11951)"
+
+test_812b() { # LU-12378
+       [ $OST1_VERSION -lt $(version_code 2.12.51) ] &&
+               skip "OST < 2.12.51 doesn't support this fail_loc"
+       [ "$SHARED_KEY" = true ] &&
+               skip "OSC connections never go IDLE with Shared-Keys enabled"
+
+       $LFS setstripe -c 1 -i 0 $DIR/$tfile || error "setstripe failed"
+       # ensure ost1 is connected
+       stat $DIR/$tfile >/dev/null || error "can't stat"
+       wait_osc_import_state client ost1 FULL
+       # no locks, no reqs to let the connection idle
+       cancel_lru_locks osc
+
+       # delay OST_DISCONNECT on OST1 to put OSC into intermediate state
+#define OBD_FAIL_OST_DISCONNECT_DELAY   0x245
+       do_facet ost1 "$LCTL set_param fail_loc=0x245 fail_val=8"
+       wait_osc_import_state client ost1 CONNECTING
+       do_facet ost1 "$LCTL set_param fail_loc=0 fail_val=0"
+
+       $LFS quota -u 0 $DIR/ || error "lfs quota should succeed"
+       wait_osc_import_state client ost1 IDLE
+}
+run_test 812b "do not drop no resend request for idle connect"
 
 test_813() {
        local file_heat_sav=$($LCTL get_param -n llite.*.file_heat 2>/dev/null)
 
 test_813() {
        local file_heat_sav=$($LCTL get_param -n llite.*.file_heat 2>/dev/null)
index c815e1c..6160ea4 100644 (file)
@@ -7000,8 +7000,16 @@ static int get_print_quota(char *mnt, char *name, struct if_quotactl *qctl,
                       "Some devices may be not working or deactivated. "
                       "The data in \"[]\" is inaccurate.\n");
 out:
                       "Some devices may be not working or deactivated. "
                       "The data in \"[]\" is inaccurate.\n");
 out:
-       return rc1;
+       if (rc1)
+               return rc1;
+       if (rc2)
+               return rc2;
+       if (rc3)
+               return rc3;
+       if (inacc)
+               return -EIO;
 
 
+       return 0;
 }
 
 static int lfs_project(int argc, char **argv)
 }
 
 static int lfs_project(int argc, char **argv)