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=1796389452; b=tPY0dW6Asqm6IL7D91xqZf21QF9JK0u2LobtDcR/qblQBxOmTfMw4guFMOQ+8PEvu250 wK2Y3Byw8Vl9KxL2/RGPxjbIIk3Kqq6xP45NzznWF3UN2lI0QtEEe90hlAUnA5m8afOOh 50gaGoYzyxIthjRulmJUE+o/xQ5V3sHlS9nSBxktsCnLfMPOOeDnOQq3desV4YGf7BOwv 3Kub+PfMMC5mzZEjPv6Ud4QPK8cX4fohkQSVAbENmYZ7BeMa0+4R/CpDtPErVWOqW0+VC pu6rzATn45iSoZKgq4u+ocXXqmQkmeVB6cpz8j2Rkzzcf+0bj3Yn75ueykyVjgzQljg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389452; 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=LQAQ/bFsmqagvi3c0B/u+8BoRj3eIEl4Mn9Jsb1rbYI=; b=Oesw2uCxRqF2u3nEqq7uLUV/vQlFIxHX3oCtqfq7KBtCKqxpo7g4ytJiivthN8UgO5qC IneX6sIBQxCuVx+NV3pNCXQpr/qVYX6g5fHzRlsqKwmCqwgrs60chE0RSh3TIbeHMmdZa TyCT2bA46vOezIVn350f1KQFpLcE3dUok1z9oDZ76sXTSy0RdOE1Kz3LrLCg77OgydYWq 4/0ysQl2k0Hj7zgxxAPBAa7DBbt/6J5Q9/ylo6+dvas/yfo5UdwioNSz+1OnM4AZYdB7K Rwhfa8UToWst1eqsBjKaY9tU7CK3mMXo7496fB/Q2D7siy1UwvYgUNwbZOuQ216kJRQ== 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=JipRUZQh; 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 CE7AE606A322; Fri, 4 Dec 2026 13:04:12 +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=JipRUZQh Received: by smtp.kernel.org (Postfix) with ESMTPSA id E25651F00933; Fri, 4 Dec 2026 13:04:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389452; bh=LQAQ/bFsmqagvi3c0B/u+8BoRj3eIEl4Mn9Jsb1rbYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=JipRUZQhz6e7UM+NFtUDCKyABqlBrpg/mEdI1Lqt/WcfzsnSGpW7ZMf8w2PW6qKLs BoFdTSTQdnGyrcs+v+Nfhn580IAzRlBCY2lsatlTqwT96Tfp7CDthntSBKZ1BXxFcH doWmR4ngSahx6HoGYUi75WR17fT9SSQPSp1dpBXU= 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.1 0997/1059] xfs: break layouts before swapping extents Date: Fri, 4 Dec 2026 19:08:48 +0900 Message-ID: <20261204100709.818959899@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@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.1-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 @@ -1672,9 +1672,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)) { @@ -1868,9 +1868,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: