Whamcloud - gitweb
LU-2237 tests: new test for re-recreating last_rcvd
authorFan Yong <yong.fan@whamcloud.com>
Mon, 29 Oct 2012 15:58:03 +0000 (08:58 -0700)
committerOleg Drokin <green@whamcloud.com>
Wed, 31 Oct 2012 16:27:35 +0000 (12:27 -0400)
To verify that the lost "last_rcvd" file can be re-created
when server mount.

Signed-off-by: Fan Yong <yong.fan@whamcloud.com>
Change-Id: Ie6d23cafc511d2a99abfc7967cafb2ae0106c18c
Reviewed-on: http://review.whamcloud.com/4397
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Yu Jian <yujian@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
lustre/tests/conf-sanity.sh

index 1665dd6..41b1d0c 100644 (file)
@@ -2754,6 +2754,44 @@ test_60() { # LU-471
 }
 run_test 60 "check mkfs.lustre --mkfsoptions -E -O options setting"
 
+test_61() { # LU-2237
+       # Currently, the test is only valid for ldiskfs backend
+       [ "$FSTYPE" != "ldiskfs" ] && skip "non-ldiskfs backend" && return
+
+       local devname=$(mdsdevname ${SINGLEMDS//mds/})
+       local brpt=$(facet_mntpt brpt)
+       local opts=""
+
+       if ! do_facet $SINGLEMDS "test -b $devname"; then
+               opts="-o loop"
+       fi
+
+       stop_mds
+       local obj=$(do_facet $SINGLEMDS \
+                   "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" |
+                   grep Inode)
+       if [ -z "$obj" ]; then
+               # The MDT may be just re-formatted, mount the MDT for the
+               # first time to guarantee the "last_rcvd" file is there.
+               start_mds || error "fail to mount the MDS for the first time"
+               stop_mds
+       fi
+
+       # remove the "last_rcvd" file
+       do_facet $SINGLEMDS "mkdir -p $brpt"
+       do_facet $SINGLEMDS "mount -t $FSTYPE $opts $devname $brpt"
+       do_facet $SINGLEMDS "rm -f ${brpt}/last_rcvd"
+       do_facet $SINGLEMDS "umount $brpt"
+
+       # restart MDS, the "last_rcvd" file should be recreated.
+       start_mds || error "fail to restart the MDS"
+       obj=$(do_facet $SINGLEMDS \
+             "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" | grep Inode)
+       [ ! -z "$obj" ] || error "fail to re-create the last_rcvd"
+       stop_mds
+}
+run_test 61 "re-create the lost last_rcvd file when server mount"
+
 if ! combined_mgs_mds ; then
        stop mgs
 fi