From: Dan Carpenter <dan.carpenter@linaro.org>
To: Jan Kara <jack@suse.cz>
Cc: linux-fsdevel@vger.kernel.org
Subject: [bug report] writeback: Avoid contention on wb->list_lock when switching inodes
Date: Thu, 18 Sep 2025 12:52:54 +0300 [thread overview]
Message-ID: <aMvWdo1EjHoPA-BH@stanley.mountain> (raw)
Hello Jan Kara,
Commit 67c312b4e9bf ("writeback: Avoid contention on wb->list_lock
when switching inodes") from Sep 12, 2025 (linux-next), leads to the
following Smatch static checker warning:
fs/fs-writeback.c:730 cleanup_offline_cgwb()
error: uninitialized symbol 'new_wb'.
fs/fs-writeback.c
709 bool cleanup_offline_cgwb(struct bdi_writeback *wb)
710 {
711 struct cgroup_subsys_state *memcg_css;
712 struct inode_switch_wbs_context *isw;
713 struct bdi_writeback *new_wb;
714 int nr;
715 bool restart = false;
716
717 isw = kzalloc(struct_size(isw, inodes, WB_MAX_INODES_PER_ISW),
718 GFP_KERNEL);
719 if (!isw)
720 return restart;
721
722 atomic_inc(&isw_nr_in_flight);
723
724 for (memcg_css = wb->memcg_css->parent; memcg_css;
725 memcg_css = memcg_css->parent) {
The concern here is that do we know for sure that we enter the loop?
726 new_wb = wb_get_create(wb->bdi, memcg_css, GFP_KERNEL);
727 if (new_wb)
728 break;
729 }
--> 730 if (unlikely(!new_wb))
^^^^^^
These are a common source of false positives, but I just wanted to be
sure. Thanks!
731 new_wb = &wb->bdi->wb; /* wb_get() is noop for bdi's wb */
732
733 nr = 0;
regards,
dan carpenter
next reply other threads:[~2025-09-18 9:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-18 9:52 Dan Carpenter [this message]
2025-09-18 10:31 ` [bug report] writeback: Avoid contention on wb->list_lock when switching inodes Jan Kara
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=aMvWdo1EjHoPA-BH@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@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