From 64af80c78d2d61a4c04cf7b416f31f66a47b1c6f Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 13 Apr 2026 19:34:30 -0700 Subject: [PATCH] fix(mount): stop double-applying umask in Mkdir (#9063) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mkdir was masking in.Mode with wfs.option.Umask on top of the kernel's VFS umask pass, so a caller with umask=0 who requested mkdir(0777) got 0755 (0777 & ~022). Create and Symlink don't apply this second pass — Mkdir was the odd one out. The resulting dirs had fewer write bits than the caller asked for, which broke cross-user rename permission checks (kernel may_delete rejects with EACCES when the parent lacks o+w even though the caller explicitly requested it) and blocked pjdfstest tests/rename/21.t and its cascading checks. Drop the extra umask so Mkdir trusts in.Mode exactly like Create. The CLI -umask flag still covers the internal cache dirs that the mount creates for itself via os.MkdirAll; only the user-facing Mkdir path changes. Unblocks tests/rename/21.t — full pjdfstest suite is now 236 files / 8819 tests, all PASS, and known_failures.txt is empty. --- test/pjdfstest/known_failures.txt | 5 ----- weed/mount/weedfs_dir_mkrm.go | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/test/pjdfstest/known_failures.txt b/test/pjdfstest/known_failures.txt index 1476890b3..d08b5a26b 100644 --- a/test/pjdfstest/known_failures.txt +++ b/test/pjdfstest/known_failures.txt @@ -6,8 +6,3 @@ # A failure in any test NOT listed here will cause the CI job to fail, # catching regressions immediately. -# ── Directory rename permission edge case ────────────────────────────── -# Cross-directory rename of a subdirectory with restricted permissions -# causes cascading test failures within the test file. -tests/rename/21.t - diff --git a/weed/mount/weedfs_dir_mkrm.go b/weed/mount/weedfs_dir_mkrm.go index f109281d7..8352b72f6 100644 --- a/weed/mount/weedfs_dir_mkrm.go +++ b/weed/mount/weedfs_dir_mkrm.go @@ -38,7 +38,7 @@ func (wfs *WFS) Mkdir(cancel <-chan struct{}, in *fuse.MkdirIn, name string, out Mtime: now, Crtime: now, Ctime: now, - FileMode: uint32(os.ModeDir) | in.Mode&^uint32(wfs.option.Umask), + FileMode: uint32(os.ModeDir) | in.Mode, Uid: in.Uid, Gid: in.Gid, },