All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marios Makassikis <mmakassikis@freebox.fr>
To: linkinjeon@kernel.org
Cc: linux-cifs@vger.kernel.org, mmakassikis@freebox.fr
Subject: [PATCH v2] ksmbd: clear RENAME_NOREPLACE before calling vfs_rename
Date: Mon, 15 Apr 2024 15:12:48 +0200	[thread overview]
Message-ID: <20240415131247.2162106-1-mmakassikis@freebox.fr> (raw)
In-Reply-To: <CAKYAXd_8b00geiawuUQ3F4htQvucjH7KGpbOFV1Js7Pwf-JQig@mail.gmail.com>

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(+)

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;
-- 
2.34.1


  reply	other threads:[~2024-04-15 13:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-13 13:07 [PATCH] ksmbd: clear RENAME_NOREPLACE before calling vfs_rename Marios Makassikis
2024-04-15  9:00 ` Marios Makassikis
2024-04-15 10:51   ` Namjae Jeon
2024-04-15 12:36     ` Marios Makassikis
2024-04-15 12:55       ` Namjae Jeon
2024-04-15 13:12         ` Marios Makassikis [this message]
2024-04-16 12:40           ` [PATCH v2] " Namjae Jeon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240415131247.2162106-1-mmakassikis@freebox.fr \
    --to=mmakassikis@freebox.fr \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.