Skip to contentSkip to conversation

f2fs: mark recovery flag correctly in read_raw_super_block()

PATCH In review Chengguang Xu via Linux-f2fs-devel 2 participants 2 messages Sep 27, 2019 F2FS file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 fs/f2fs/super.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
fs/f2fs/super.c +2 -4
index 1443cee15863..f3a68af3b43a 100644
@@ -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;
 		}
 
@@ -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;
 		}
 
@@ -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);
Signature · 10 lines
2.20.1





_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · On 2019/9/27 9:35, Chengguang Xu via Linux-f2fs-devel wrote:

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.

Thanks,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel