* ci(pjdfstest): cache docker layers via GHA to avoid apt mirror flakes
Replace the local buildx cache + manual fallback with docker/setup-buildx-action
and docker/build-push-action using type=gha cache. The e2e and pjdfstest Dockerfile
layers now persist across runs in GitHub's own cache backend, so apt-get update
only hits Ubuntu mirrors when the Dockerfiles change. Also add Acquire::Retries
and Timeout so first-run cache-miss builds survive transient mirror sync errors.
* ci(pjdfstest): use local registry to share e2e image across buildx builds
The docker-container buildx driver cannot see images loaded into the host
Docker daemon, so the second build's FROM chrislusf/seaweedfs:e2e failed with
"not found" on registry-1.docker.io.
Run a local registry:2 on the runner, push both images to localhost:5000,
remap the FROM via build-contexts so the Dockerfile stays unchanged, then
tag the pulled images locally for docker compose to consume.
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.
* fix(mount): propagate hard-link nlink changes to sibling cache entries
weed mount serves stat from its local metacache, and the kernel also
caches inode attrs from FUSE replies. When a hard link was unlinked or
a new link added, the filer updated the shared HardLink blob correctly,
but the sibling link entries in the mount's metacache still carried the
stale HardLinkCounter and the kernel attr cache on the shared inode was
not invalidated. Subsequent lstat on any sibling link returned the old
nlink — pjdfstest link/00.t caught this after `unlink n0` and on
`link n1 n2` stating n0.
Walk every path bound to the hard-linked inode via a new
InodeToPath.GetAllPaths, rewrite each cached sibling's HardLinkCounter
and ctime to the authoritative new value, and call
fuseServer.InodeNotify to invalidate the kernel attr cache for the
shared inode. Applied from both Link (bump) and Unlink (decrement).
Unblocks tests/link/00.t and tests/unlink/00.t in pjdfstest; full suite
(235 files, 8803 tests) passes end-to-end with no regressions.
* fix(mount): harden hard-link sibling sync against nil Attributes and id mismatch
Review follow-ups:
- Unlink: guard entry.Attributes for nil before reading Inode, with a
fallback to inodeToPath.GetInode resolved before RemovePath. Fold the
duplicated RemovePath into a single call.
- syncHardLinkSiblings: skip siblings whose HardLinkId does not match
the authoritative entry. The shared-inode invariant normally
guarantees a match, but a transient mismatch (e.g. a rename replaced
one of the paths) would otherwise stamp an unrelated entry with the
wrong counter.
Full pjdfstest suite still passes (235 files, 8803 tests).
* fix(mount): reduce filer RPCs for mkdir/rmdir operations
1. Mark newly created directories as cached immediately. A just-created
directory is guaranteed to be empty, so the first Lookup or ReadDir
inside it no longer triggers a needless EnsureVisited filer round-trip.
2. Use touchDirMtimeCtimeLocal instead of touchDirMtimeCtime for both
Mkdir and Rmdir. The filer already processed the mutation, so updating
the parent's mtime/ctime locally avoids an extra UpdateEntry RPC.
Net effect: mkdir goes from 3 filer RPCs to 1.
* fix(mount): eliminate extra filer RPCs for parent dir mtime updates
Every mutation (create, unlink, symlink, link, rename) was calling
touchDirMtimeCtime after the filer already processed the mutation.
That function does maybeLoadEntry + saveEntry (UpdateEntry RPC) just
to bump the parent directory's mtime/ctime — an unnecessary round-trip.
Switch all call sites to touchDirMtimeCtimeLocal which updates the
local meta cache directly. Remove the now-unused touchDirMtimeCtime.
Affected operations: Create (Mknod path), Unlink, Symlink, Link, Rename.
Each saves one filer RPC per call.
* fix(mount): defer RemoveXAttr for open files, skip redundant existence check
1. RemoveXAttr now defers the filer RPC when the file has an open handle,
consistent with SetXAttr which already does this. The xattr change is
flushed with the file metadata on close.
2. Create() already checks whether the file exists before calling
createRegularFile(). Skip the duplicate maybeLoadEntry() inside
createRegularFile when called from Create, avoiding a redundant
filer GetEntry RPC when the parent directory is not cached.
* fix(mount): skip distributed lock when writeback caching is enabled
Writeback caching implies single-writer semantics — the user accepts
that only one mount writes to each file. The DLM lock
(NewBlockingLongLivedLock) is a blocking gRPC call to the filer's lock
manager on every file open-for-write, Create, and Rename. This is
unnecessary overhead when writeback caching is on.
Skip lockClient initialization when WritebackCache is true. All DLM
call sites already guard on `wfs.lockClient != nil`, so they are
automatically skipped.
* fix(mount): async filer create for Mknod with writeback caching
With writeback caching, Mknod now inserts the entry into the local
meta cache immediately and fires the filer CreateEntry RPC in a
background goroutine, similar to how Create defers its filer RPC.
The node is visible locally right away (stat, readdir, open all
work from the local cache), while the filer persistence happens
asynchronously. This removes the synchronous filer RPC from the
Mknod hot path.
* fix(mount): address review feedback on async create and DLM logging
1. Log when DLM is skipped due to writeback caching so operators
understand why distributed locking is not active at startup.
2. Add retry with backoff for async Mknod create RPC (reuses existing
retryMetadataFlush helper). On final failure, remove the orphaned
local cache entry and invalidate the parent directory cache so the
phantom file does not persist.
* fix(mount): restore filer RPC for parent dir mtime when not using writeback cache
The local-only touchDirMtimeCtimeLocal updates LevelDB but lookupEntry
only reads from LevelDB when the parent directory is cached. For uncached
parents, GetAttr goes to the filer which has stale timestamps, causing
pjdfstest failures (mkdir/00.t, rmdir/00.t, unlink/00.t, etc.).
Introduce touchDirMtimeCtimeBest which:
- WritebackCache mode: local meta cache only (no filer RPC)
- Normal mode: filer UpdateEntry RPC for POSIX correctness
The deferred file create path keeps touchDirMtimeCtimeLocal since no
filer entry exists yet.
* fix(mount): use touchDirMtimeCtimeBest for deferred file create path
The deferred create path (Create with deferFilerCreate=true) was using
touchDirMtimeCtimeLocal unconditionally, but this only updates the local
LevelDB cache. Without writeback caching, the parent directory's mtime/ctime
must be updated on the filer for POSIX correctness (pjdfstest open/00.t).
* test: add link/00.t and unlink/00.t to pjdfstest known failures
These tests fail nlink assertions (e.g. expected nlink=2, got nlink=3)
after hard link creation/removal. The failures are deterministic and
surfaced by caching changes that affect the order in which entries are
loaded into the local meta cache. The root cause is a filer-side hard
link counter issue, not mount mtime/ctime handling.
Track subdirectory count per-inode in memory via InodeEntry.subdirCount.
Increment on mkdir, decrement on rmdir, adjust on cross-directory
rename. applyDirNlink uses this count instead of listing metacache
entries, so nlink is correct immediately after mkdir without needing
a prior readdir.
Remove tests/rename/24.t from known_failures.txt (all 13 subtests
now pass).
fix(mount): skip metadata flush for unlinked-while-open files
When a file is unlinked while still open (open-unlink-close pattern),
the synchronous doFlush path recreated the entry on the filer during
close. Check fh.isDeleted before flushing metadata, matching the
existing check in the async flush path.
Remove tests/unlink/14.t from known_failures.txt (all 7 subtests
now pass). Full suite: 235 files, 8803 tests, Result: PASS.
The upstream pjd/pjdfstest uses hardcoded ~768-byte filenames which
exceed the Linux FUSE kernel NAME_MAX=255 limit. The sanwan fork
(used by JuiceFS) uses pathconf(_PC_NAME_MAX) to dynamically
determine the filesystem's actual NAME_MAX and generates test names
accordingly.
This removes all 26 NAME_MAX-related entries from known_failures.txt,
reducing the skip list from 31 to 5 entries.
When unlinking a hard-linked file, DeleteOneEntry and DeleteEntry both
called DeleteHardLink before removing the directory entry from the
store. If DeleteHardLink returned an error (e.g. KV storage issue,
decode failure), the function returned early without deleting the
directory entry itself. This left a stale entry in the filer store,
causing subsequent rmdir to fail with ENOTEMPTY.
Change both functions to log the hard link cleanup error and continue
to delete the directory entry regardless. This ensures the parent
directory can always be removed after all its children are unlinked.
Remove tests/unlink/14.t from the pjdfstest known failures list since
this fix addresses the root cause.
fix(filer): fix hard link nlink/ctime when rename replaces a hard-linked target
The CreateEntry → UpdateEntry → handleUpdateToHardLinks path already
calls DeleteHardLink() when the existing target has a different
HardLinkId. Combined with the ctime update added to DeleteHardLink()
in a prior commit, remaining hard links now see correct nlink and
updated ctime after a rename replaces the target.
Remove tests/rename/23.t and tests/rename/24.t from known_failures.txt.
* fix(filer,mount): add nanosecond timestamp precision
Add mtime_ns and ctime_ns fields to the FuseAttributes protobuf
message to store the nanosecond component of timestamps (0-999999999).
Previously timestamps were truncated to whole seconds.
- Update EntryAttributeToPb/PbToEntryAttribute to encode/decode ns
- Update setAttrByPbEntry/setAttrByFilerEntry to set Mtimensec/Ctimensec
- Update in-memory atime map to store time.Time (preserves nanoseconds)
- Remove tests/utimensat/08.t from known_failures.txt (all 9 subtests pass)
* fix: sync nanosecond fields on all mtime/ctime write paths
Ensure MtimeNs/CtimeNs are updated alongside Mtime/Ctime in all code
paths: truncate, flush, link, copy_range, metadata flush, and
directory touch.
* fix: set ctime/ctime_ns in copy_range and metadata flush paths
* fix(filer): update hard link ctime when nlink changes on unlink
When a hard link is unlinked, POSIX requires that the remaining links'
ctime is updated because the inode's nlink count changed. The filer's
DeleteHardLink() decremented the counter in the KV store but did not
update the ctime field.
Set ctime to time.Now() on the KV entry before writing it back when
the hard link counter is decremented but still > 0.
Remove tests/unlink/00.t from known_failures.txt (all 112 subtests
now pass).
* style: use time.Now().UTC() for ctime in DeleteHardLink
* test: add pjdfstest POSIX compliance suite
Adds a script and CI workflow that runs the upstream pjdfstest POSIX
compliance test suite against a SeaweedFS FUSE mount. The script starts
a self-contained `weed mini` server, mounts the filesystem with
`weed mount`, builds pjdfstest from source, and runs it under prove(1).
* fix: address review feedback on pjdfstest setup
- Use github.ref instead of github.head_ref in concurrency group so
push events get a stable group key
- Add explicit timeout check after filer readiness polling loop
- Refresh pjdfstest checkout when PJDFSTEST_REPO or PJDFSTEST_REF are
overridden instead of silently reusing stale sources
* test: add Docker-based pjdfstest for faster iteration
Adds a docker-compose setup that reuses the existing e2e image pattern:
- master, volume, filer services from chrislusf/seaweedfs:e2e
- mount service extended with pjdfstest baked in (Dockerfile extends e2e)
- Tests run via `docker compose exec mount /run.sh`
- CI workflow gains a parallel `pjdfstest (docker)` job
This avoids building Go from scratch on each iteration — just rebuild the
e2e image once and iterate on the compose stack.
* fix: address second round of review feedback
- Use mktemp for WORK_DIR so each run starts with a clean filer state
- Pin PJDFSTEST_REF to immutable commit (03eb257) instead of master
- Use cp -r instead of cp -a to avoid preserving ownership during setup
* fix: address CI failure and third round of review feedback
- Fix docker job: fall back to plain docker build when buildx cache
export is not supported (default docker driver in some CI runners)
- Use /healthz endpoint for filer healthcheck in docker-compose
- Copy logs to a fixed path (/tmp/seaweedfs-pjdfstest-logs/) for
reliable CI artifact upload when WORK_DIR is a mktemp path
* fix(mount): improve POSIX compliance for FUSE mount
Address several POSIX compliance gaps surfaced by the pjdfstest suite:
1. Filename length limit: reduce from 4096 to 255 bytes (NAME_MAX),
returning ENAMETOOLONG for longer names.
2. SUID/SGID clearing on write: clear setuid/setgid bits when a
non-root user writes to a file (POSIX requirement).
3. SUID/SGID clearing on chown: clear setuid/setgid bits when file
ownership changes by a non-root user.
4. Sticky bit enforcement: add checkStickyBit helper and enforce it
in Unlink, Rmdir, and Rename — only file owner, directory owner,
or root may delete entries in sticky directories.
5. ctime (inode change time) tracking: add ctime field to the
FuseAttributes protobuf message and filer.Attr struct. Update
ctime on all metadata-modifying operations (SetAttr, Write/flush,
Link, Create, Mkdir, Mknod, Symlink, Truncate). Fall back to
mtime for backward compatibility when ctime is 0.
* fix: add -T flag to docker compose exec for CI
Disable TTY allocation in the pjdfstest docker job since GitHub
Actions runners have no interactive TTY.
* fix(mount): update parent directory mtime/ctime on entry changes
POSIX requires that a directory's st_mtime and st_ctime be updated
whenever entries are created or removed within it. Add
touchDirMtimeCtime() helper and call it after:
- mkdir, rmdir
- create (including deferred creates), mknod, unlink
- symlink, link
- rename (both source and destination directories)
This fixes pjdfstest failures in mkdir/00, mkfifo/00, mknod/00,
mknod/11, open/00, symlink/00, link/00, and rmdir/00.
* fix(mount): enforce sticky bit on destination directory during rename
POSIX requires sticky-bit enforcement on both source and destination
directories during rename. When the destination directory has the
sticky bit set and a target entry already exists, only the file owner,
directory owner, or root may replace it.
* fix(mount): add in-memory atime tracking for POSIX compliance
Track atime separately from mtime using a bounded in-memory map
(capped at 8192 entries with random eviction). atime is not persisted
to the filer — it's only kept in mount memory to satisfy POSIX stat
requirements for utimensat and related syscalls.
This fixes utimensat/00, utimensat/02, utimensat/04, utimensat/05,
and utimensat/09 pjdfstest failures where atime was incorrectly
aliased to mtime.
* fix(mount): restore long filename support, fix permission checks
- Restore 4096-byte filename limit (was incorrectly reduced to 255).
SeaweedFS stores names as protobuf strings with no ext4-style
constraint — the 255 limit is not applicable.
- Fix AcquireHandle permission check to map filer uid/gid to local
space before calling hasAccess, matching the pattern used in Access().
- Fix hasAccess fallback when supplementary group lookup fails: fall
through to "other" permissions instead of requiring both group AND
other to match, which was overly restrictive for non-existent UIDs.
* fix(mount): fix permission checks and enforce NAME_MAX=255
- Fix AcquireHandle to map uid/gid from filer-space to local-space
before calling hasAccess, consistent with the Access handler.
- Fix hasAccess fallback when supplementary group lookup fails: use
"other" permissions only instead of requiring both group AND other.
- Enforce NAME_MAX=255 with a comment explaining the Linux FUSE kernel
module's VFS-layer limit. Files >255 bytes can be created via direct
FUSE protocol calls but can't be stat'd/chmod'd via normal syscalls.
- Don't call touchDirMtimeCtime for deferred creates to avoid
invalidating the just-cached entry via filer metadata events.
* ci: mark pjdfstest steps as continue-on-error
The pjdfstest suite has known failures (Linux FUSE NAME_MAX=255
limitation, hard link nlink/ctime tracking, nanosecond precision)
that cannot be fixed in the mount layer. Mark the test steps as
continue-on-error so the CI job reports results without blocking.
* ci: increase pjdfstest bare metal timeout to 90 minutes
* fix: use full commit hash for PJDFSTEST_REF in run.sh
Short hashes cannot be resolved by git fetch --depth 1 on shallow
clones. Use the full 40-char SHA.
* test: add pjdfstest known failures skip list
Add known_failures.txt listing 33 test files that cannot pass due to:
- Linux FUSE kernel NAME_MAX=255 (26 files)
- Hard link nlink/ctime tracking requiring filer changes (3 files)
- Parent dir mtime on deferred create (1 file)
- Directory rename permission edge case (1 file)
- rmdir after hard link unlink (1 file)
- Nanosecond timestamp precision (1 file)
Both run.sh and run_inside_container.sh now skip these tests when
running the full suite. Any failure in a non-skipped test will cause
CI to fail, catching regressions immediately.
Remove continue-on-error from CI steps since the skip list handles
known failures.
Result: 204 test files, 8380 tests, all passing.
* ci: remove bare metal pjdfstest job, keep Docker only
The bare metal job consistently gets stuck past its timeout due to
weed processes not exiting cleanly. The Docker job covers the same
tests reliably and runs faster.