From: Christoph Hellwig <hch@lst.de>
To: Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <chao@kernel.org>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH 1/6] f2fs: fix to return correct error number in f2fs_sync_node_pages()
Date: Thu, 8 May 2025 07:14:27 +0200 [thread overview]
Message-ID: <20250508051520.4169795-2-hch@lst.de> (raw)
In-Reply-To: <20250508051520.4169795-1-hch@lst.de>
From: Chao Yu <chao@kernel.org>
If __write_node_folio() failed, it will return AOP_WRITEPAGE_ACTIVATE,
the incorrect return value may be passed to userspace in below path,
fix it.
- sync_filesystem
- sync_fs
- f2fs_issue_checkpoint
- block_operations
- f2fs_sync_node_pages
- __write_node_folio
: return AOP_WRITEPAGE_ACTIVATE
Cc: stable@vger.kernel.org
Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chao Yu <chao@kernel.org>
---
fs/f2fs/node.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index ec74eb9982a5..69308523c34e 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -2092,10 +2092,14 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi,
ret = __write_node_folio(folio, false, &submitted,
wbc, do_balance, io_type, NULL);
- if (ret)
+ if (ret) {
folio_unlock(folio);
- else if (submitted)
+ folio_batch_release(&fbatch);
+ ret = -EIO;
+ goto out;
+ } else if (submitted) {
nwritten++;
+ }
if (--wbc->nr_to_write == 0)
break;
--
2.47.2
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2025-05-08 5:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-08 5:14 [f2fs-dev] cleanup AOP_WRITEPAGE_ACTIVATE use in f2fs v2 Christoph Hellwig
2025-05-08 5:14 ` Christoph Hellwig [this message]
2025-05-08 16:30 ` [f2fs-dev] [PATCH 1/6] f2fs: fix to return correct error number in f2fs_sync_node_pages() patchwork-bot+f2fs--- via Linux-f2fs-devel
2025-05-08 5:14 ` [f2fs-dev] [PATCH 2/6] f2fs: return bool from __f2fs_write_meta_folio Christoph Hellwig
2025-05-08 5:14 ` [f2fs-dev] [PATCH 3/6] f2fs: remove wbc->for_reclaim handling Christoph Hellwig
2025-05-08 9:46 ` Chao Yu via Linux-f2fs-devel
2025-05-08 5:14 ` [f2fs-dev] [PATCH 4/6] f2fs: always unlock the page in f2fs_write_single_data_page Christoph Hellwig
2025-05-08 9:48 ` Chao Yu via Linux-f2fs-devel
2025-05-08 5:14 ` [f2fs-dev] [PATCH 5/6] f2fs: simplify return value handling in f2fs_fsync_node_pages Christoph Hellwig
2025-05-08 9:53 ` Chao Yu via Linux-f2fs-devel
2025-05-08 5:14 ` [f2fs-dev] [PATCH 6/6] f2fs: return bool from __write_node_folio Christoph Hellwig
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=20250508051520.4169795-2-hch@lst.de \
--to=hch@lst.de \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@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;
as well as URLs for NNTP newsgroup(s).