Skip to contentSkip to conversation

f2fs: fix missing up_read

PATCH In review Jaegeuk Kim 2 participants 4 messages Sep 28, 2018 – Sep 29, 2018

Subsystems (2)
lore
Share & tools
lore

Jaegeuk Kim

author maintainer
#0 lore raw

PATCH 1/2 f2fs: fix missing up_read

This patch fixes missing up_read call.

Fixes c9b60788fc76 ("f2fs: fix to do sanity check with block address in main area")
Cc <[email protected]> # 4.19+
---
 fs/f2fs/node.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/f2fs/node.c +3 -1
index 3994b44541b4..acb819b8fc42 100644
@@ -1541,8 +1541,10 @@ static int __write_node_page(struct page *page, bool atomic, bool *submitted,
 	}
 
 	if (__is_valid_data_blkaddr(ni.blk_addr) &&
-		!f2fs_is_valid_blkaddr(sbi, ni.blk_addr, DATA_GENERIC))
+		!f2fs_is_valid_blkaddr(sbi, ni.blk_addr, DATA_GENERIC)) {
+		up_read(&sbi->node_write);
 		goto redirty_out;
+	}
 
 	if (atomic && !test_opt(sbi, NOBARRIER))
 		fio.op_flags |= REQ_PREFLUSH | REQ_FUA;
Signature · 1 line
2.19.0.605.g01d371f741-goog
author maintainer
#1 lore raw

PATCH 2/2 f2fs: keep lazytime on remount

This patch fixes losing lazytime when remounting f2fs.

---
 fs/f2fs/super.c | 1 +
 1 file changed, 1 insertion(+)
fs/f2fs/super.c +1 -0
index 603386525336..74056fa064ff 100644
@@ -1655,6 +1655,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
 
 	limit_reserve_root(sbi);
 	clear_sbi_flag(sbi, SBI_IS_MOUNT);
+	*flags = (*flags & ~SB_LAZYTIME) | (sb->s_flags & SB_LAZYTIME);
 	return 0;
 restore_gc:
 	if (need_restart_gc) {
Signature · 1 line
2.19.0.605.g01d371f741-goog
Reviewed-by on v1 1/2
#3 lore raw
In reply to Jaegeuk Kim
Quoted 1 line · Jaegeuk Kim

This patch fixes missing up_read call.

I guess we need to add additional type of error injection to simulate on-disk blkaddr corruption, then we can cover all those error paths.

Quoted 4 lines
Fixes c9b60788fc76 ("f2fs: fix to do sanity check with block address in main area")
Cc <[email protected]> # 4.19+

Thanks,