Repository navigation
Description
Summary
Implement Unlink and Rmdir so rm and rmdir work on a mount. Both are currently absent
from internal/fuse/filesystem.go, so the operations fail at the kernel boundary.
Background
DirectoryNode implements only Lookup, Readdir, Mkdir, and Create. Without Unlink
the mount is effectively append-only: files can be created but never removed.
The backend primitives already exist — Backend.DeleteObject and Backend.ListObjects — and
Mkdir/Create establish the object-key conventions to follow (directories are zero-byte
objects at the directory path).
Note the tier deletion embargo: TierValidator.ValidateDelete rejects deletes before the
tier's minimum storage period on GLACIER (90d) and DEEP_ARCHIVE (180d). That is a real AWS
billing constraint, unlike the write-size gate, so Unlink must surface it as a sensible
errno rather than a generic failure.
Implementation
Unlink — delete the object at the child path, invalidate the cache entry, and remove any
buffered writes for that path so a pending flush cannot resurrect the file. Map a missing
object to ENOENT and an embargo rejection to EPERM.
Rmdir — POSIX requires refusing a non-empty directory with ENOTEMPTY. Check emptiness
with a prefix ListObjects limited to a small result count; do not list the whole subtree.
Then delete the directory marker object.
Care needed on two points:
- Implicit directories. A prefix can exist with no marker object (created by another tool
writinga/b/cdirectly).Rmdiron such a prefix should succeed if empty rather than
returningENOENTfor the absent marker. - Cache and buffer coherence. Deleting an object whose data is still in the write buffer
or read cache must invalidate both, or subsequent reads will serve a deleted file.
Acceptance Criteria
-
touch f && rm fsucceeds; the object is gone from S3 -
mkdir d && rmdir dsucceeds -
rmdiron a non-empty directory returnsENOTEMPTY -
rmon a nonexistent path returnsENOENT - Emptiness checking does not list the entire subtree
- Deleting a file with pending buffered writes does not resurrect it
- A cached file is invalidated on delete; a subsequent read returns
ENOENT -
Rmdirworks on an implicit prefix with no marker object - A GLACIER embargo rejection surfaces as
EPERM, not a generic error -
go test -race ./internal/fuse/...passes -
AWS_PROFILE=aws AWS_REGION=us-west-2 go test -race -tags=integration ./internal/fuse/...passes
Dependencies
None — needs no persisted attributes. First of the v0.14.0 sequence. cgofuse parity is tracked
separately.
Activity
scttfrdmn commentedon Jul 30, 2026
Correction: severity is understated —
rmreturns success today while the object survivesThis issue describes the missing operations as failing at the kernel boundary. That is wrong for
UnlinkandRmdir, and the actual behavior is considerably worse.go-fuse defaults both to success. From
go-fuse/[email protected]/fs/api.go:Since
internal/fuse/filesystem.goimplements neither,rmandrmdirreturn exit code 0 and the kernel drops the inode from its tree — while the S3 object is never deleted. The user sees a successful deletion. The file is gone from the mount's view until the cache entry expires or the mount is restarted, at which point it reappears.This is silent false-success: data the user believes deleted is still present and still billing. For anyone using the mount to clear space or to remove sensitive data before decommissioning, the failure is invisible at exactly the moment it matters. Contrast
Rename, which genuinely does default toENOTSUP(same file, line 573) and therefore fails loudly and honestly — #164 is correctly characterized.Adjustments
priority: criticalis defensible on the silent-data-retention argument; at minimum reflect that this is a wrong-result bug, not an unimplemented-feature gap.type: bugfits better than the enhancement framing, since current behavior actively misreports.Unlinkmust return an error when the backendDeleteObjectfails, and must never return 0 without a confirmed delete.Unlink/Rmdirto returnsyscall.EROFS. A loud, honest failure is strictly safer than a false success, and it is a few lines — plausibly worth landing in v0.10.1 rather than waiting for v0.14.0.Rmdiremptiness check specified here needs C0-12: Paginate ListObjects so directories with more than 1000 entries are not silently truncated #171 (ListObjects pagination) — an unpaginated list cannot reliably determine whether a large prefix is empty.The same default applies to the cgofuse build (#168), which also implements neither.
scttfrdmn commentedon Jul 30, 2026
Interim mitigation landed (issue stays open)
DirectoryNodenow implementsUnlinkandRmdirininternal/fuse/filesystem.go. Both log a warning and returnEROFS. This is not the fix this issue asks for — it converts a silent lie into a visible error while the real implementation is scheduled.Why it could not wait: go-fuse's
NodeUnlinkerandNodeRmdirerdefaults return success when unimplemented. Sorm fileandrmdir dirreported success, the shell exited 0, and the S3 objects were untouched — a followinglsshowed the files again. Any script that deleted a file and checked the exit status was silently wrong.EROFSmakesrmprint an error and exit non-zero, which is truthful.Note this is a different failure mode from
Rename(defaults toENOTSUP) andCreate(defaults toEROFS) — those already fail loudly, which is why only the two delete operations needed a stub.internal/fuse/delete_stub_test.gocovers it, with compile-time guards:Those assertions are the load-bearing part — a method whose signature drifts from the interface stops being called by go-fuse and silently reverts to the permissive default, with no compile error at the call site. The test also asserts a non-zero errno, so when the real
DeleteObjectimplementation lands it will need updating; that is intended, and the test says so.The cgofuse build (
internal/fuse/cgofuse_filesystem.go) is unaffected — it does not register delete operations at all, so the kernel rejects them before ObjectFS is consulted.scttfrdmn commentedon Aug 3, 2026
First in v0.11.0. Promoted from v0.14.0, because
rmnot working is a larger gap than the distributed-consensus work that used to lead the next release —go list -deps ./cmd/objectfsshows nointernal/distributedpackage links into the binary, so none of that could affect a mount.Current state confirmed:
DirectoryNode.UnlinkandRmdir(internal/fuse/filesystem.go:628,636) return EROFS with the rationale recorded in place, andattributes.go:63-64asserts both interfaces specifically so go-fuse cannot default them — go-fuse defaults an unimplementedNodeUnlinkerto success, which is how the cgofuse subset reportedrmsucceeding while the object survived. Failing loudly is the right stub; it is still a stub.Blocks #164 (Rename needs a working delete half) and gates #162 (correcting the POSIX claim should follow the surface becoming true, not precede it).