require_dsh_mds || exit 0
+load_modules
+
+if ! check_versions; then
+ skip "It is NOT necessary to test lfsck under interoperation mode"
+ exit 0
+fi
+
+[[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.60) ]] &&
+ skip "Need MDS version at least 2.3.60" && exit 0
+
LTIME=${LTIME:-120}
SAVED_MDSSIZE=${MDSSIZE}
formatall
setupall
-[[ $(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
-
[[ $(lustre_version_code $SINGLEMDS) -le $(version_code 2.4.90) ]] &&
ALWAYS_EXCEPT="$ALWAYS_EXCEPT 2c"
$LCTL get_param -n obdfilter.${OST_DEV}.lfsck_layout"
MOUNT_OPTS_SCRUB="-o user_xattr"
MOUNT_OPTS_NOSCRUB="-o user_xattr,noscrub"
+MOUNT_OPTS_SKIP_LFSCK="-o user_xattr,skip_lfsck"
lfsck_prep() {
local ndirs=$1
echo "prepared $(date)."
}
+run_e2fsck_on_mdt0() {
+ [ $(facet_fstype $SINGLEMDS) != ldiskfs ] && return
+
+ stop $SINGLEMDS > /dev/null || error "(0) Fail to the stop MDT0"
+ run_e2fsck $(facet_active_host $SINGLEMDS) $(mdsdevname 1) "-n" |
+ grep "Fix? no" && {
+ run_e2fsck $(facet_active_host $SINGLEMDS) $(mdsdevname 1) "-n"
+ error "(2) Detected inconsistency on MDT0"
+ }
+ start $SINGLEMDS $MDT_DEVNAME $MOUNT_OPTS_NOSCRUB > /dev/null ||
+ error "(3) Fail to start MDT0"
+}
+
test_0() {
lfsck_prep 3 3
[ $repaired -eq 1 ] ||
error "(5) Fail to repair crashed FID-in-dirent: $repaired"
+ run_e2fsck_on_mdt0
+
mount_client $MOUNT || error "(6) Fail to start client!"
#define OBD_FAIL_FID_LOOKUP 0x1505
error "(5) Fail to repair the missing FID-in-LMA: $repaired"
do_facet $SINGLEMDS $LCTL set_param fail_loc=0
+ run_e2fsck_on_mdt0
+
mount_client $MOUNT || error "(6) Fail to start client!"
#define OBD_FAIL_FID_LOOKUP 0x1505
[ $repaired -eq 1 ] ||
error "(5) Fail to repair crashed linkEA: $repaired"
+ run_e2fsck_on_mdt0
+
mount_client $MOUNT || error "(6) Fail to start client!"
stat $DIR/$tdir/dummy | grep "Links: 1" > /dev/null ||
[ $repaired -eq 1 ] ||
error "(5) Fail to repair crashed linkEA: $repaired"
+ run_e2fsck_on_mdt0
+
mount_client $MOUNT || error "(6) Fail to start client!"
stat $DIR/$tdir/dummy | grep "Links: 1" > /dev/null ||
[ $repaired -eq 1 ] ||
error "(5) Fail to repair crashed linkEA: $repaired"
+ run_e2fsck_on_mdt0
+
mount_client $MOUNT || error "(6) Fail to start client!"
stat $DIR/$tdir/dummy | grep "Links: 1" > /dev/null ||
[ $repaired -eq 1 ] ||
error "(5) Fail to repair crashed linkEA: $repaired"
+ run_e2fsck_on_mdt0
+
mount_client $MOUNT || error "(6) Fail to start client!"
stat $DIR/$tdir/dummy | grep "Links: 1" > /dev/null ||
[ $repaired -ge 9 ] ||
error "(9) Fail to re-generate FID-in-dirent: $repaired"
+ run_e2fsck_on_mdt0
+
mount_client $MOUNT || error "(10) Fail to start client!"
#define OBD_FAIL_FID_LOOKUP 0x1505
[ $repaired -ge 2 ] ||
error "(9) Fail to generate FID-in-dirent for IGIF: $repaired"
+ run_e2fsck_on_mdt0
+
mount_client $MOUNT || error "(10) Fail to start client!"
#define OBD_FAIL_FID_LOOKUP 0x1505
[ "$STATUS" == "paused" ] ||
error "(20) Expect 'paused', but got '$STATUS'"
+ echo "stop $SINGLEMDS"
+ stop $SINGLEMDS > /dev/null || error "(20.1) Fail to stop MDS!"
+
+ echo "start $SINGLEMDS without resume LFSCK"
+ start $SINGLEMDS $MDT_DEVNAME $MOUNT_OPTS_SKIP_LFSCK > /dev/null ||
+ error "(20.2) Fail to start MDS!"
+
+ timer=0
+ while [ $timer -lt $timeout ]; do
+ STATUS=$(do_facet $SINGLEMDS "$LCTL get_param -n \
+ mdt.${MDT_DEV}.recovery_status |
+ awk '/^status/ { print \\\$2 }'")
+ [ "$STATUS" != "RECOVERING" ] && break;
+ sleep 1
+ timer=$((timer + 1))
+ done
+
+ [ $timer != $timeout ] ||
+ error "(20.3) recovery timeout"
+
+ STATUS=$($SHOW_NAMESPACE | awk '/^status/ { print $2 }')
+ [ "$STATUS" == "paused" ] ||
+ error "(20.4) Expect 'paused', but got '$STATUS'"
+
#define OBD_FAIL_LFSCK_DELAY3 0x1602
do_facet $SINGLEMDS $LCTL set_param fail_val=2 fail_loc=0x1602
[ $MDSCOUNT -lt 2 ] &&
skip "We need at least 2 MDSes for this test" && return
+ [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.55) ] &&
+ skip "Skip the test after 2.7.55 see LU-6437" && return
+
echo "#####"
echo "According to current metadata migration implementation,"
echo "before the old MDT-object is removed, both the new MDT-object"
#define OBD_FAIL_MIGRATE_DELAY 0x1803
do_facet mds2 $LCTL set_param fail_val=5 fail_loc=0x1803
echo "Migrate $DIR/$tdir/a1 from MDT1 to MDT0 with delay"
- $LFS mv -M 0 $DIR/$tdir/a1 &
+ $LFS migrate -m 0 $DIR/$tdir/a1 &
sleep 1
echo "Trigger layout LFSCK to race with the migration"
check_mount_and_prep
echo "Inject failure stub on MDT0 to simulate the case that the"
- echo "slave MDT-object (that resides on differnt MDT as the master"
+ echo "slave MDT-object (that resides on different MDT as the master"
echo "MDT-object resides on) lost the LMV EA."
#define OBD_FAIL_LFSCK_LOST_SLAVE_LMV 0x162a