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=1796384028; b=ZHmn8qs/laWUYR+W0rolb5OPAatr/bF0l1qtAMJejWzPXwADbaI1QuCLjKffb61Z413E Zlx40b2TVt8TNKMcI1XkClDUxI/A0+chHXn8Dty+CCplF4afMQuuF4NVqjzOBQcevfFQY 1tAtXCJV7kj294SplKbaLjwhAQsliXz7Rvw49gUJtzZpih1rgBW6aXfnGth9q0E3pMMfa qH7Yanp5R0Ehv+VMAa2C8uR0H363nZad7l85bm0zCIuizKxTA4Ces0Rj2eGcEoxHqFiJV sly7vb3YK1f+N/h+zORXVM/+nk1rIEkGOCj9IxvceradP4tqd7NXYRnuZLOp9bAeVoQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384028; 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=Sk7w20djC2QMIeu+QPBr/tEMq2AGvnOPNQbh8WASHeA=; b=Sr9jQnBY4JsuceUnD89T9ms3uP1avXfmI/U93fMPevUjScjO9e9TYEAJez5p4W8ImeZq Fv3O8Q+LGM2K4vaoEmROtCYtzTLcbUZXT5NLZTYkPZgIhL27Q9h4dHfHlsO9zt12YfMiS zJ8jBayi0kQ331M3DEnSqTcom3/kxvh5agp07taG9Rwo/T/Pf9Bwxd4HwAhUOLUFhVcrY +7CUt7xgM5WUOS2SJVoKsEunE1NJoQi9lF9/jdRIVsBrsMIZ6cvqLQxSrds0HdX5TIl/D KwMx1ci3bT3tq6s6aV6Yvn/fl859Q/2olFA1b9YHRFxq01GpMw3m5hGUreF/nYLL3ow== 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=F9mDTxVB; 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 6EA1A606A322; Fri, 4 Dec 2026 11:33:48 +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=F9mDTxVB Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D9801F000C2; Fri, 4 Dec 2026 11:33:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384027; bh=Sk7w20djC2QMIeu+QPBr/tEMq2AGvnOPNQbh8WASHeA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=F9mDTxVBYy97UKyrAUWAPvKlta08CrUzNJVNN7bmGoW3XoxIDsC276NwSJzHQ5+Wv dwKrk8ZCKcbL0w3YkvKm2GAprL8hglyQBT7D7PgUByatVy8Jv3KygeTYJ+WFoaEx6s VfwYeMx+fi4a6Q+HKF3Bn24HLTiJqHTUXa5XfB+A= 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 466/555] xfs: wait for direct I/O before swapping extents Date: Fri, 4 Dec 2026 19:08:29 +0900 Message-ID: <20261204100627.083972124@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: 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 6.12-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 @@ -1217,6 +1217,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;