Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC8254AA3F4 for ; Mon, 5 Oct 2026 14:44:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791211496; cv=none; b=IH7GWTdrKonZTALImnSnJnZyKTHkmQsigX0D0Nq+Fpqy5StblrpXEXo9QGm3fU7C3cT2/DoGwPqLXp8j5uZo4PjYc5uw2gjPIWmwx73SWAHamawy/DnVbyStNuPvTdQ4DDr8XP77JT3dAdPdTTjCiA6CnKZtcHVy0JjqXlaTz8Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791211496; c=relaxed/simple; bh=LZYT72qasvDgOBDvIGIq4QZAR/MXHyooL49S5e7Fju0=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=CVBtaTYTOpN4H7IAHjfEWefSHScuX5YZH2P2nqGZQF/xDjOu8dIqPpck0qFV6/GAa4vKnoiR45aPe+ADJexX60JAA6ziABB/VEvgNfzz54Ort458iwbZrqQOvykY911yvf5bPAykZj/gwat6tM8ou6zMP7t5mM/+RNE0DZQLipY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=E9ENo1db; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="E9ENo1db" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0454A1F000FF; Mon, 5 Oct 2026 14:44:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791211486; bh=ekRjO0Sm1KQxSg1/sp8DvZbwk5LLjV+cqE0UulryQM0=; h=Subject:To:Cc:From:Date; b=E9ENo1dbyquG64y+ntemAPB0xsRZQsV/rXtA85rMj+yAskn1ypmx0XsAwHLEcbER1 1rQBCVd2q6zhmFQVD4Mn1SOhY/RROvP4utMbpAVMxquImPQ/JfXq1BkUfP+faEIjcN 2jIY2J2GwwnDd635VOlcsH3QyldP40Rf5mrm1300= Subject: FAILED: patch "[PATCH] smb: client: discard post-EOF pagecache when extending a file" failed to apply to 6.1-stable tree To: pc@manguebit.org,bharathsm@microsoft.com,brauner@kernel.org,dhowells@redhat.com,linkinjeon@kernel.org,ronniesahlberg@gmail.com,sprasad@microsoft.com,tom@talpey.com,willy@infradead.org Cc: From: Date: Mon, 05 Oct 2026 16:44:30 +0200 Message-ID: <2026100530-arousal-gigahertz-46ff@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y git checkout FETCH_HEAD git cherry-pick -x da4fe97fb6c730d9c94a115c7bfa6f98e0d578d0 # git commit -s git send-email --to '' --in-reply-to '2026100530-arousal-gigahertz-46ff@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ From da4fe97fb6c730d9c94a115c7bfa6f98e0d578d0 Mon Sep 17 00:00:00 2001 From: Paulo Alcantara Date: Sun, 20 Sep 2026 16:09:30 -0300 Subject: [PATCH] smb: client: discard post-EOF pagecache when extending a file via zero range smb3_zero_range() removed the pagecache only for the range being zeroed, so when it extends the file the folio straddling the old EOF - which may hold data dirtied past EOF through an mmap - was never dropped and became visible as file content once the file was extended. Lower the discard boundary to the smaller of the zero-range offset and the old EOF. Fixes: 72c419d9b073 ("cifs: fix smb3_zero_range so it can expand the file-size when required") Reviewed-by: David Howells Reviewed-by: Namjae Jeon Signed-off-by: Paulo Alcantara Cc: Christian Brauner Cc: Matthew Wilcox Cc: Ronnie Sahlberg Cc: Shyam Prasad N Cc: Tom Talpey Cc: Bharath SM Cc: stable@vger.kernel.org diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c index 1ada1c0a728d..849cfd2de705 100644 --- a/fs/smb/client/smb2ops.c +++ b/fs/smb/client/smb2ops.c @@ -3560,8 +3560,11 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon, /* * We zero the range through ioctl, so we need remove the page caches * first, otherwise the data may be inconsistent with the server. + * + * Start at the old EOF when extending so the folio straddling it, which + * may hold data written past EOF through an mmap, is dropped too. */ - truncate_pagecache_range(inode, offset, offset + len - 1); + truncate_pagecache_range(inode, min(offset, i_size), offset + len - 1); netfs_wait_for_outstanding_io(inode); /* if file not oplocked can't be sure whether asking to extend size */