This is a note to let you know that I've just added the patch titled ksmbd: clear RENAME_NOREPLACE before calling vfs_rename to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ksmbd-clear-rename_noreplace-before-calling-vfs_rename.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 4973b04d3ea577db80c501c5f14e68ec69fe1794 Mon Sep 17 00:00:00 2001 From: Marios Makassikis <mmakassikis@xxxxxxxxxx> Date: Mon, 15 Apr 2024 15:12:48 +0200 Subject: ksmbd: clear RENAME_NOREPLACE before calling vfs_rename From: Marios Makassikis <mmakassikis@xxxxxxxxxx> commit 4973b04d3ea577db80c501c5f14e68ec69fe1794 upstream. File overwrite case is explicitly handled, so it is not necessary to pass RENAME_NOREPLACE to vfs_rename. Clearing the flag fixes rename operations when the share is a ntfs-3g mount. The latter uses an older version of fuse with no support for flags in the ->rename op. Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Marios Makassikis <mmakassikis@xxxxxxxxxx> Acked-by: Namjae Jeon <linkinjeon@xxxxxxxxxx> Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/smb/server/vfs.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/fs/smb/server/vfs.c +++ b/fs/smb/server/vfs.c @@ -746,10 +746,15 @@ retry: goto out4; } + /* + * explicitly handle file overwrite case, for compatibility with + * filesystems that may not support rename flags (e.g: fuse) + */ if ((flags & RENAME_NOREPLACE) && d_is_positive(new_dentry)) { err = -EEXIST; goto out4; } + flags &= ~(RENAME_NOREPLACE); if (old_child == trap) { err = -EINVAL; Patches currently in stable-queue which might be from mmakassikis@xxxxxxxxxx are queue-6.1/ksmbd-clear-rename_noreplace-before-calling-vfs_rename.patch