new file mode 100644
@@ -0,0 +1,5 @@
+1. create f2fs image
+2. inject s_stop_reason in super block
+3. fsck -a detects error and clear the error
+4. inject s_errors in super block
+5. fsck -a detects error and clear the error
new file mode 100644
@@ -0,0 +1,59 @@
+Info: Automatic fix mode enabled.
+Info: checkpoint stop reason: fault_inject(1)
+Info: Write valid nat_bits in checkpoint
+Info: checkpoint state = x : nat_bits compacted_summary unmount
+
+[FSCK] Unreachable nat entries [Ok..] [x]
+[FSCK] SIT valid block bitmap checking [Ok..]
+[FSCK] Hard link checking for regular file [Ok..] [x]
+[FSCK] valid_block_count matching with CP [Ok..] [x]
+[FSCK] valid_node_count matching with CP (de lookup) [Ok..] [x]
+[FSCK] valid_node_count matching with CP (nat lookup) [Ok..] [x]
+[FSCK] valid_inode_count matched with CP [Ok..] [x]
+[FSCK] free segment_count matched with CP [Ok..] [x]
+[FSCK] next block offset is free [Ok..]
+[FSCK] fixing SIT types
+[FSCK] other corrupted bugs [Ok..]
+Info: Duplicate valid checkpoint to mirror position x -> x
+Info: Write valid nat_bits in checkpoint
+Info: write_checkpoint() cur_cp:x
+Info: Write valid nat_bits in checkpoint
+Info: fix_checkpoint() cur_cp:x
+[update_superblock: x] Info: Done to update superblock
+
+Info: Automatic fix mode enabled.
+Info: fs errors: fail_decompression
+Info: checkpoint state = x : allow_nocrc nat_bits unmount
+
+[FSCK] Unreachable nat entries [Ok..] [x]
+[FSCK] SIT valid block bitmap checking [Ok..]
+[FSCK] Hard link checking for regular file [Ok..] [x]
+[FSCK] valid_block_count matching with CP [Ok..] [x]
+[FSCK] valid_node_count matching with CP (de lookup) [Ok..] [x]
+[FSCK] valid_node_count matching with CP (nat lookup) [Ok..] [x]
+[FSCK] valid_inode_count matched with CP [Ok..] [x]
+[FSCK] free segment_count matched with CP [Ok..] [x]
+[FSCK] next block offset is free [Ok..]
+[FSCK] fixing SIT types
+[FSCK] other corrupted bugs [Ok..]
+[update_superblock: x] Info: Done to update superblock
+
+Info: Automatic fix mode enabled.
+Info: checkpoint state = x : allow_nocrc nat_bits unmount
+Info: No error was reported
+
+Info: Force to fix corruption
+Info: checkpoint state = x : allow_nocrc nat_bits unmount
+
+[FSCK] Unreachable nat entries [Ok..] [x]
+[FSCK] SIT valid block bitmap checking [Ok..]
+[FSCK] Hard link checking for regular file [Ok..] [x]
+[FSCK] valid_block_count matching with CP [Ok..] [x]
+[FSCK] valid_node_count matching with CP (de lookup) [Ok..] [x]
+[FSCK] valid_node_count matching with CP (nat lookup) [Ok..] [x]
+[FSCK] valid_inode_count matched with CP [Ok..] [x]
+[FSCK] free segment_count matched with CP [Ok..] [x]
+[FSCK] next block offset is free [Ok..]
+[FSCK] fixing SIT types
+[FSCK] other corrupted bugs [Ok..]
+
new file mode 100644
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+DESC="superblock[1] with s_stop_reason and s_errors"
+
+. $TOPDIR/tests/helpers
+
+cleanup pre > $LOG 2>&1
+make_f2fs >> $LOG 2>&1
+
+$INJECT --sb 1 --mb s_stop_reason --idx 1 --val 1 $META >> $LOG 2>&1
+$FSCK $FSCK_OPTS -a $META > $OUT 2>&1
+
+$INJECT --sb 1 --mb s_errors --idx 0 --val 2 $META >> $LOG 2>&1
+$FSCK $FSCK_OPTS -a $META >> $OUT 2>&1
+
+# both -a and -f cannot detect errors
+$FSCK $FSCK_OPTS -a $META >> $OUT 2>&1
+echo "" >> $OUT
+$FSCK $FSCK_OPTS -f $META >> $OUT 2>&1
+cat $OUT >> $LOG
+
+check_result
+cleanup post >> $LOG 2>&1
Signed-off-by: Sheng Yong <shengyong@oppo.com> --- tests/f_sb_errors/README | 5 ++++ tests/f_sb_errors/expect.in | 59 +++++++++++++++++++++++++++++++++++++ tests/f_sb_errors/script | 23 +++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 tests/f_sb_errors/README create mode 100644 tests/f_sb_errors/expect.in create mode 100644 tests/f_sb_errors/script