From: Lai Siyao Date: Thu, 23 Aug 2018 06:45:56 +0000 (-0700) Subject: LU-8200 test: improve sanityn.sh 33c X-Git-Tag: 2.10.6-RC1~3 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F57%2F33057%2F2;p=fs%2Flustre-release.git LU-8200 test: improve sanityn.sh 33c If transaction is committed before unlock, lock won't be saved. So trigger Sync-Lock-Cancel twice in sanityn.sh 33c, it's unlikely to fail both. This patch is back-ported from the following one: Lustre-commit: 04c4b9c2a121e76881f8b387a4721069418c92f0 Lustre-change: https://review.whamcloud.com/31673 Test-Parameters: trivial clientcount=2 mdscount=2 mdtcount=4 \ osscount=1 ostcount=8 mdtfilesystemtype=zfs ostfilesystemtype=zfs \ testlist=sanityn Signed-off-by: Lai Siyao Change-Id: I5c99e5a8261df8c9f463aea7ed67df95baaf3e6c Reviewed-on: https://review.whamcloud.com/33057 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: James Nunez Reviewed-by: John L. Hammond --- diff --git a/lustre/tests/sanityn.sh b/lustre/tests/sanityn.sh index 7cc4a75..a972249 100755 --- a/lustre/tests/sanityn.sh +++ b/lustre/tests/sanityn.sh @@ -960,25 +960,31 @@ test_33c() { [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.63) ] && skip "DNE CoS not supported" && return - sync + local sync_count mkdir $DIR/$tdir - # remote mkdir is done on MDT2, which enqueued lock of $tdir on MDT1 - $LFS mkdir -i 1 $DIR/$tdir/d1 + sync_all_data do_facet mds1 "lctl set_param -n mdt.*.sync_count=0" - mkdir $DIR/$tdir/d2 - local sync_count=$(do_facet mds1 \ - "lctl get_param -n mdt.*MDT0000.sync_count") - [ $sync_count -eq 1 ] || error "Sync-Lock-Cancel not triggered" + # do twice in case transaction is committed before unlock, see LU-8200 + for i in 1 2; do + # remote dir is created on MDT1, which enqueued lock of $tdir on + # MDT0 + $LFS mkdir -i 1 $DIR/$tdir/remote.$i + mkdir $DIR/$tdir/local.$i + done + sync_count=$(do_facet mds1 "lctl get_param -n mdt.*MDT0000.sync_count") + echo "sync_count $sync_count" + [ $sync_count -eq 0 ] && error "Sync-Lock-Cancel not triggered" - $LFS mkdir -i 1 $DIR/$tdir/d3 + sync_all_data do_facet mds1 "lctl set_param -n mdt.*.sync_count=0" + $LFS mkdir -i 1 $DIR/$tdir/remote.3 # during sleep remote mkdir should have been committed and canceled # remote lock spontaneously, which shouldn't trigger sync sleep 6 - mkdir $DIR/$tdir/d4 - local sync_count=$(do_facet mds1 \ - "lctl get_param -n mdt.*MDT0000.sync_count") + mkdir $DIR/$tdir/local.3 + sync_count=$(do_facet mds1 "lctl get_param -n mdt.*MDT0000.sync_count") + echo "sync_count $sync_count" [ $sync_count -eq 0 ] || error "Sync-Lock-Cancel triggered" } run_test 33c "Cancel cross-MDT lock should trigger Sync-Lock-Cancel"