From: Christoph Hellwig <hch@lst.de>
To: cem@kernel.org
Cc: linux-xfs@vger.kernel.org, cen zhang <zzzccc427@gmail.com>
Subject: [PATCH] xfs: mark the i_delayed_blks access in xfs_file_release as racy
Date: Tue, 13 May 2025 07:26:14 +0200 [thread overview]
Message-ID: <20250513052614.753577-1-hch@lst.de> (raw)
We don't bother with the ILOCK as this is best-effort and thus a racy
access is ok. Add a data_race() annotation to make that clear to
memory model verifiers.
Reported-by: cen zhang <zzzccc427@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_file.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 84f08c976ac4..a4a2109cb281 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -1549,7 +1549,11 @@ xfs_file_release(
*/
if (xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED)) {
xfs_iflags_clear(ip, XFS_EOFBLOCKS_RELEASED);
- if (ip->i_delayed_blks > 0)
+ /*
+ * Don't bother with the ILOCK as this is best-effort and thus
+ * a racy access is ok.
+ */
+ if (data_race(ip->i_delayed_blks) > 0)
filemap_flush(inode->i_mapping);
}
--
2.47.2
next reply other threads:[~2025-05-13 5:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <b0B7vqX5e__5JIDhxMANuyma5_RcE4wAhgR1-x-U6YY3qUy_mE220aCGAqsZ-LpEDc06cNfseqOGIgVw4BKmVg==@protonmail.internalid>
2025-05-13 5:26 ` Christoph Hellwig [this message]
2025-05-13 8:56 ` [PATCH] xfs: mark the i_delayed_blks access in xfs_file_release as racy Carlos Maiolino
2025-05-13 21:37 ` Dave Chinner
2025-05-14 4:29 ` Christoph Hellwig
2025-05-14 8:00 ` Carlos Maiolino
2025-05-14 13:04 ` Christoph Hellwig
2025-05-14 23:21 ` Dave Chinner
2025-05-16 6:34 ` 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=20250513052614.753577-1-hch@lst.de \
--to=hch@lst.de \
--cc=cem@kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=zzzccc427@gmail.com \
/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).