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 C27454A387B for ; Mon, 5 Oct 2026 14:47:24 +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=1791211646; cv=none; b=A+BFsBl1ijejLMgT9kx1Ug69DOm1x59sBm61xSVRIU4qcaHuZY4sU90SZPMryl0qvmy9n2vyeUZHTxb7VSW8kUXtWcJEHV0Ogw7EOCvQTkN9eGhtL2+yw+MFf/gz3+qOxtrTzFRTn6Qb1rgMqrqGBdT+OEZAnSrudi/ou7c7PQA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791211646; c=relaxed/simple; bh=G08MbS6FISeGwoL3IvV75Y1SKQcuHt500gC+2xaLy2Q=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=crhe2PLJxU+uK4UaABkmwurHpnNgSwNewnTF9KUUIpNmP/THSUF9TydHzXEakg0snTxCt7wvoSpICYRNNG9L7lFF/SAlkskn1IJySuMnWrwbbwyrDm/zEoR4i7r1kV2jZ4Qtk5RFtquWU4y+6oqKH+iusIKXZyb0oIclCjhBRgQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=E3OZteZE; 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="E3OZteZE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 912EA1F00899; Mon, 5 Oct 2026 14:47:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791211643; bh=gz1gcssEp7mo/cWcFnUIkMwvLzgJnRLoQjjJSA0hk+w=; h=Subject:To:Cc:From:Date; b=E3OZteZEM90aUIkX3y066UEANNvqzoudUoHSMln2mhYrziGUa9uCGbEw6JJB6uSFE QX1iJ4n7iA5E3hIiS9K12D0jguByuB1uOjLcdQTx47wNN+nQcVbzEArlaj9WuFGdHg kXXN8gJRJLHFHY6gBLufG3F9Q4xMYPHow4zAsBYg= Subject: FAILED: patch "[PATCH] smb: client: flush dirty data before zeroing a range" 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 16:47:12 +0200 Message-ID: <2026100512-glandular-majority-a82a@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 8f8d32c1044f70e46e87550e039a15ff20a4b21c # git commit -s git send-email --to '' --in-reply-to '2026100512-glandular-majority-a82a@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 8f8d32c1044f70e46e87550e039a15ff20a4b21c Mon Sep 17 00:00:00 2001 From: Paulo Alcantara Date: Sat, 26 Sep 2026 12:59:18 -0300 Subject: [PATCH] smb: client: flush dirty data before zeroing a range smb3_zero_range() emulates FALLOC_FL_ZERO_RANGE by invalidating the page cache over the target range with truncate_pagecache_range() and then issuing FSCTL_SET_ZERO_DATA to the server. Dirty data was only flushed conditionally, when the range reached or extended EOF. For a purely interior zero range that does not reach EOF, no flush happened, so a dirty folio overlapping the range could be written back to the server after the FSCTL and refill the range that was just zeroed with stale data. Fix this by unconditionally flushing and waiting for dirty data in the range before invalidating the page cache and issuing FSCTL_SET_ZERO_DATA, exactly as was done for smb3_punch_hole() in commit d7d2adcd022b ("smb/client: flush dirty data before punching a hole"); the two paths are structurally identical here. This is observed as generic/363 randomly reading stale data where a zeroed range is expected against Windows Server. Fixes: 91d1dfae4649 ("cifs: Fix FALLOC_FL_ZERO_RANGE to preflush buffered part of target region") 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 1c41d3b24c6d..a0fcb564e7a3 100644 --- a/fs/smb/client/smb2ops.c +++ b/fs/smb/client/smb2ops.c @@ -3549,13 +3549,11 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon, filemap_invalidate_lock(inode->i_mapping); netfs_read_sizes(inode, &i_size, &remote_i_size, &zero_point); - if (offset + len >= remote_i_size && offset < i_size) { - unsigned long long top = umin(offset + len, i_size); - rc = filemap_write_and_wait_range(inode->i_mapping, offset, top - 1); - if (rc < 0) - goto zero_range_exit; - } + rc = filemap_write_and_wait_range(inode->i_mapping, offset, + offset + len - 1); + if (rc < 0) + goto zero_range_exit; /* * We zero the range through ioctl, so we need remove the page caches