Skip to content

Commit

Permalink
f2fs: mark recovery flag correctly in read_raw_super_block()
Browse files Browse the repository at this point in the history
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: Chengguang Xu <[email protected]>
Reviewed-by: Chao Yu <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
  • Loading branch information
Chengguang Xu via Linux-f2fs-devel authored and Jaegeuk Kim committed Oct 22, 2019
1 parent fe1897e commit ed35204
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions fs/f2fs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -2951,6 +2951,7 @@ static int read_raw_super_block(struct f2fs_sb_info *sbi,
f2fs_err(sbi, "Unable to read %dth superblock",
block + 1);
err = -EIO;
*recovery = 1;
continue;
}

Expand All @@ -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",
block + 1);
brelse(bh);
*recovery = 1;
continue;
}

Expand All @@ -2972,10 +2974,6 @@ static int read_raw_super_block(struct f2fs_sb_info *sbi,
brelse(bh);
}

/* Fail to read any one of the superblocks*/
if (err < 0)
*recovery = 1;

/* No valid superblock */
if (!*raw_super)
kvfree(super);
Expand Down

0 comments on commit ed35204

Please sign in to comment.