Whamcloud - gitweb
LU-4446 tests: block on layout lock fix up on sanityn:51c 89/8789/4
authorJinshan Xiong <jinshan.xiong@intel.com>
Thu, 9 Jan 2014 20:32:13 +0000 (12:32 -0800)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 25 Mar 2014 15:49:01 +0000 (15:49 +0000)
Fixed two problems: set fail_loc on MDS and block at layout lock
by writing the test file.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Change-Id: I8028e855aad5882981a313fb28ec5b87f593832b
Reviewed-on: http://review.whamcloud.com/8789
Tested-by: Jenkins
Reviewed-by: Jian Yu <jian.yu@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/sanityn.sh

index d02dddc..4b41dd6 100644 (file)
@@ -2317,23 +2317,30 @@ test_51b() {
 run_test 51b "layout lock: glimpse should be able to restart if layout changed"
 
 test_51c() {
-       # create an empty file
-       $MCREATE $DIR1/$tfile
+       [ $OSTCOUNT -ge 2 ] || { skip "need at least 2 osts"; return; }
+
+       # set default layout to have 1 stripe
+       mkdir -p $DIR1/$tdir
+       $LFS setstripe -c 1 $DIR1/$tdir
+
+       # create a file with empty layout
+       $MCREATE $DIR1/$tdir/$tfile
 
 #define OBD_FAIL_MDS_LL_BLOCK 0x172
-       $LCTL set_param fail_loc=0x172
+       do_facet $SINGLEMDS $LCTL set_param fail_loc=0x172
 
        # change the layout of testing file
-       echo "Setting layout ..."
-       $LFS setstripe -c $OSTCOUNT $DIR1/$tfile &
+       echo "Setting layout to have $OSTCOUNT stripes ..."
+       $LFS setstripe -c $OSTCOUNT $DIR1/$tdir/$tfile &
        pid=$!
        sleep 1
 
-       # get layout of this file should wait until dd is finished
-       local stripecnt=`$LFS getstripe -c $DIR2/$tfile`
-       [ $stripecnt -eq $OSTCOUNT ] || error "layout wrong"
+       # write something to the file, it should be blocked on fetching layout
+       dd if=/dev/zero of=$DIR2/$tdir/$tfile bs=1k count=1 conv=notrunc
+       local cnt=$($LFS getstripe -c $DIR2/$tdir/$tfile)
+       [ $cnt -eq $OSTCOUNT ] || error "have $cnt stripes, expected $OSTCOUNT"
 
-       rm -f $DIR1/$tfile
+       rm -fr $DIR1/$tdir
 }
 run_test 51c "layout lock: IT_LAYOUT blocked and correct layout can be returned"