From 04c4b9c2a121e76881f8b387a4721069418c92f0 Mon Sep 17 00:00:00 2001 From: Lai Siyao Date: Fri, 16 Mar 2018 22:36:11 +0800 Subject: [PATCH] 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. 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/31673 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Jian Yu Reviewed-by: James Nunez Reviewed-by: Oleg Drokin --- lustre/tests/sanityn.sh | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/lustre/tests/sanityn.sh b/lustre/tests/sanityn.sh index fad32e9..40d22b4 100755 --- a/lustre/tests/sanityn.sh +++ b/lustre/tests/sanityn.sh @@ -1007,25 +1007,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" -- 1.8.3.1