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=1796381335; b=I+E/QH6gB7di9LFFWdoP3CI4Tconx9RVgZhJnVbaCEVkaPKt/UJ+Fa2O18gcnQJGJfjD rzyZOt1vY9I4C0bAZMQ5APpk3yu0ZxHZUY2UjmMWQFvd1up5qMG3MfDxDKXtwzq/1COpZ f4UquWvYlgvhC6HG2NxDuV3K0PhTv8CjDRgLwfW3st1DJ16cjfP7WxHXCUR0A7QIcc8c5 NlTRjO+eWN2LfXum4b9/LWlBY1rHYxEAsecbNBy87ltQFISGdnfH56r6cyC76JkuVSdSD Zkm5J1sA7spNrdL5Gp7ecV48d0VfCG48FCRaJC7vXUEkiQiY0CJ9TcRuBHXzdce/yLA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381335; 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=A2+ixfaDPEtv50C2itqppN4R6/lw2kZQTZVEK+9vol0=; b=pITOONs4kb6jcmd+QzDrXk+4IiFB6cCuj4v1jxkknRU5bKcjgf7CJqCqjXpa7A6JE9HN cV419jYUcErfGu41B/3Rba4SkIEQIgopAhh6FEvRAp6ciah0P6d5jBiQz+Y9RDDUNpipT IjEM7CyH/INWIvVaJR3EWNIoj/Pnp8qsFYgyLspAiwy37v9nEw4UIAMArodrE7653g/O5 wlZRh9xncga+eErJCsqb60+BiR4VyTt+8eVHkirHfyLOHtAOT25R5vnvfBQ/JGfiXOWVc GAMRtD8iHkj8vGosmswbOyQQc3XPY33Ui/gMOX2X5MN/1YTsGkhLRWRzMX/bntbQpDg== 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=bRnhf69H; 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 C3746606A32F; Fri, 4 Dec 2026 10:48:55 +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=bRnhf69H Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B2DF1F000CE; Fri, 4 Dec 2026 10:48:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381335; bh=A2+ixfaDPEtv50C2itqppN4R6/lw2kZQTZVEK+9vol0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=bRnhf69HTI2IRb/OnUvQu3YtiybiTWIeoQqRNnC+xPaqjxq5MS6q14z4zrIxcyOO7 nxQoLrJXoSZxvR+LDetEXy+xQl6LbBLifZwOJylsypI29A82+kOVTzT/upT/I/jrzs 7srXcWYpOMZ+MFfAqhveQum88zDuv5bwUmzsoKZI= 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 7.3 618/742] xfs: break layouts before swapping extents Date: Fri, 4 Dec 2026 19:08:02 +0900 Message-ID: <20261204100651.524763559@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-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 @@ -1554,9 +1554,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)) { @@ -1762,9 +1762,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: