public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Chandan Babu R <chandan.babu@oracle.com>,
	"Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 2/3] xfs: remove a racy if_bytes check in xfs_reflink_end_cow_extent
Date: Thu,  2 May 2024 09:33:54 +0200	[thread overview]
Message-ID: <20240502073355.1893587-3-hch@lst.de> (raw)
In-Reply-To: <20240502073355.1893587-1-hch@lst.de>

Accessing if_bytes without the ilock is racy.  Remove the initial
if_bytes == 0 check in xfs_reflink_end_cow_extent and let
ext_iext_lookup_extent fail for this case after we've taken the ilock.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
---
 fs/xfs/xfs_reflink.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index d6d5b65eb07fca..3bb5318f699ddc 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -717,12 +717,6 @@ xfs_reflink_end_cow_extent(
 	int			nmaps;
 	int			error;
 
-	/* No COW extents?  That's easy! */
-	if (ifp->if_bytes == 0) {
-		*offset_fsb = end_fsb;
-		return 0;
-	}
-
 	resblks = XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK);
 	error = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, resblks, 0,
 			XFS_TRANS_RESERVE, &tp);
-- 
2.39.2


  parent reply	other threads:[~2024-05-02  7:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-02  7:33 iext handling fixes and cleanup v2 Christoph Hellwig
2024-05-02  7:33 ` [PATCH 1/3] xfs: upgrade the extent counters in xfs_reflink_end_cow_extent later Christoph Hellwig
2024-05-02  7:33 ` Christoph Hellwig [this message]
2024-05-02  7:33 ` [PATCH 3/3] xfs: simplify iext overflow checking and upgrade Christoph Hellwig
2024-05-02  7:55   ` Dave Chinner
  -- strict thread matches above, loose matches on Subject: below --
2024-04-30 12:55 iext handling fixes and cleanup Christoph Hellwig
2024-04-30 12:56 ` [PATCH 2/3] xfs: remove a racy if_bytes check in xfs_reflink_end_cow_extent 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=20240502073355.1893587-3-hch@lst.de \
    --to=hch@lst.de \
    --cc=chandan.babu@oracle.com \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@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