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=1796389455; b=oOkcOr9jbIqTmY0fFrt4Sb6jgxGahEm716LN10xWuI2TJISS13/bTxHPr3nfeGfgYlZ3 imJbct2xuVbC0GDgGqmEpYbpQB0LFhkqT0rbyN6gt44rsGMTA+puHCg0oWu03CeXhAjnY 9QK4ZcgnYOR+t249YlWKdB8ljY/0wV0E+1mB1sSrsvWFotp79X8eRzg+A7/gVvfyRzWSE vgwucXPgYOBA+EXD6+i9SKLKMQ4EExUdlvBrm2kJGDU6GvCKZFISgbya91CXkIw1LVBog AA81gfMVWzcw1aTOPUuOLvKaKNMqaNpqMYb4mySGCiIconD0qXwcgtt6x7UUDJYX7KA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389455; 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=3nX3EEHyDz8z62uKhw5sB7j5jnskYgDDUIoJSaF2uGM=; b=qnzA81IzzJN82NK2GPzJdP8qkn3tVJUbXRnpokSQoC4grDpJdRI18nIbciiOTFLPwRUx +pcXdbV4G3lrs8bWqq7VDqoeLUW1Lwwhj35tXp7Tqf3gRhmsUXgqwzVdtZ/Ce/izo6JUp SDvfqip/SAZhzKhZyL8JOeaTLMJUtDmvcQ3mI9vqbRxdBkYnf2VwQEf9iLC3TPGE8kXBP AWOM1HYyS2gA7rWSs3L+wzMzTZtvE7XtSox9THrfLemQs7C0x+Pn3rcLkq9caa1MN77vD 7oToAIVz5rSxNt3gagFRQRwdkAjOmdU+YuKlMA1YQPckPXqkWaUelhMJ3v5Ac9F8tFg== 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=T49rmom5; 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 4BB42606A330; Fri, 4 Dec 2026 13:04:15 +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=T49rmom5 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AA7A1F00937; Fri, 4 Dec 2026 13:04:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389455; bh=3nX3EEHyDz8z62uKhw5sB7j5jnskYgDDUIoJSaF2uGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=T49rmom5TEuSL6l+asml6HhJeTe9VB8EMcJzpCd3QMtDBrG6phEBuvsdJmMjsoYYv ymx+TzIB4HWQ06/Sm+rFpJ12ScjC27yW3yxJvO+ZwsOLnPeO0vS6lw8yCVqwLdIsAo mzszzJMxadisjyKW2MYWHuxzvcj5lgr3GJcjZ+aw= 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 0998/1059] xfs: wait for direct I/O before swapping extents Date: Fri, 4 Dec 2026 19:08:49 +0900 Message-ID: <20261204100709.843752181@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: 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.1-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 @@ -1369,6 +1369,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;