From 062ec187115546beaea6eb5a21fbb93bb65fd5ba Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 5 Mar 2021 14:56:55 +0100 Subject: [PATCH] main: honor FUSE_OVERLAYFS_DISABLE_OVL_WHITEOUT also for renames Signed-off-by: Giuseppe Scrivano --- main.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index c036a89..91ea3d0 100644 --- a/main.c +++ b/main.c @@ -4532,9 +4532,17 @@ ovl_rename_direct (fuse_req_t req, fuse_ino_t parent, const char *name, /* Try to create the whiteout atomically, if it fails do the rename+mknod separately. */ - ret = direct_renameat2 (srcfd, name, destfd, - newname, flags|RENAME_WHITEOUT); - /* If the destination is a whiteout, just overwrite it. */ + if (! can_mknod) + { + ret = -1; + errno = EPERM; + } + else + { + ret = direct_renameat2 (srcfd, name, destfd, + newname, flags|RENAME_WHITEOUT); + } + /* If the destination is a whiteout, just overwrite it. */ if (ret < 0 && errno == EEXIST) ret = direct_renameat2 (srcfd, name, destfd, newname, flags & ~RENAME_NOREPLACE); if (ret < 0)