Commit ed352042 authored by Chengguang Xu via Linux-f2fs-devel's avatar Chengguang Xu via Linux-f2fs-devel Committed by Jaegeuk Kim

f2fs: mark recovery flag correctly in read_raw_super_block()

On the combination of first fail and second success,
we will miss to mark recovery flag because currently
we reuse err variable in the loop.
Signed-off-by: default avatarChengguang Xu <cgxu519@zoho.com.cn>
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent fe1897ea
...@@ -2951,6 +2951,7 @@ static int read_raw_super_block(struct f2fs_sb_info *sbi, ...@@ -2951,6 +2951,7 @@ static int read_raw_super_block(struct f2fs_sb_info *sbi,
f2fs_err(sbi, "Unable to read %dth superblock", f2fs_err(sbi, "Unable to read %dth superblock",
block + 1); block + 1);
err = -EIO; err = -EIO;
*recovery = 1;
continue; continue;
} }
...@@ -2960,6 +2961,7 @@ static int read_raw_super_block(struct f2fs_sb_info *sbi, ...@@ -2960,6 +2961,7 @@ static int read_raw_super_block(struct f2fs_sb_info *sbi,
f2fs_err(sbi, "Can't find valid F2FS filesystem in %dth superblock", f2fs_err(sbi, "Can't find valid F2FS filesystem in %dth superblock",
block + 1); block + 1);
brelse(bh); brelse(bh);
*recovery = 1;
continue; continue;
} }
...@@ -2972,10 +2974,6 @@ static int read_raw_super_block(struct f2fs_sb_info *sbi, ...@@ -2972,10 +2974,6 @@ static int read_raw_super_block(struct f2fs_sb_info *sbi,
brelse(bh); brelse(bh);
} }
/* Fail to read any one of the superblocks*/
if (err < 0)
*recovery = 1;
/* No valid superblock */ /* No valid superblock */
if (!*raw_super) if (!*raw_super)
kvfree(super); kvfree(super);
......
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