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=1796384810; b=C3GFqmz5aFUG6Hue5/NmFsc1psuYloV+ZOUm8rAZMkEx1tefKrT+MMaFdSPkRiykSXUr +o2R/b7C3XzLOSfzUPnj3Z2c5E0QYYAdyAupLOJVfGOvKxQIr9msPmHzmhI65PI4H7pJJ rU6+cvXHLjXjjAK2AgDOl6QkzchkQji0cBIQZQEIL289GDGYlFJrXqt939IRDAPXNw7Oe 0MALtbhTpe3FajlK6v3SZaci8edX9wZIaEC6RmyupLhA4E85SBoMLrD0tqBqJC3bMZO0W nCJRbjIY8xBNbNW+LIgX6TF/50IM7jtx/pAA/E2CQ/Iz0RF9FFzr3X0/tfGSx/Ab0eg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384810; 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=/M+jb1k5XLuvNRGBfimoNAjCg7mkdqIH4Th4cU3pfqo=; b=EcevLP89Z3qLsZKLd5anuD4iEUBupqamP4v+utQo8K1785BTier3sNU1K/62BFn6ZsHl g/S69GB/jwSd5as74eFVd40661rtVSlkowTAoS83QX2LyVcV+ESup/5Rg77/AZlf4sNTc L42MB3QruB5w0ESy+zGba1gp+T3/scmNQDniHFrt3980BVBrffovgJOeTfOXwOXHnNyYT vEnagsHbfiSQVEkSsnd06Gc+WYQ9MPokNVrUbx1zXbrS+WZyYDniZumT58nT4XQ4AQ5VT 6uPcd7Kgy/KgvYgjZjppBmfKAIULqq/kxsOl21InL1JZS3k4ZEqFey7HR5GJ1x3usBA== 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=km7dIdiM; 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 087BA606A32C; Fri, 4 Dec 2026 11:46:50 +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=km7dIdiM Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B9AE1F000CE; Fri, 4 Dec 2026 11:46:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384809; bh=/M+jb1k5XLuvNRGBfimoNAjCg7mkdqIH4Th4cU3pfqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=km7dIdiMGL+PEbE2XoWdNejx4yibbyRGx8H6g08xgU6pcQ+z6aSf0asJoZnuM7yxh pl84lPy/jC5t0/BgVRlxncVj5Otui0PGgBWNvHRfFB2JDv9BIcykS/4C61rBBJgver 4nyE7rLQIlIGzQU0umNFtSrVLECmLPKTKvJHFCFI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Horst Birthelmer , Jingbo Xu , Miklos Szeredi , Sasha Levin Subject: [PATCH 6.6 0303/1167] fuse: dont bump attr_version for async direct read completion Date: Fri, 4 Dec 2026 18:55:30 +0900 Message-ID: <20261204100709.918106072@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jingbo Xu [ Upstream commit fc60668db85584da911e5d0a65c8698628f98bba ] The attr_version counter should only be incremented when cached attributes are actually modified (as documented in commit 1fb69e781729 ("fuse: fix race between getattr and write")). Async direct reads do not modify any cached inode attributes (size, mtime, ctime), so bumping attr_version in fuse_aio_complete() for reads is incorrect. This unconditional bump causes a livelock when auto_inval_data is enabled together with writeback_cache: fuse_cache_read_iter() issues a FUSE_GETATTR before every read, but by the time the response arrives, an async DIO read completion has already incremented fi->attr_version past the snapshot taken before the request. The GETATTR result is then discarded (attr_version race), fi->i_time is never refreshed, and every subsequent read triggers yet another GETATTR -- creating an infinite loop of useless round-trips. Fix this by only bumping attr_version for write completions, consistent with the synchronous DIO write path (fuse_write_update_attr) and the cached write path. Fixes: 01e9d11a3e79 ("fuse: add support of async IO") Reviewed-by: Horst Birthelmer Signed-off-by: Jingbo Xu Signed-off-by: Miklos Szeredi [ sashal: Changed the condition to if (res >= 0 && io->write) with adjusted context, since this tree declares inode inside the block and has no mapping local. ] Signed-off-by: Sasha Levin --- fs/fuse/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 50b25b5304f07..aa2da240e5ac7 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -724,7 +724,7 @@ static void fuse_aio_complete(struct fuse_io_priv *io, int err, ssize_t pos) if (!left && !io->blocking) { ssize_t res = fuse_get_res_by_io(io); - if (res >= 0) { + if (res >= 0 && io->write) { struct inode *inode = file_inode(io->iocb->ki_filp); struct fuse_conn *fc = get_fuse_conn(inode); struct fuse_inode *fi = get_fuse_inode(inode); -- 2.53.0