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=1796387458; b=GbEoITgIU1rq/N1MN7GUXfqafMSGtaDulyGrCU+6mqmItE9qwLGikkhVcSnTyxol02Y4 ukoh7HIZ5yn/Vrg/9mfa+mfERSpHID8pebrhskxKBsH6duSVuT18K7kNkI68jbZBy9KR4 n7jul4layGqy7gS1aNM6/9cBSw609zeC5w5d98xsvUrDUQqJZATb0TSVt4sTkNQq22Pjt 3o2RdICvpIfOvXTNisxzzcJRic75H6CNfiOrDl3KgUj9C0AEUQtMW6UozyczETdJO5/uC 7seGePrg30QCe5gQwhfZrUyAx5ey71+Q2y8GTFvxD7mfdIKmyoq2UrBfin1T17FvUjQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387458; 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=UHwORJsw682ruXX13sGnSNoH2+nXeGICZ5Pe+qUUxxU=; b=liPHkp2DvdgPokwKDY+CcAHmDVYc+4HIqE1GRye3/2zv2L/PzOx624gfcrKpsVmNS08N RZG+AXvJVmwCkzSXi1B20LoZ8hiRKF+nLzrNo/B6aGohJVw8q2nW2SKMIcNo+71wrilih JW5Jt7JjptGodp2ieMiVCGFUlhTAZFDIf4le6USkeY4p/+VpsQzHqOGBIur2du1nCIymv bclcFBjtHh7qN2I/up1sTdDjKRxjh7iSzfQXwuRabZL5cLkwk3Lc54fgpZpSoa2+To1CI eVpUa5V3pb7KIL9/AM4b8FJefvuwDI2aUlwPgHaXFG3HfV2FTQ2aBDS1lRigjFeRvsg== 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=y4jx1WKQ; 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 D5BCB606A322; Fri, 4 Dec 2026 12:30:58 +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=y4jx1WKQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D2D31F000C2; Fri, 4 Dec 2026 12:30:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387458; bh=UHwORJsw682ruXX13sGnSNoH2+nXeGICZ5Pe+qUUxxU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=y4jx1WKQ4Vdm8Qc43yByblsZvriSs4va7bobulfjXuEn8LnxiiucH9fejup9RBUpj kGBAzdp0eL0P0Oq7NOgyYOMFlZCo7ELzd5VZYlM13unD+cvjdiAJB3NKoKQLhpqc9a zll6iA75zDllRXBSuw15bGPeahh/xZ32dSpgBv8M= 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.1 0252/1059] fuse: dont bump attr_version for async direct read completion Date: Fri, 4 Dec 2026 18:56:23 +0900 Message-ID: <20261204100650.798916162@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: 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.1-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: Adjusted hunk context because this tree uses a local inode variable in fuse_aio_complete() where upstream uses mapping; the one-line io->write condition is unchanged. ] 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 8290db2b4f13b..5d632a41ed496 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -719,7 +719,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