From: Chao Yu <chao@kernel.org>
To: jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, Chao Yu <chao@kernel.org>
Subject: [PATCH 1/3] f2fs: fix to release node block count in error path of f2fs_new_node_page()
Date: Mon, 6 May 2024 18:33:11 +0800 [thread overview]
Message-ID: <20240506103313.773503-1-chao@kernel.org> (raw)
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()")
Signed-off-by: Chao Yu <chao@kernel.org>
---
fs/f2fs/node.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index b3de6d6cdb02..ae39971825bc 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1313,15 +1313,14 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs)
#ifdef CONFIG_F2FS_CHECK_FS
err = f2fs_get_node_info(sbi, dn->nid, &new_ni, false);
- if (err) {
- dec_valid_node_count(sbi, dn->inode, !ofs);
- goto fail;
- }
+ if (err)
+ goto out_dec;
+
if (unlikely(new_ni.blk_addr != NULL_ADDR)) {
err = -EFSCORRUPTED;
set_sbi_flag(sbi, SBI_NEED_FSCK);
f2fs_handle_error(sbi, ERROR_INVALID_BLKADDR);
- goto fail;
+ goto out_dec;
}
#endif
new_ni.nid = dn->nid;
@@ -1345,7 +1344,8 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs)
if (ofs == 0)
inc_valid_inode_count(sbi);
return page;
-
+out_dec:
+ dec_valid_node_count(sbi, dn->inode, !ofs);
fail:
clear_node_page_dirty(page);
f2fs_put_page(page, 1);
--
2.40.1
next reply other threads:[~2024-05-06 10:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-06 10:33 Chao Yu [this message]
2024-05-06 10:33 ` [PATCH 2/3] f2fs: fix to add missing iput() in gc_data_segment() Chao Yu
2024-05-09 0:46 ` Jaegeuk Kim
2024-05-09 2:49 ` Chao Yu
2024-05-09 15:50 ` Jaegeuk Kim
2024-05-10 3:36 ` [f2fs-dev] " Chao Yu
2024-05-06 10:33 ` [PATCH 3/3] f2fs: fix to do sanity check on i_nid for inline_data inode Chao Yu
2024-05-09 15:52 ` Jaegeuk Kim
2024-05-10 2:14 ` Chao Yu
2024-05-10 3:36 ` Jaegeuk Kim
2024-05-10 14:16 ` Chao Yu
2024-05-11 0:38 ` Jaegeuk Kim
2024-05-11 3:07 ` Chao Yu
2024-05-14 16:07 ` Jaegeuk Kim
2024-05-15 1:34 ` Chao Yu
2024-05-15 4:39 ` Jaegeuk Kim
2024-05-15 6:12 ` Chao Yu
2024-05-20 16:32 ` Jaegeuk Kim
2024-05-11 0:50 ` [f2fs-dev] [PATCH 1/3] f2fs: fix to release node block count in error path of f2fs_new_node_page() patchwork-bot+f2fs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240506103313.773503-1-chao@kernel.org \
--to=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox