Whamcloud - gitweb
LU-3478 iokit: NUMA support in sgpdd-survey
[fs/lustre-release.git] / lustre / tests / sanity-lfsck.sh
index 0cc7474..9ab0b9a 100644 (file)
@@ -17,7 +17,7 @@ init_test_env $@
 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 init_logging
 
-[ $(facet_fstype $SINGLEMDS) != ldiskfs ] &&
+[ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] &&
        skip "test LFSCK only for ldiskfs" && exit 0
 require_dsh_mds || exit 0
 
@@ -31,9 +31,9 @@ OSTSIZE=100000
 
 check_and_setup_lustre
 
-[[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.2.90) ]] &&
-        skip "Need MDS version at least 2.2.90" && check_and_cleanup_lustre &&
-        exit 0
+[[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.60) ]] &&
+       skip "Need MDS version at least 2.3.60" && check_and_cleanup_lustre &&
+       exit 0
 
 build_test_filter
 
@@ -284,6 +284,45 @@ test_2b()
 }
 run_test 2b "LFSCK can find out and remove invalid linkEA entry"
 
+test_2c()
+{
+       lfsck_prep 1 1
+       echo "start $SINGLEMDS"
+       start $SINGLEMDS $MDT_DEVNAME $MOUNT_OPTS_SCRUB > /dev/null ||
+               error "(1) Fail to start MDS!"
+
+       mount_client $MOUNT || error "(2) Fail to start client!"
+
+       #define OBD_FAIL_LFSCK_LINKEA_MORE2     0x1605
+       do_facet $SINGLEMDS $LCTL set_param fail_loc=0x1605
+       touch $DIR/$tdir/dummy
+
+       do_facet $SINGLEMDS $LCTL set_param fail_loc=0
+       umount_client $MOUNT
+       $START_NAMESPACE || error "(3) Fail to start LFSCK for namespace!"
+
+       sleep 3
+       local STATUS=$($SHOW_NAMESPACE | awk '/^status/ { print $2 }')
+       [ "$STATUS" == "completed" ] ||
+               error "(4) Expect 'completed', but got '$STATUS'"
+
+       local repaired=$($SHOW_NAMESPACE |
+                        awk '/^updated_phase2/ { print $2 }')
+       [ $repaired -eq 1 ] ||
+               error "(5) Fail to repair crashed linkEA: $repaired"
+
+       mount_client $MOUNT || error "(6) Fail to start client!"
+
+       stat $DIR/$tdir/dummy | grep "Links: 1" > /dev/null ||
+               error "(7) Fail to stat $DIR/$tdir/dummy"
+
+       local dummyfid=$($LFS path2fid $DIR/$tdir/dummy)
+       local dummyname=$($LFS fid2path $DIR $dummyfid)
+       [ "$dummyname" == "$DIR/$tdir/dummy" ] ||
+               error "(8) Fail to repair linkEA: $dummyfid $dummyname"
+}
+run_test 2c "LFSCK can find out and remove repeated linkEA entry"
+
 test_4()
 {
        lfsck_prep 3 3