FAILED: patch "[PATCH] smb: client: drain outstanding I/O before truncating on" failed to apply to 7.2-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 7.2-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 <[email protected]>.
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-7.2.y
git checkout FETCH_HEAD
git cherry-pick -x 3581f843defa0bb30fd7da1e7dba170465e13a95
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026100630-smoked-amusing-608a@gregkh' --subject-prefix 'PATCH 7.2.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 3581f843defa0bb30fd7da1e7dba170465e13a95 Mon Sep 17 00:00:00 2001
From: Paulo Alcantara <[email protected]>
Date: Fri, 25 Sep 2026 20:16:09 -0300
Subject: [PATCH] smb: client: drain outstanding I/O before truncating on
O_TRUNC open
cifs_do_truncate() flushes the pagecache with filemap_write_and_wait() before resetting the file size to zero, but that does not wait for direct/async I/O that was already in flight, which can complete after the truncate and reinstate stale data past the new EOF.
Drain outstanding netfs I/O with netfs_wait_for_outstanding_io() before resizing the file.
fs/smb/client/file.c +2 -0
@@ -1012,6 +1012,8 @@ static int cifs_do_truncate(const unsigned int xid, struct dentry *dentry) }mapping_set_error (inode->i_mapping, rc); +netfs_wait_for_outstanding_io (inode); + cfile =find_writable_file (cinode,FIND_FSUID_ONLY ); rc =cifs_file_flush (xid, inode, cfile);if (!rc) {