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=1796382655; b=a4DAgUiYalubgza+ppOgfDclwDrEmZ8Autqblf3qhUHJYJzmekgNi9r4U+ULz9dPttBe JZA7+Fr7+aJwW3y+ukn/ai5a6Pmr92uTj8GTGDEvHxTlMscPVo/bsGJg4WYsgE2yge11A wh3hizG3+yOKKsJk1HnLk5dmuGmRxKn2gBIMjEKxgmKNbu2BFK1CpGg2EMWXtM6gBRhOK MBrOEGVWOXtliG/Kpog1Q/B2t7/UPb6RjjCiMqjbglQrItO0FgJDpz6SP7vPC+CkSvpOl 1nwWWYAi9uhe+p8riXeKF7S2Hmn0KheEeETu/ZqJ3JI9xnzyhngb2hqlg2+5siDt7Qw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382655; 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=swxsgmUI1nGuvRlglB90teWI8IHnC+iea/Y4bYUGZFc=; b=PxEmHcGHQe+j+M9zLe+jR8bqJNyj8NrDMFD92ujc/t3dB9LPl85uwU1HT9d4P9VVUyGK +oBMWstbXMmRWVZjtvvwwV2BceW3ZkjRdUw/EpxtDRLo084AGrIB2AVlIEWWDm0AmxqbW LEbbxhcrcM4dgBa9p9VCvsOTq/fMWMM2mgKg7iJADJsDRkXYKwuHrQLix/EM6hP/vhyiz px9APefkKX3b6EpYbH8QqYw0BT4qxRpGraNCfBs9zt3SVVTD6Kec68c3xZniY/SkX3+qn ld1xBt5hSCzQT5tCCikbC2r0Rt/cpHoDAKtCmC6lddG2tMWpni7C7JHibHXQzr8GU3g== 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=stLQ5R3N; 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 0FD8A606A338; Fri, 4 Dec 2026 11:10: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=stLQ5R3N Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80AAF1F000C2; Fri, 4 Dec 2026 11:10:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382654; bh=swxsgmUI1nGuvRlglB90teWI8IHnC+iea/Y4bYUGZFc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=stLQ5R3NRBaIL+mUNKxhmC1JTA+M+HZM2HIELmN0MOLthDgPowT7PavtcOzm+nq2+ 52pAr66tvFmSFiIkf83gewGrBkSvsDYtOcbjKfCizzppPmS5nrjc+Kcv15IFxZxojI rZje3DtbdbLdZeaV8Vwb9JNFCl59QVJwN44MbX+0= 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.18 548/703] xfs: wait for direct I/O before swapping extents Date: Fri, 4 Dec 2026 19:07:27 +0900 Message-ID: <20261204100642.356006934@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Daejun Park commit 844bc1167f1b2d19d9495a556599af24dc4468bd upstream. An AIO direct write drops the iolock before its bios complete. XFS_IOC_SWAPEXT does not wait for it. The write can land in blocks that the swap moved to the temporary file. Once xfs_fsr frees them, the write corrupts whatever reuses them. Wait for direct I/O first, as exchange-range does. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") 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 | 1 + 1 file changed, 1 insertion(+) --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -1227,6 +1227,7 @@ xfs_swap_extent_flush( { int error; + inode_dio_wait(VFS_I(ip)); error = filemap_write_and_wait(VFS_I(ip)->i_mapping); if (error) return error;