From: sashiko-bot@kernel.org
To: "Kaitao Cheng" <kaitao.cheng@linux.dev>
Cc: nvdimm@lists.linux.dev
Subject: Re: [PATCH] fs/dax: Remove redundant deferred list initialization
Date: Thu, 03 Sep 2026 05:12:48 +0000 [thread overview]
Message-ID: <20260903051249.6F1661F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260903050207.7015-1-kaitao.cheng@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [Critical] dax_delete_mapping_range() splits PMD entries and causes duplicate processing leading to nrpages underflow
--
commit ab9d688e10fd86aba4bb8d5161b095d144b422c0
Author: Kaitao Cheng <chengkaitao@kylinos.cn>
fs/dax: Remove redundant deferred list initialization
This commit removes the redundant initialization of folio->_deferred_list
for large DAX folios in dax_folio_init(). This is because prep_compound_head()
already handles it, leaving compound folio initialization centralized.
> diff --git a/fs/dax.c b/fs/dax.c
> index 1fbba0d21c13d..4ea0f13d53a65 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
[ ... ]
[Severity: Critical]
This isn't a bug introduced by this patch, but I noticed a potential
pre-existing issue in dax_delete_mapping_range() when it processes
multi-order DAX entries:
fs/dax.c:dax_delete_mapping_range() {
...
XA_STATE(xas, &mapping->i_pages, start_idx);
...
xas_for_each(&xas, entry, end_idx) {
if (!xa_is_value(entry))
continue;
entry = wait_entry_unlocked_exclusive(&xas, entry);
if (!entry)
continue;
dax_disassociate_entry(entry, mapping, true);
xas_store(&xas, NULL);
mapping->nrpages -= 1UL << dax_entry_order(entry);
put_unlocked_entry(&xas, entry, WAKE_ALL);
}
...
}
When deleting a mapping range on a DAX filesystem containing PMD-sized
entries, this loop uses an order-0 XA_STATE. If xas_store() encounters an
order-9 PMD entry, doesn't it split the entry into 512 order-0 entries
(one NULL and 511 copies of the PMD value)?
Because xas_advance() is not called after the store, will the iterator
continue to visit the remaining 511 split sibling slots and process the same
PMD entry again?
Since mapping->nrpages is decremented by 1UL << dax_entry_order(entry) (which
is 512 for a PMD entry) on each iteration, could this underflow the counter by
262,144 per PMD entry and result in catastrophic memory accounting corruption?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260903050207.7015-1-kaitao.cheng@linux.dev?part=1
next prev parent reply other threads:[~2026-09-03 5:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 5:02 [PATCH] fs/dax: Remove redundant deferred list initialization Kaitao Cheng
2026-09-03 5:12 ` sashiko-bot [this message]
2026-09-03 6:13 ` Muchun Song
2026-09-04 10:56 ` Christian Brauner
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=20260903051249.6F1661F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kaitao.cheng@linux.dev \
--cc=nvdimm@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.