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=1796382379; b=tK692F2alaq8MXuBY8lCNxhGqarI9xHZ+9oKBn/pCJowgCURbDpIKKCMXDEhus4+R/GW 6eQB39W9Iio1ZZ+d0K2BconAR56F63SNYByj2K9UVdqFeBNF0sK34gbYwa3yqFKiLZCGA qcD0+x7KP8AlQ4sH2Tezg0E432zq16ZwXiDyXcpIq7nOOdEdZHk8ZylfxQ9peyAd5iUVP wvZI9uyuRrzYgqelbrdIWcPqoIeuowtfuzJ8RyZK9uU9qMegS2COr7vT+3zB2eQwDGRqL CZkrAPZYRMjH+x8R+uYzg1fqpfEBx/WvHc/BjKNERoeWIeBLMSjs2cTdtvWQMdoJ+Vg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382379; 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=LlrwNGmUr1npuKLUqtfmJCFuKtPVaGZe4Lr6iBKKBSQ=; b=ro/2fEv5iTJ/EehOKkuI/SmPRpukzpQNp+CvA38/miNhzrKdPPhvzc0EjSqwQh33JeKR dXmY8HznDZ4Pur47SItf7Kt+5Voo0j7n6hn1BrtA6+8FRkvPAyROLZdFIzuwtlvl7THtF 5k5wZHwesU0jFFG6wYdB+Vkos0+tiEGeHcXUV/52QuzPv24fDjX7FSFuonnCwv1jEzbdT C6OZVgoS2tpbO4OoTMhE20z25HY0EGnrKk3QqkpLNqykxSZgdg4fvJqXJkR9SzTHsg655 endiUKyJUxWTGg/VPxNAiajWavDCW1pvxI2DIjZbZczx7dCKGKC7+7KNZ5ElHdOHGlw== 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=GqyiNizb; 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 87869606A32F; Fri, 4 Dec 2026 11:06:19 +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=GqyiNizb Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04ABF1F000CE; Fri, 4 Dec 2026 11:06:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382379; bh=LlrwNGmUr1npuKLUqtfmJCFuKtPVaGZe4Lr6iBKKBSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GqyiNizbWPkHFhFefJP3SSp35LY18xJPr2p5fx6aahujbL+FBpv+yByPdpF1Y1bro c1Q/7nurd4zNbXI5TGT0uCBBH2cpujEp4orUezCdj5zj/vhIXF7qhAjew6NDn1dPoY cxgZz3QNroEYMLUFJBetdrwTZjlEwMimC0SethB4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hungyu Lin , Miklos Szeredi Subject: [PATCH 6.18 428/703] fuse: clear the old EOF tail before writeback-cache writes Date: Fri, 4 Dec 2026 19:05:27 +0900 Message-ID: <20261204100639.206760964@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hungyu Lin commit d9013d15b9379b323f1bcdfff7e7d96df537268a upstream. Buffered writeback-cache writes go through iomap_file_buffered_write(), but do not clear cached data between the old EOF and the write position. If a shared mapping dirtied the tail of the old EOF page, an extending write can expose those bytes as file contents instead of zeros. A later writeback can also send them to the server. Clear the gap under the existing inode lock before the buffered write. Use the same page-cache cleanup as fuse_perform_write() does for write-through writes, leaving the write range itself untouched. Fixes: 4d99ff8f12eb ("fuse: Turn writeback cache on") Cc: stable@vger.kernel.org Signed-off-by: Hungyu Lin Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman --- fs/fuse/file.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -1482,6 +1482,11 @@ static ssize_t fuse_cache_write_iter(str written = direct_write_fallback(iocb, from, written, fuse_perform_write(iocb, from)); } else if (writeback) { + loff_t old_size = i_size_read(inode); + + if (iocb->ki_pos > old_size) + truncate_pagecache_range(inode, old_size, iocb->ki_pos - 1); + /* * Use iomap so that we can do granular uptodate reads * and granular dirty tracking for large folios.