aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend/node.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/fusefrontend/node.go')
-rw-r--r--internal/fusefrontend/node.go23
1 files changed, 11 insertions, 12 deletions
diff --git a/internal/fusefrontend/node.go b/internal/fusefrontend/node.go
index ead77c9..688cc0d 100644
--- a/internal/fusefrontend/node.go
+++ b/internal/fusefrontend/node.go
@@ -391,23 +391,17 @@ func (n *Node) Symlink(ctx context.Context, target, name string, out *fuse.Entry
return inode, 0
}
-// xfstests generic/013 now also exercises RENAME_EXCHANGE and RENAME_WHITEOUT,
-// uncovering lots of problems with longnames
-//
-// Reject those flags with syscall.EINVAL.
// If we can handle the flags, this function returns 0.
func rejectRenameFlags(flags uint32) syscall.Errno {
- // Normal rename, we can handle that
- if flags == 0 {
+ switch flags {
+ case 0, syscallcompat.RENAME_NOREPLACE, syscallcompat.RENAME_EXCHANGE, syscallcompat.RENAME_WHITEOUT:
return 0
- }
- // We also can handle RENAME_NOREPLACE
- if flags == syscallcompat.RENAME_NOREPLACE {
+ case syscallcompat.RENAME_NOREPLACE | syscallcompat.RENAME_WHITEOUT:
return 0
+ default:
+ tlog.Warn.Printf("rejectRenameFlags: unknown flag combination 0x%x", flags)
+ return syscall.EINVAL
}
- // We cannot handle RENAME_EXCHANGE and RENAME_WHITEOUT yet.
- // Needs extra code for .name files.
- return syscall.EINVAL
}
// Rename - FUSE call.
@@ -472,6 +466,11 @@ func (n *Node) Rename(ctx context.Context, name string, newParent fs.InodeEmbedd
}
return fs.ToErrno(err)
}
+ if flags&syscallcompat.RENAME_EXCHANGE != 0 || flags&syscallcompat.RENAME_WHITEOUT != 0 {
+ // These flags mean that there is now a new file at cName and we
+ // should NOT delete its longname file.
+ return 0
+ }
if nametransform.IsLongContent(cName) {
nametransform.DeleteLongNameAt(dirfd, cName)
}