summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarios Makassikis <mmakassikis@freebox.fr>2024-04-15 16:12:48 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-27 18:13:04 +0300
commitaaf8d12ac16680c6b22de087e78fb6a30908cda3 (patch)
tree04e7d1f104ebb6366363ba0b271d561e71e93ef2
parent2c27a64a2bc47d9bfc7c3cf8be14be53b1ee7cb6 (diff)
downloadlinux-aaf8d12ac16680c6b22de087e78fb6a30908cda3.tar.xz
ksmbd: clear RENAME_NOREPLACE before calling vfs_rename
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@vger.kernel.org Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/smb/server/vfs.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/smb/server/vfs.c b/fs/smb/server/vfs.c
index 2e992fadeaa7..d7906efaa96b 100644
--- a/fs/smb/server/vfs.c
+++ b/fs/smb/server/vfs.c
@@ -754,10 +754,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;