Skip to content

Commit edf3c08

Browse files
Zhiguo NiuJaegeuk Kim
authored andcommitted
f2fs: fix to avoid changing 'check only' behaior of recovery
The following two 'check only recovery' processes are very dependent on the return value of f2fs_recover_fsync_data, especially when the return value is greater than 0. 1. when device has readonly mode, shown as commit 23738e7 ("f2fs: fix to restrict mount condition on readonly block device") 2. mount optiont NORECOVERY or DISABLE_ROLL_FORWARD is set, shown as commit 6781eab ("f2fs: give -EINVAL for norecovery and rw mount") However, commit c426d99 ("f2fs: Check write pointer consistency of open zones") will change the return value unexpectedly, thereby changing the caller's behavior This patch let the f2fs_recover_fsync_data return correct value,and not do f2fs_check_and_fix_write_pointer when the device is read-only. Fixes: c426d99 ("f2fs: Check write pointer consistency of open zones") Signed-off-by: Zhiguo Niu <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 6d4008d commit edf3c08

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

fs/f2fs/recovery.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -899,10 +899,8 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only)
899899
* and the f2fs is not read only, check and fix zoned block devices'
900900
* write pointer consistency.
901901
*/
902-
if (!err) {
902+
if (!err)
903903
err = f2fs_check_and_fix_write_pointer(sbi);
904-
ret = err;
905-
}
906904

907905
if (!err)
908906
clear_sbi_flag(sbi, SBI_POR_DOING);

fs/f2fs/segment.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5462,7 +5462,8 @@ int f2fs_check_and_fix_write_pointer(struct f2fs_sb_info *sbi)
54625462
{
54635463
int ret;
54645464

5465-
if (!f2fs_sb_has_blkzoned(sbi) || f2fs_readonly(sbi->sb))
5465+
if (!f2fs_sb_has_blkzoned(sbi) || f2fs_readonly(sbi->sb) ||
5466+
f2fs_hw_is_readonly(sbi))
54665467
return 0;
54675468

54685469
f2fs_notice(sbi, "Checking entire write pointers");

0 commit comments

Comments
 (0)