From c49ff6ff89725052a29aa91d780a881e7829dfa2 Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Wed, 12 Dec 2012 07:25:46 +0800 Subject: [PATCH] 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: I3eca382f37aa983bed89418c5b5d997d594fd1f3 Reviewed-on: http://review.whamcloud.com/4455 Tested-by: Hudson Reviewed-by: Jian Yu Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/tests/conf-sanity.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 0f0e47d..639e706 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -3389,6 +3389,46 @@ test_64() { } run_test 64 "check lfs df --lazy " +test_65() { # LU-2237 + # Currently, the test is only valid for ldiskfs backend + [ "$(facet_fstype $SINGLEMDS)" != "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 $(facet_fstype $SINGLEMDS) $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" + stop_mds + obj=$(do_facet $SINGLEMDS \ + "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" | grep Inode) + [ -n "$obj" ] || error "fail to re-create the last_rcvd" +} +run_test 65 "re-create the lost last_rcvd file when server mount" + test_70a() { [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return local MDTIDX=1 -- 1.8.3.1