Commit 2adc3505 authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

f2fs: set SBI_NEED_FSCK when encountering exception in recovery

This patch tries to set SBI_NEED_FSCK flag into sbi only when we fail to recover
in fill_super, so we could skip fscking image when we fail to fill super for
other reason.
Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 21cb1d99
...@@ -966,7 +966,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -966,7 +966,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
struct buffer_head *raw_super_buf; struct buffer_head *raw_super_buf;
struct inode *root; struct inode *root;
long err = -EINVAL; long err = -EINVAL;
bool retry = true; bool retry = true, need_fsck = false;
char *options = NULL; char *options = NULL;
int i; int i;
...@@ -1155,9 +1155,6 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1155,9 +1155,6 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
if (err) if (err)
goto free_proc; goto free_proc;
if (!retry)
set_sbi_flag(sbi, SBI_NEED_FSCK);
/* recover fsynced data */ /* recover fsynced data */
if (!test_opt(sbi, DISABLE_ROLL_FORWARD)) { if (!test_opt(sbi, DISABLE_ROLL_FORWARD)) {
/* /*
...@@ -1169,8 +1166,13 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1169,8 +1166,13 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
err = -EROFS; err = -EROFS;
goto free_kobj; goto free_kobj;
} }
if (need_fsck)
set_sbi_flag(sbi, SBI_NEED_FSCK);
err = recover_fsync_data(sbi); err = recover_fsync_data(sbi);
if (err) { if (err) {
need_fsck = true;
f2fs_msg(sb, KERN_ERR, f2fs_msg(sb, KERN_ERR,
"Cannot recover all fsync data errno=%ld", err); "Cannot recover all fsync data errno=%ld", err);
goto free_kobj; goto free_kobj;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment