Skip to contentSkip to conversation

f2fs: fix to release node block count in error path of f2fs_new_node_page()

PATCH New Chao Yu 2 participants 2 messages May 7, 2024 – May 11, 2024 F2FS file system

lore
Share & tools
lore

Chao Yu

author maintainer
#0 lore raw

PATCH v2 1/3 f2fs: fix to release node block count in error path of f2fs_new_node_page()

It missed to call dec_valid_node_count() to release node block count in error path, fix it.

Fixes 141170b759e0 ("f2fs: fix to avoid use f2fs_bug_on() in f2fs_new_node_page()")

---
v2:
- avoid comppile warning if CONFIG_F2FS_CHECK_FS is off.

 fs/f2fs/node.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/node.c +1 -1
index b3de6d6cdb02..7df5ad84cb5e 100644
@@ -1319,6 +1319,7 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs)
 	}
 	if (unlikely(new_ni.blk_addr != NULL_ADDR)) {
 		err = -EFSCORRUPTED;
+		dec_valid_node_count(sbi, dn->inode, !ofs);
 		set_sbi_flag(sbi, SBI_NEED_FSCK);
 		f2fs_handle_error(sbi, ERROR_INVALID_BLKADDR);
 		goto fail;
@@ -1345,7 +1346,6 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs)
 	if (ofs == 0)
 		inc_valid_inode_count(sbi);
 	return page;
-
 fail:
 	clear_node_page_dirty(page);
 	f2fs_put_page(page, 1);
Signature · 1 line
2.40.1
#1 lore raw
This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <[email protected]>:

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:

Quoted 10 lines · On Tue, 7 May 2024 11:31:00 +0800 you wrote:

It missed to call dec_valid_node_count() to release node block count in error path, fix it.

Fixes 141170b759e0 ("f2fs: fix to avoid use f2fs_bug_on() in f2fs_new_node_page()")

---
v2:
- avoid comppile warning if CONFIG_F2FS_CHECK_FS is off.

 fs/f2fs/node.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
- [f2fs-dev,v2,1/3] f2fs: fix to release node block count in error path of f2fs_new_node_page()

    https://git.kernel.org/jaegeuk/f2fs/c/0fa4e57c1db2

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html