Repository navigation
Description
Summary
Implement Setattr (chmod, chown, utimens, truncate) and the attribute-persistence layer it
requires. Getattr currently returns synthetic config defaults, so file modes and ownership
cannot be stored or retrieved at all.
Background
internal/fuse/filesystem.go Getattr fabricates everything:
out.Mode = f.fs.config.DefaultMode
out.Uid = f.fs.config.DefaultUID
out.Gid = f.fs.config.DefaultGID
// LastModified used for atime, mtime, and ctime alikeEvery file reports the same mode and owner, and there is nowhere for a chmod to land. This is
the foundational issue of the milestone: xattr support (#TBD) builds on the same storage layer.
Storage strategy — metadata by default, annotations as a detected accelerator.
Default: POSIX attributes in S3 user metadata (x-amz-meta-objectfs-mode,
-objectfs-uid, -objectfs-gid, -objectfs-mtime). This works on MinIO, Ceph, and Wasabi,
all reachable through the existing Endpoint/ForcePathStyle config. Cost: metadata is
immutable, so a chmod requires CopyObject onto itself to rewrite it — expensive for large
objects and it rewrites storage-class and lifecycle state.
Accelerator: where S3 object annotations are available, chmod becomes a PutObjectAnnotation
with no object rewrite — mutable in place, 1 byte to 1 MiB, up to 1000 per object, conditional
via x-amz-object-if-match. Annotations are unavailable on directory buckets, on SSE-C
objects, and on non-AWS endpoints, hence the fallback.
Implementation
- Capability layer. Detect annotation support once per bucket at mount (not per
operation), cache the result, and fall back to metadata on any error. Both backends must be
behind one interface soSetattrand the later xattr work share it. Getattr. Read persisted attributes when present; fall back to the current config
defaults when absent, so pre-existing objects and objects written by other tools still stat
correctly.Setattr. Handle mode, uid/gid, and times. Honor thevalidmask — only apply fields
the kernel actually set; applying all four on every call would clobber unrelated state.- Truncate. A distinct operation from the attribute work, despite arriving through the
same call: shrinking is a range read plus rewrite; growing zero-fills to the new size;
truncateto 0 is a plain emptyPutObject. Coordinate with the write buffer so a pending
flush cannot resurrect the old length. - Directories. Marker objects need attributes too, or
chmodon a directory silently
does nothing.
Acceptance Criteria
-
chmod 600 fthenstatreports0600; the mode survives an unmount/remount cycle -
chownpersists uid/gid where the caller has permission -
touch -tsets mtime and it persists -
truncate -s 100 fon a 10-byte file zero-fills to 100 bytes -
truncate -s 0 fempties the file - Shrinking truncate preserves the retained prefix byte-for-byte
- Objects with no stored attributes stat with config defaults, not an error
-
chmodon a directory persists - Partial
Setattr(mode only) does not clobber uid/gid/times - Annotation support is probed once per mount, not per operation
- Verified on both paths: real AWS (annotations) and a non-AWS S3-compatible endpoint (metadata)
-
go test -race ./internal/fuse/... ./internal/storage/s3/...passes -
AWS_PROFILE=aws AWS_REGION=us-west-2 go test -race -tags=integration ./internal/fuse/...passes
Dependencies
Blocks the xattr issue, which reuses the same capability layer. Independent of #163 and #164.
Activity
scttfrdmn commentedon Jul 30, 2026
Correction: annotations require an SDK bump this repo has not taken
The annotations-as-accelerator design depends on API operations that do not exist in the pinned SDK. This is a hard prerequisite, not a detail.
Version gate.
go.mod:10pinsgithub.com/aws/aws-sdk-go-v2/service/s3 v1.88.4. Listing that module directory for annotation operations returns nothing. The operations first appear in v1.104.0:So the annotations path cannot be written at all until
service/s3moves from v1.88.4 to >= v1.104.0, which pulls the coreaws-sdk-go-v2andsmithy-goforward with it.MVS compatibility risk. CargoShip v0.13.0 pins
service/s3 v1.82.0andaws-sdk-go-v2 v1.41.0([email protected]/go.mod). Minimal version selection will resolve to our higher version, so it should build — but CargoShip is compiled against the olders3.Clientsurface, and this needs an actualgo build ./...plus the CargoShip-path tests to confirm, not an assumption. Verify before committing to the annotations design.Semantic defect in the conditional-write plan. The issue proposes
x-amz-object-if-matchfor safe concurrent attribute updates. Per the SDK:It matches the parent object's ETag, not the annotation's. Two concurrent
chmods against an unmodified object therefore both present the same valid ETag and both succeed — last writer wins, silently. Annotations give no compare-and-swap on the annotation value itself. If atomic attribute updates are a requirement, annotations alone cannot provide them; that needs a separate mechanism and should be designed explicitly rather than assumed.Payload constraint. Annotation values must be valid UTF-8; non-UTF-8 bytes are rejected with HTTP 415. This matters for #167 (xattrs) in particular, where
setfattrvalues are arbitrary binary. Base64-encode xattr values on the annotations path, or the metadata fallback will be the only correct path for binary xattrs.Suggested adjustment
service/s3-> >= v1.104.0, core -> v1.42.x, smithy-go -> v1.27.x) with a CargoShip build/test check as its acceptance criterion, and make this issue depend on it.scttfrdmn commentedon Aug 2, 2026
Status: substantially implemented in v0.10.1 — remaining scope is annotations and directory chmod
This issue was filed against v0.10.0, where
Getattrfabricated everything. That is no longer the state. Recording what landed so the milestone is not carrying work that is already done.Implemented (
internal/fuse/attributes.go,internal/vfs/attr.go):FileNode.Getattr(attributes.go:228) reads persisted attributes, falling back to config defaults when absent. TheFileNodeno longer caches anObjectInfoat all — v0.10.0 captured one atLookupand answered from it, so a file reported the size and mtime it had when its inode was created, for as long as the inode lived.FileNode.Setattr(:264) handles size (viabuffer.Truncate), mode, uid, and gid, honoring thevalidmask throughin.GetSize()/GetMode()/GetUID()/GetGID()rather than applying all fields unconditionally.vfs/attr.go:178-185):objectfs-uid,objectfs-gid,objectfs-mode,objectfs-mtime. Exactly the default strategy this issue specifies. Absent-vs-zero is distinguished (attr.go:212), so an object with noobjectfs-uidreports the mounting user rather than root.DirectoryNode.Getattr(:395) — this was the defect that made v0.10.0 unmountable for non-root users.NullPermissionsdisabled go-fuse's mode backstop and, with noGetattron the directory node, the bridge fell through to mode 0000: no execute bit, so no directory of the mount could be traversed.O_TRUNCpath. The kernel does not negotiateCAP_ATOMIC_O_TRUNC, so it issues a separate SETATTR with size 0 beforeOpen— handled inSetattr, notOpen.ENOTSUPrather than stored, sincevfs.Attr.Modeholds permission bits only and a setuid bit that appeared to persist would promise an escalation this filesystem cannot perform.Still open, and the honest remaining scope of this issue:
DirectoryNode.SetattrreturnsENOTSUPfor chmod/chown (:418-436), and cites this issue in its warning. A directory is a key prefix with no object to hold metadata. Doing this properly means either a marker object that carries the attributes (and then deciding what happens to implicit prefixes that have no marker) or a sidecar.utimeson a directory is already accepted and stores nothing, deliberately — failing it would make everytar -xandcp -areport errors for an attribute with nowhere to go.chmodis aCopyObjectonto itself, which rewrites the object and is expensive on large files. Worth noting the self-copy has a wrinkle the audit hit: aCopyObjectto the same key with no changes returns400 InvalidRequest, so the metadata rewrite must actually change something or be routed differently.#167depends on it). One interface, detected once per bucket at mount, cached, falling back to metadata on any error.Also worth carrying forward:
chmod/chown/touchflush synchronously, because each takes a path rather than a descriptor — there is no handle whose release would later make the change durable, so a change not written immediately would never be written at all. Whatever the annotation path looks like, it has to preserve that.Suggest retitling to
Directory attribute persistence and the annotation acceleratorand keeping it on v0.14.0, or splitting item 1 out since it is independent of items 2-3 and is what a user actually notices (chmodon a directory failing).feat(vfs,fuse): extended attributes, stored in S3 user metadata (#167) (
fix(docs): the Not-implemented table and its refusals cite open issue…