From: Wang Shilong Date: Mon, 17 Jun 2019 06:58:34 +0000 (+0800) Subject: LU-12378 ptlrpc: always reset generation for idle reconnect X-Git-Tag: 2.13.51~100 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=94fbe511ba96c0b66770943d3fdb7961183d6436 LU-12378 ptlrpc: always reset generation for idle reconnect 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 Reviewed-on: https://review.whamcloud.com/35052 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev Reviewed-by: Li Xi Reviewed-by: Oleg Drokin --- diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index 3458c5b..96ab1d9 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -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 && - !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); } diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 027271c..328a186 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -22409,7 +22409,7 @@ test_811() { } 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 ] && @@ -22430,7 +22430,31 @@ test_812() { 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) diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index c815e1c..6160ea4 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -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: - 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)