From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Kemeng Shi <shikemeng@huaweicloud.com>, Jan Kara <jack@suse.cz>,
Christian Brauner <brauner@kernel.org>,
Sasha Levin <sashal@kernel.org>,
viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org
Subject: [PATCH AUTOSEL 6.9 01/15] fs/writeback: bail out if there is no more inodes for IO and queued once
Date: Sun, 26 May 2024 05:41:33 -0400 [thread overview]
Message-ID: <20240526094152.3412316-1-sashal@kernel.org> (raw)
From: Kemeng Shi <shikemeng@huaweicloud.com>
[ Upstream commit d92109891f21cf367caa2cc6dff11a4411d917f4 ]
For case there is no more inodes for IO in io list from last wb_writeback,
We may bail out early even there is inode in dirty list should be written
back. Only bail out when we queued once to avoid missing dirtied inode.
This is from code reading...
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Link: https://lore.kernel.org/r/20240228091958.288260-3-shikemeng@huaweicloud.com
Reviewed-by: Jan Kara <jack@suse.cz>
[brauner@kernel.org: fold in memory corruption fix from Jan in [1]]
Link: https://lore.kernel.org/r/20240405132346.bid7gibby3lxxhez@quack3 [1]
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/fs-writeback.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index e4f17c53ddfcf..d31853032a931 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -2069,6 +2069,7 @@ static long wb_writeback(struct bdi_writeback *wb,
struct inode *inode;
long progress;
struct blk_plug plug;
+ bool queued = false;
blk_start_plug(&plug);
for (;;) {
@@ -2111,8 +2112,10 @@ static long wb_writeback(struct bdi_writeback *wb,
dirtied_before = jiffies;
trace_writeback_start(wb, work);
- if (list_empty(&wb->b_io))
+ if (list_empty(&wb->b_io)) {
queue_io(wb, work, dirtied_before);
+ queued = true;
+ }
if (work->sb)
progress = writeback_sb_inodes(work->sb, wb, work);
else
@@ -2127,7 +2130,7 @@ static long wb_writeback(struct bdi_writeback *wb,
* mean the overall work is done. So we keep looping as long
* as made some progress on cleaning pages or inodes.
*/
- if (progress) {
+ if (progress || !queued) {
spin_unlock(&wb->list_lock);
continue;
}
--
2.43.0
next reply other threads:[~2024-05-26 9:41 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-26 9:41 Sasha Levin [this message]
2024-05-26 9:41 ` [PATCH AUTOSEL 6.9 02/15] md: Fix overflow in is_mddev_idle Sasha Levin
2024-05-27 1:08 ` Yu Kuai
2024-06-19 14:27 ` Sasha Levin
2024-05-26 9:41 ` [PATCH AUTOSEL 6.9 03/15] padata: Disable BH when taking works lock on MT path Sasha Levin
2024-05-26 9:41 ` [PATCH AUTOSEL 6.9 04/15] crypto: hisilicon/sec - Fix memory leak for sec resource release Sasha Levin
2024-05-26 9:41 ` [PATCH AUTOSEL 6.9 05/15] crypto: hisilicon/qm - Add the err memory release process to qm uninit Sasha Levin
2024-05-26 9:41 ` [PATCH AUTOSEL 6.9 06/15] io_uring/sqpoll: work around a potential audit memory leak Sasha Levin
2024-05-26 9:41 ` [PATCH AUTOSEL 6.9 07/15] rcutorture: Fix rcu_torture_one_read() pipe_count overflow comment Sasha Levin
2024-05-26 9:41 ` [PATCH AUTOSEL 6.9 08/15] rcutorture: Make stall-tasks directly exit when rcutorture tests end Sasha Levin
2024-05-26 9:41 ` [PATCH AUTOSEL 6.9 09/15] rcutorture: Fix invalid context warning when enable srcu barrier testing Sasha Levin
2024-05-26 9:41 ` [PATCH AUTOSEL 6.9 10/15] platform/chrome: cros_usbpd_logger: provide ID table for avoiding fallback match Sasha Levin
2024-05-26 9:41 ` [PATCH AUTOSEL 6.9 11/15] platform/chrome: cros_usbpd_notify: " Sasha Levin
2024-05-26 9:41 ` [PATCH AUTOSEL 6.9 12/15] binfmt_elf: Leave a gap between .bss and brk Sasha Levin
2024-05-27 16:32 ` Kees Cook
2024-06-19 14:28 ` Sasha Levin
2024-05-26 9:41 ` [PATCH AUTOSEL 6.9 13/15] ubsan: Avoid i386 UBSAN handler crashes with Clang Sasha Levin
2024-05-26 9:41 ` [PATCH AUTOSEL 6.9 14/15] arm64: defconfig: select INTERCONNECT_QCOM_SM6115 as built-in Sasha Levin
2024-05-26 9:41 ` [PATCH AUTOSEL 6.9 15/15] block/ioctl: prefer different overflow check Sasha Levin
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=20240526094152.3412316-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shikemeng@huaweicloud.com \
--cc=stable@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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