Skip to content

Commit 4973b04

Browse files
Marios Makassikissmfrench
authored andcommitted
ksmbd: clear RENAME_NOREPLACE before calling vfs_rename
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: [email protected] Signed-off-by: Marios Makassikis <[email protected]> Acked-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 17cf0c2 commit 4973b04

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/smb/server/vfs.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,10 +754,15 @@ int ksmbd_vfs_rename(struct ksmbd_work *work, const struct path *old_path,
754754
goto out4;
755755
}
756756

757+
/*
758+
* explicitly handle file overwrite case, for compatibility with
759+
* filesystems that may not support rename flags (e.g: fuse)
760+
*/
757761
if ((flags & RENAME_NOREPLACE) && d_is_positive(new_dentry)) {
758762
err = -EEXIST;
759763
goto out4;
760764
}
765+
flags &= ~(RENAME_NOREPLACE);
761766

762767
if (old_child == trap) {
763768
err = -EINVAL;

0 commit comments

Comments
 (0)