X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;ds=sidebyside;f=lustre%2Ftests%2Fsanity-lfsck.sh;h=f19d464645d7623ad0ead0a0f5616298d77d85fa;hb=be009cb4a73b3bef7302083bec7d1d6289d515b7;hp=e6048d5422918977419c380724b9470a7197ae14;hpb=8bd04b4e57663e02e9384727eca4df84d99edb3c;p=fs%2Flustre-release.git diff --git a/lustre/tests/sanity-lfsck.sh b/lustre/tests/sanity-lfsck.sh index e6048d5..f19d464 100644 --- a/lustre/tests/sanity-lfsck.sh +++ b/lustre/tests/sanity-lfsck.sh @@ -2189,6 +2189,28 @@ test_18b() { cancel_lru_locks mdc cancel_lru_locks osc + # dryrun mode only check orphans, not repaie + echo "Trigger layout LFSCK --dryrun to find out orphan OST-object" + $START_LAYOUT --dryrun -o -r || + error "Fail to start layout LFSCK in dryrun mode" + wait_all_targets_blocked layout completed 2 + + local PARAMS=$($SHOW_LAYOUT | awk '/^param/ { print $2 }') + [ "$PARAMS" == "dryrun,all_targets,orphan" ] || + error "Expect 'dryrun,all_targets,orphan', got '$PARAMS'" + + local orphans=$(do_facet mds1 $LCTL get_param -n \ + mdd.$(facet_svc mds1).lfsck_layout | + awk '/^inconsistent_orphan/ { print $2 }') + [ $orphans -eq 3 ] || + error "Expect 3 found on mds1, but got: $orphans" + + # orphan parents should not be created + local subdir + for subdir in $MOUNT/.lustre/lost+found/*; do + [ ! "$(ls -A $subdir)" ] || error "$subdir not empty" + done + echo "Trigger layout LFSCK on all devices to find out orphan OST-object" $START_LAYOUT -r -o || error "(1) Fail to start LFSCK for layout!" @@ -4772,7 +4794,7 @@ test_31b() { #define OBD_FAIL_LFSCK_BAD_NAME_HASH 0x1628 $LCTL set_param fail_loc=0x1628 fail_val=1 - createmany -d $DIR/$tdir/striped_dir/d $MDSCOUNT || + createmany -d $DIR/$tdir/striped_dir/d $((MDSCOUNT * 5)) || error "(2) Fail to create file under striped directory" $LCTL set_param fail_loc=0 fail_val=0 @@ -4785,13 +4807,14 @@ test_31b() { local repaired=$(do_facet mds2 $LCTL get_param -n \ mdd.$(facet_svc mds2).lfsck_namespace | awk '/^name_hash_repaired/ { print $2 }') + echo "repaired $repaired name entries with bad hash" [ $repaired -ge 1 ] || error "(5) Fail to repair bad name hash: $repaired" umount_client $MOUNT || error "(6) umount failed" mount_client $MOUNT || error "(7) mount failed" - for ((i = 0; i < $MDSCOUNT; i++)); do + for ((i = 0; i < $((MDSCOUNT * 5)); i++)); do stat $DIR/$tdir/striped_dir/d$i || error "(8) Fail to stat d$i after LFSCK" rmdir $DIR/$tdir/striped_dir/d$i || @@ -5764,6 +5787,35 @@ test_39() } run_test 39 "LFSCK does not break foreign dir and reverse is also true" +test_40a() { + [[ $MDSCOUNT -ge 2 ]] || skip "needs >= 2 MDTs" + + check_mount_and_prep + $LFS mkdir -i 1 $DIR/$tdir/dir1 + $LFS setstripe -E 1M -c1 -S 1M -E 128M -c2 -S 4M -E eof $DIR/$tdir/dir1 + + touch $DIR/$tdir/dir1/f1 + local layout1=$(get_layout_param $DIR/$tdir/dir1/f1) + + echo "Migrate $DIR/$tdir/dir1 from MDT1 to MDT0" + $LFS migrate -m 0 $DIR/$tdir/dir1 + + echo "trigger LFSCK for layout" + do_facet $SINGLEMDS $LCTL lfsck_start -M ${MDT_DEV} -t layout -r + + wait_update_facet $SINGLEMDS "$LCTL get_param -n \ + mdd.${MDT_DEV}.lfsck_layout | + awk '/^status/ { print \\\$2 }'" "completed" 32 || { + $SHOW_LAYOUT + error "(2) unexpected status" + } + + local layout2=$(get_layout_param $DIR/$tdir/dir1/f1) + + [[ "$layout1" == "$layout2" ]] || error "layout lost after lfsck" +} +run_test 40a "LFSCK correctly fixes lmm_oi in composite layout" + # restore MDS/OST size MDSSIZE=${SAVED_MDSSIZE} OSTSIZE=${SAVED_OSTSIZE}