From mboxrd@z Thu Jan 1 00:00:00 1970 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 3426C370AD8 for ; Mon, 5 Oct 2026 15:14:55 +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=1791213297; cv=none; b=MRjHnbiQXaqn4yopXUjfpriVEmhkGHVa9mtG0D8kdfIMFtvNX6YwxS13ek8/OTVpDbZmAuN2VOPpZDIIuEg+hdllsGEcDNujhlceN5K7z4YKrKAxsg/GbHSt2iHkXrmpqZ/uA1HZlrX1ftqXfjh4VVXq7WPu+L7/K8gTd/RFujc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791213297; c=relaxed/simple; bh=6CVwR1DjfUNUVynCqca8hMnL5wAe9m5DlmJR4DCGf+I=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=bMix9stpF8/MZXVytgZggDfRNU/RM6AF/4JoigJFZeUYengC5PHRlq8r+Jg2wGc6kp+BItdICNJCQyXl8LaHCquG/9lmqOIZjUTniDzc9kRaZbQ5DZHSijKryvT+fLs8FV4yJMkcjRiYXMmwM4bYhSh2hQ/2ZB+TBmWdUPiALDg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=gbGjepR8; 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="gbGjepR8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A0FE1F000FF; Mon, 5 Oct 2026 15:14:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791213295; bh=wOCcWjV977ckc+fFLuPfQxql4G7Hg4Ya2DhG0ajSzjY=; h=Subject:To:Cc:From:Date; b=gbGjepR85pWf+4O/Zd374JHLhiBDCSO9zmSjP7uqWja9YF9a6iHWslBNnm6czcnkc +CXvmdTw6ti5LoQen6VMgJhIkyEfVlZjsjqDybL9EMfRCPw2WErpsvn3yw58atEfeH WKHZCWf5uzUCQnWk9qIeWS8nXYFsyi9mTwpEvgak= Subject: FAILED: patch "[PATCH] smb: client: discard post-EOF pagecache when extending a file" failed to apply to 6.12-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 17:09:52 +0200 Message-ID: <2026100552-sneer-unshipped-cb2d@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.12-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.12.y git checkout FETCH_HEAD git cherry-pick -x 4721587f96cb8de8164f3fd203093a0875560999 # git commit -s git send-email --to '' --in-reply-to '2026100552-sneer-unshipped-cb2d@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 4721587f96cb8de8164f3fd203093a0875560999 Mon Sep 17 00:00:00 2001 From: Paulo Alcantara Date: Sun, 20 Sep 2026 16:38:03 -0300 Subject: [PATCH] smb: client: discard post-EOF pagecache when extending a file via clone range cifs_remap_file_range() discarded the pagecache only for the folios overlapping the destination region, so when a clone 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. Start the discard at the smaller of fstart and the old EOF. i_size is still old here, so nothing past the old EOF is flushed to the server. Fixes: c54fc3a4f375 ("cifs: Fix flushing, invalidation and file size with FICLONE") 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/cifsfs.c b/fs/smb/client/cifsfs.c index f1fb4b7b7b7c..6410249f529a 100644 --- a/fs/smb/client/cifsfs.c +++ b/fs/smb/client/cifsfs.c @@ -1467,9 +1467,14 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off, i_size = target_inode->i_size; spin_unlock(&target_inode->i_lock); - /* Discard all the folios that overlap the destination region. */ + /* + * Discard all the folios that overlap the destination region. 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. + */ cifs_dbg(FYI, "about to discard pages %llx-%llx\n", fstart, fend); - truncate_inode_pages_range(&target_inode->i_data, fstart, fend); + truncate_inode_pages_range(&target_inode->i_data, + min(fstart, i_size), fend); fscache_invalidate(cifs_inode_cookie(target_inode), NULL, i_size, 0);