From: Fan Yong Date: Mon, 29 Oct 2012 15:58:03 +0000 (-0700) Subject: LU-2237 tests: new test for re-recreating last_rcvd X-Git-Tag: 2.1.4-RC1~50 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=0391e57426de8cbdc95392c510e201aa8c222fc3;p=fs%2Flustre-release.git LU-2237 tests: new test for re-recreating last_rcvd To verify that the lost "last_rcvd" file can be re-created when server mount. Signed-off-by: Fan Yong Change-Id: Ie6d23cafc511d2a99abfc7967cafb2ae0106c18c Reviewed-on: http://review.whamcloud.com/4397 Tested-by: Hudson Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Yu Jian Reviewed-by: Alex Zhuravlev --- diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 1665dd6..41b1d0c 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -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