Message ID | 20240415131247.2162106-1-mmakassikis@freebox.fr (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] ksmbd: clear RENAME_NOREPLACE before calling vfs_rename | expand |
2024년 4월 15일 (월) 오후 10:13, Marios Makassikis <mmakassikis@freebox.fr>님이 작성: > > 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. > > Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr> Applied it to #ksmbd-for-next-next. Thanks for your patch!
diff --git a/fs/smb/server/vfs.c b/fs/smb/server/vfs.c index 22f0f3db3ac9..51b1b0bed616 100644 --- a/fs/smb/server/vfs.c +++ b/fs/smb/server/vfs.c @@ -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;
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. Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr> --- v2 change: fix checkpatch warning: WARNING: Block comments use a trailing */ on a separate line fs/smb/server/vfs.c | 5 +++++ 1 file changed, 5 insertions(+)