Whamcloud - gitweb
LU-8200 test: improve sanityn.sh 33c 57/33057/2
authorLai Siyao <lai.siyao@intel.com>
Thu, 23 Aug 2018 06:45:56 +0000 (23:45 -0700)
committerJohn L. Hammond <jhammond@whamcloud.com>
Tue, 11 Sep 2018 22:28:44 +0000 (22:28 +0000)
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 <lai.siyao@intel.com>
Change-Id: I5c99e5a8261df8c9f463aea7ed67df95baaf3e6c
Reviewed-on: https://review.whamcloud.com/33057
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: James Nunez <jnunez@whamcloud.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
lustre/tests/sanityn.sh

index 7cc4a75..a972249 100755 (executable)
@@ -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"