From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384121; b=GVvFKNDRs3TNJ9qJmpokSinnUuycP+ce3EtgShTi5XXCgJO5DS05MHFp7PmSVtr4VfJb sNAr4EvPMsPoI1RKf7QUY75xxxbzZqO3r81VTY10C/r41pePSEyoDuKEgMZV4+uxVJtTl u+F6oh9kHTUdcORt1qSmpNX2zR4uGCoiytIJJWdls/dDqLwgkHd7RU9HdbRpYUa5grt5i hLF/N+aj7jPV0/G2+UCa4z9wzWI4mqYysYIWDvPgR38MOO1He4JFOb89Z0De/HNjPrhbj dxuN3QBfRC+hSZX5vMSZXw06FfdzHnWt2nNXSlXu2KxR9KtV4OegHMOXjZC/IYJRsFg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384121; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=yJK+fUa2ZVh2seHXYsg5kviF+sRxdiN9/2K4ljFhjXQ=; b=VBva1FoxblYn1GHpJY5uD8zdyDhiJr3Q6CtyV2N6sNEGzB3sxrsoi913j1IFDEMFcuPy XxP3bKmR1nut/1vZl2if4Lj1U9sSnOXF702uo1x/hvTx+jE7VA4SVy9peXDZ+y5TRBu8P a+NktPxLfsHb551DwmG/hcptgIcfdYWnS/i5d0mzspE88NBI5HqM4Fwt3eKkaCZ1BKQOu fz9lGVk3QuJaLKwb/j8Bj/JEesjhEPByeiZawwKk0nZSb47yp54x756dlW/SKrHtcEjAu tBZZyvC5QGQO8ipbsN+wGI8d9ya4G45mfXZzsEbmlMsddgDySn5ysJpPRtjVeIKFuIg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=BiRJdfvD; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EA90606A322; Fri, 4 Dec 2026 11:35:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=BiRJdfvD Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7DF71F000C2; Fri, 4 Dec 2026 11:35:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384121; bh=yJK+fUa2ZVh2seHXYsg5kviF+sRxdiN9/2K4ljFhjXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BiRJdfvDW0d5X6NNOZhfXr08XRHRWXRMOjaujDV7Jza6Q98Wm7Hq7afdRg7mFWPvL EDfzi6aPFsKIVcHws8zQrtfof/AP94yx0vfas4Jr5ehJ3+TXG1TsItz+rrWXPfwGDT p8UTPYqC75hyG6xXlQz8RiEZnzE+vQEpWTHXX1Mk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Daejun Park , Christoph Hellwig , Carlos Maiolino Subject: [PATCH 6.12 464/555] xfs: break layouts before swapping extents Date: Fri, 4 Dec 2026 19:08:27 +0900 Message-ID: <20261204100627.017710622@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Daejun Park commit 0d8026c7ac0c79a8ebe2942a3c3114c06aced734 upstream. XFS_IOC_SWAPEXT does not break pNFS layouts. A client can keep writing to blocks that the swap moved to the temporary file. xfs_fsr frees those blocks when it closes that file. The writes then land in whatever reuses them. Lock with xfs_ilock2_io_mmap(), as the exchange-range ioctls do. Fixes: 781355c6e5ae ("xfs: recall pNFS layouts on conflicting access") Cc: stable@vger.kernel.org Signed-off-by: Daejun Park Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino Signed-off-by: Greg Kroah-Hartman --- fs/xfs/xfs_bmap_util.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -1514,9 +1514,9 @@ xfs_swap_extents( * page cache safely. Once we have done this we can take the ilocks and * do the rest of the checks. */ - lock_two_nondirectories(VFS_I(ip), VFS_I(tip)); - filemap_invalidate_lock_two(VFS_I(ip)->i_mapping, - VFS_I(tip)->i_mapping); + error = xfs_ilock2_io_mmap(ip, tip); + if (error) + return error; /* Verify that both files have the same format */ if ((VFS_I(ip)->i_mode & S_IFMT) != (VFS_I(tip)->i_mode & S_IFMT)) { @@ -1710,9 +1710,7 @@ out_unlock_ilock: xfs_iunlock(ip, XFS_ILOCK_EXCL); xfs_iunlock(tip, XFS_ILOCK_EXCL); out_unlock: - filemap_invalidate_unlock_two(VFS_I(ip)->i_mapping, - VFS_I(tip)->i_mapping); - unlock_two_nondirectories(VFS_I(ip), VFS_I(tip)); + xfs_iunlock2_io_mmap(ip, tip); return error; out_trans_cancel: