[PATCH] xfs: mark the i_delayed_blks access in xfs_file_release as racy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 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





[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux