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=1796381342; b=o/MGpQrTCXEW5dNZjtmBh+/NxnhetBW5KD04WQWkBI7OfwcC7cYDvAa6yxNWvZPajHMi 3YdK/pa/faqoE98x/hFBBLwYwZWXUtq014RFXUhUZmSncsvtsCvUrfVnt6WiSI6x0bqMW Tyk1WmKqy3eu1fUqFt/OdSUovCNqtCE0fZr/hmvs+CHUDw4AWwYJhdXsDMh+P6S0gF0b2 qRhAvORXucOZI3Jh8+pUlfRFmEWb2ACPVJGmDU9ESp28vqlL6ncOY9XJnYOOQf5cb0atc dsUxrvasR+PI+dbDeXRoQxCz2RHL3dhWZgSdL9rQaxq+tsu+Tg+h0ng2Pc0orroYIwg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381342; 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=CtYqOkgvSoQwl7ctflJSxvekZXh23UYf1ECK77XYQYk=; b=LsJ4GMFJOJc4AfS9ADgSk9FKDy+pmDyGwzbIUrB0+rtNG+beVh4umxdDqnawga0uvJ20 LiPCvUY8odygv9mMJLPFOypwDJEpjBhySu3SZfHzrPMlCGsiHRYxyMnmf3pVVLVy8KTsq qMYjION30YH+xfmzePud5D0Uf4YGht4UBOo2MG2IZH7JljyWauKlODTrESrNDAgWuYnR7 s2Sg2X0QpRbK2pVZu6njzUQuniT7Ssk6pIJHRs5ule+jHgOMN/Mb+QB6pNYHSG9PnFU6S sIOnZ53duybg3/2NeurdsAdwjcg6M5ms7SQNE0P6EMbVPHRJoWxaIvYh6Xyajvp/GPw== 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=rBMGKmAG; 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 B4D39606A32C; Fri, 4 Dec 2026 10:49:02 +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=rBMGKmAG Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50CD51F000CE; Fri, 4 Dec 2026 10:49:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381342; bh=CtYqOkgvSoQwl7ctflJSxvekZXh23UYf1ECK77XYQYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rBMGKmAG0LZMHBz2Pd5kcTDsx3OyP5h/vDQU4nZc+wkLL1bhfIDsfZq3OCahXvMvG q2V5TAtbEzIZ713LnBf3Hdt42jNze5cqTEgsDyn/67/ASnarU4963/4Fk0KGPLE1cd ZQ/FVIyBPsYVACpDWwzcIzxEBhCw1//3EZN/JBns= 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 621/742] xfs: wait for direct I/O before swapping extents Date: Fri, 4 Dec 2026 19:08:05 +0900 Message-ID: <20261204100651.604831795@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: 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 7.3-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 @@ -1257,6 +1257,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;