Commit 4973b04d authored by Marios Makassikis's avatar Marios Makassikis Committed by Steve French
Browse files

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: stable@vger.kernel.org
Signed-off-by: default avatarMarios Makassikis <mmakassikis@freebox.fr>
Acked-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 17cf0c27
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -754,10 +754,15 @@ int ksmbd_vfs_rename(struct ksmbd_work *work, const struct path *old_path,
		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;