Whamcloud - gitweb
LU-5569 ptlrpc: change reverse import life cycle
[fs/lustre-release.git] / lustre / tests / recovery-small.sh
index 578f911..8e75d0d 100755 (executable)
@@ -196,6 +196,53 @@ test_10b() {
 }
 run_test 10b "re-send BL AST"
 
+test_10c() {
+       local before=$(date +%s)
+       local evict
+       local mdccli
+       local mdcpath
+       local conn_uuid
+       local workdir
+       local pid
+       local rc
+
+       workdir="${DIR}/${tdir}"
+       mkdir -p ${workdir} || error "can't create workdir $?"
+       stat ${workdir} > /dev/null ||
+               error "failed to stat ${workdir}: $?"
+       mdtidx=$($LFS getdirstripe -i ${workdir})
+       mdtname=$($LFS mdts ${workdir} | grep -e "^$mdtidx:" |
+                 awk '{sub("_UUID", "", $2); print $2;}')
+       #assume one client
+       mdccli=$($LCTL dl | grep "${mdtname}-mdc" | awk '{print $4;}')
+       conn_uuid=$($LCTL get_param -n mdc.${mdccli}.mds_conn_uuid)
+       mdcpath="mdc.${mdccli}.import=connection=${conn_uuid}"
+
+       drop_bl_callback_once "chmod 0777 ${workdir}" &
+       pid=$!
+
+       # let chmod blocked
+       sleep 1
+       # force client reconnect
+       $LCTL set_param "${mdcpath}"
+
+       # wait client reconnect
+       client_reconnect
+       wait $pid
+       rc=$?
+       evict=$($LCTL get_param mdc.${mdccli}.state |
+          awk -F"[ [,]" '/EVICTED]$/ { if (t<$4) {t=$4;} } END { print t }')
+
+       [[ $evict -le $before ]] ||
+               ( $LCTL get_param mdc.$FSNAME-MDT*.state;
+                   error "eviction happened: $EVICT before:$BEFORE" )
+
+       [ $rc -eq 0 ] || error "chmod must finished OK"
+       checkstat -v -p 0777 "${workdir}" ||
+               error "client checkstat failed: $?"
+}
+run_test 10c "re-send BL AST vs reconnect race (LU-5569)"
+
 test_10d() {
        local before=$(date +%s)
        local evict
@@ -210,12 +257,13 @@ test_10d() {
 
        mount_client $MOUNT2
 
+       cancel_lru_locks osc
        $LFS setstripe -i 0 -c 1 $DIR1/$tfile
        echo -n hello > $DIR1/$tfile
 
        stat $DIR2/$tfile >& /dev/null
        $LCTL set_param fail_err=71
-       drop_bl_callback_once "echo -n \\\", world\\\" >> $DIR2/$tfile"
+       drop_bl_callback "echo -n \\\", world\\\" >> $DIR2/$tfile"
 
        client_reconnect
 
@@ -230,6 +278,7 @@ test_10d() {
                (do_facet client $LCTL get_param osc.$FSNAME-OST0000*.state;
                    error "no eviction: $evict before:$before")
 
+       $LCTL set_param fail_err=0
        rm $TMP/$tfile
        umount_client $MOUNT2
 }
@@ -1821,6 +1870,23 @@ test_107 () {
 }
 run_test 107 "drop reint reply, then restart MDT"
 
+test_108() {
+       mkdir -p $DIR/$tdir
+       $SETSTRIPE -c 1 -i 0 $DIR/$tdir
+
+       dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=256 &
+       local dd_pid=$!
+       sleep 0.1
+
+       ost_evict_client
+
+       wait $dd_pid
+
+       client_up || error "reconnect failed"
+       rm -f $DIR/$tdir/$tfile
+}
+run_test 108 "client eviction don't crash"
+
 test_110a () {
        [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
        local remote_dir=$DIR/$tdir/remote_dir