+run_test 14 "OI scrub can repair objects under lost+found"
+
+test_15() {
+ local repaired
+
+ formatall > /dev/null
+ setupall > /dev/null
+
+ scrub_prep 20 1
+ echo "starting MDTs with OI scrub disabled"
+ scrub_start_mds 2 "$MOUNT_OPTS_NOSCRUB"
+ scrub_check_status 3 init
+ [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] ||
+ scrub_check_flags 4 recreated,inconsistent
+
+ # run under dryrun mode
+ scrub_start 5 --dryrun
+ scrub_check_status 6 completed
+ if [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ]; then
+ scrub_check_flags 7 inconsistent
+ repaired=2
+ else
+ scrub_check_flags 7 recreated,inconsistent
+ repaired=20
+ fi
+ scrub_check_params 8 dryrun
+ scrub_check_repaired 9 $repaired 1
+
+ # run under dryrun mode again
+ scrub_start 10 --dryrun
+ scrub_check_status 11 completed
+ if [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ]; then
+ scrub_check_flags 12 inconsistent
+ else
+ scrub_check_flags 12 recreated,inconsistent
+ fi
+ scrub_check_params 13 dryrun
+ scrub_check_repaired 14 $repaired 1
+
+ # run under normal mode
+ scrub_start 15
+ scrub_check_status 16 completed
+ scrub_check_flags 17 ""
+ scrub_check_params 18 ""
+ scrub_check_repaired 19 $repaired 0
+
+ # run under normal mode again
+ scrub_start 20
+ scrub_check_status 21 completed
+ scrub_check_flags 22 ""
+ scrub_check_params 23 ""
+ scrub_check_repaired 24 0 0
+}
+run_test 15 "Dryrun mode OI scrub"
+
+test_16() {
+ [ $(facet_fstype $SINGLEMDS) != "zfs" ] &&
+ skip "only support zfs temporarily" && return
+
+ check_mount_and_prep
+ scrub_enable_index_backup
+
+ #define OBD_FAIL_OSD_INDEX_CRASH 0x199
+ do_nodes $(comma_list $(mdts_nodes)) $LCTL set_param fail_loc=0x199
+ scrub_prep 0
+ do_nodes $(comma_list $(mdts_nodes)) $LCTL set_param fail_loc=0
+
+ echo "starting MDTs without disabling OI scrub"
+ scrub_start_mds 1 "$MOUNT_OPTS_SCRUB"
+ mount_client $MOUNT || error "(2) Fail to start client!"
+ scrub_check_data 3
+ scrub_disable_index_backup
+}
+run_test 16 "Initial OI scrub can rebuild crashed index objects"