An interrupted first run can leave the tag with an unpublished draft.
The rerun took the existing-release branch, replaced the assets and
exited 0 with the release still a draft. Publish after the uploads,
keeping it off the repository's Latest.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The port test fixture spelled out a recorded-artifact path, and the unit
group test a pid literal, so the checker flagged both as added lines of
any PR that touches them. Build the fixture path from parts, name the
pid through a variable, and scan the root block CI files with the
checker's own pattern.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Host paths went through the module allow list, where "*_test.go", "*.md"
and "docs/*" also match root files, so a labelled PR changing
weed/example_test.go or README.md passed. List host changes separately
and fail on any of them; the module list still runs. The port test now
runs the step in a scratch repository.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The nested self-tests read the module's inactive test.yml, deploy/
Dockerfiles and chunkstore-scope.sh. Assert the docs-only gates in
block-test.yml, that each root image refuses every binary it builds, and
that the root classifier selects run for chunkstore, storage and durable
edits.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A link whose label wraps onto the next line was never checked, a target
such as guide(v2).md was cut at its first ')', and a three-backtick line
inside a four-backtick fence closed it. Close a fence only with the same
character at least as long, keep one level of balanced parentheses in a
destination, and match links over each paragraph.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The root adapter carried the v1.1.0 signatures: it passed /home/<user>/
paths and run metadata, and an empty docs/spec/**/recorded-* artifact,
which the module checker refuses. Take the module's pattern and artifact
path check, keep module-relative paths, skip the root adapter's own
pattern when run from the root, and run the module self-test against the
adapter so the two cannot drift.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The changed-path list holds module paths and block controls only, so a
labelled PR that also changed host files passed on its module part. Add
every other changed path with its root name; the allow list refuses it.
The spec-trace scope stays module-only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The two-dot diff against current master listed every block workflow master
changed after the PR branched, so an older docs-only PR hit
workflow_review_required for good. Diff from the merge base; the gate
already requires the tested base to be current master.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A group admits one running and one pending run; a newer push cancels the
pending one even with cancel-in-progress off, so a burst of merges left
some without a post-merge result. Key pushes on the commit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without --no-renames a file moved out of core/storage/ shows only its new
path, so the planner skipped the package it left. The sibling scope scripts
already pass the flag.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gh release create fails once the tag's release exists, after both image
pushes have already run again. Keep the imported helper's existing-release
path: edit the prerelease flag and upload with --clobber.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The inline loop called an empty -run match or a skip a fix, and the list
still named #188 (closed, test passes) and #189 (test absent), so every
nightly run failed. Use known-bugs.sh and its controls, as the module
workflow does, and keep only #186: #187's reproduction passes at this
revision because values.yaml sets blockmaster.stateHostPath.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Relative documentation links step called .github/scripts/doc-links-check.py
and its test inside seaweed-block/, but neither the imported module nor
upstream seaweed-block has them, so the unit suite would fail once the step
runs. Add the checker and its test under .github/block/scripts/ with the
other port scripts and point the step and its contract test there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The notes file was first checked in the last step, after both images
(and, for the highest stable tag, :alpha) were already pushed to GHCR, so
a tag without docs/releases/vX.Y.Z.md left the images published and no
GitHub release. Check it with the tag format, before anything is pushed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The release job holds contents: write and packages: write and logs in to
GHCR, and builds its images with the runner's Docker. Following
BLOCK_RUNNER_LABEL put it on the persistent pool that same-repository PR
test jobs also use, whose Docker and build cache those jobs can leave
state in, and whose Docker setup is still listed as unvalidated. The
source repository published from ubuntu-latest; keep that.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The job's own comment records that it ended in 'Set up job' with no log on
every self-hosted runner, and the source repository ran it on ubuntu-latest.
The port made it follow BLOCK_RUNNER_LABEL, so setting the variable would
bring that failure back for every labelled same-repository PR.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings seaweed-block main (v1.1.1 plus the docs and a test fix after it)
into seaweed-block/ as one commit. Only files under seaweed-block/ change,
and the subtree equals seaweed-block main exactly. The module's full
history stays in the seaweed-block repository.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: encrypt SSE-KMS requests that name no key with alias/aws/s3
AWS encrypts an SSE-KMS request that sends no key ID with the aws/s3
managed key. PutObject, UploadPart and CreateMultipartUpload passed the
empty key ID on, and the KMS call rejected it, so the request failed
with 500. A bucket default of aws:kms without a key failed the same way
for multipart uploads.
CopyObject was worse: its copy paths read an empty key ID as no
SSE-KMS, stored the data unencrypted or under the source key, and
marked the object as SSE-KMS, so reading it back returned garbage.
Resolve an empty key ID to alias/aws/s3 wherever a request or a bucket
default is read, with the helper the bucket default uploads and copies
already had inline.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: re-encrypt an in-place SSE-KMS copy that changes the key
The key-rotation strategy handed back the source chunks for an in-place
SSE-KMS copy, so an object copied onto itself under another key, or
under alias/aws/s3 when the request names none, stayed encrypted under
the old key. Route it through the re-encrypt copy, which already keeps
the same-key case direct.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
* filer: reproduce overwritten bytes lost by server-side copy
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
* filer: retain chunk modification time during server-side copy
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
* filer: isolate the copy regression volume-location cache
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
* filer: reuse fake master in chunk copy regression
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
* filer: share the chunk copy test fixture
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: keep chunk encryption on server-side copy
The copy sent each needle with the chunk's clear size as its length, so a
chunk encrypted by the filer (ciphertext is longer) failed to copy. Chunks
also lost their cipher key, compression flag and S3 SSE metadata, which a
reader needs to decode the copied bytes. The upload now takes the stored
length and the copied chunk keeps those fields.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
Co-authored-by: Perfloop Agent <agent@perfloop.ai>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* filer: a lookup removes what a redis-expired entry left behind
Redis expires an entry's value on its own and leaves the name in the
parent directory's list. A listing drops such a member when it meets it,
but a lookup finds nothing and returns, so the names of entries nobody
lists stay, and so do the directories they leave empty. The filer_ttl
job expires entries by looking them up and cannot reach them either.
A lookup that finds nothing under a filer.conf TTL rule now asks the
store for what expiry left of that name. The redis stores remove the
list member, guarded against a concurrent recreate as on a listing, and
when there was one the filer removes the directories this leaves empty,
as a listing that meets an expired entry does. A miss with no member to
remove costs one command, and only under a TTL rule.
* filer: keep a directory that holds an object when removing empty parents
A file promoted to a directory by a child write keeps its own object data.
Once its last child expires the directory is empty, and the cleanup
deleted it along with that object.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: report a failed removal of a redis-expired leftover
RemoveExpiredLeftover returned a nil error even when the redis SREM or
ZREM failed, so the filer could not log why an expired name stayed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: check a redis orphan repair's keys on the master
With useReadOnly or routeByLatency the cluster client sends EXISTS to a
replica. A lagging replica misreads a just-written value as absent, and
the repair then drops a live entry from its directory list. A lookup miss
now reaches this repair, so check the keys with a script, which runs on
the master, as the redis2 store already does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: a lookup's cleanup leaves directories alone and asks the master first
Removing the directory a redis-expired entry left empty from the lookup
went through DeleteEmptyParentDirectories, which makes none of the empty
folder cleaner's checks. With a leftover as the trigger it removed a
multipart upload's staging directory together with .uploads, a directory
of a bucket that keeps empty folders, an S3 Tables catalog directory,
and the directory of a file written between its emptiness check and its
delete, which strands that file. The lookup now only has the store
remove the name; the directory stays.
The redis stores also check the master for the value before they touch
the list. A lookup that missed on a lagging replica used to remove a live
entry's member and put it back, and a failure in between lost it.
* redis: a lookup's cleanup looks for the member before it asks the master
Most lookups that find nothing are of a name that was never written.
Those now cost one read of the directory list instead of a script and
a removal; only a name the list still holds is checked on the master.
* redis: retry the restore of a directory list member, and report a failure
The orphan repair removes a member and puts it back when the value turns
out to be stored, because an insert got in between. Nothing else puts
that member back, and a failed restore was only logged, so the entry
stayed out of its directory's listing until it was written again. The
restore is now retried a few times, and a restore that still fails is
returned as an error.
* redis: keep restoring a directory list member until redis takes it
A restore that failed every attempt left a live entry out of its directory
list for good, since nothing else puts the member back. Retry it in the
background until it lands or the store closes; the repair still reports
the failure.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* worker: filer_ttl expires S3 objects in buckets without lifecycle rules
The job skipped every entry carrying the S3 expiry flag, to leave
lifecycle expiry to s3_lifecycle. The filer puts that flag on any S3
object it gives a TTL, a filer.conf path rule's TTL as well, and
s3_lifecycle only evaluates buckets that have lifecycle rules. So the
rows of objects uploaded through S3 under a plain path TTL were never
removed unless something looked them up or listed their directory.
A flagged entry is now left to s3_lifecycle only in a bucket with
lifecycle rules, read with the loader that job uses. Elsewhere the job
expires it at the time the filer's lookups do, which for an S3 object
counts from its mtime.
* worker: filer_ttl leaves S3 objects to s3_lifecycle only where rules stamp TTLs
Lifecycle rules put a TTL on an object only in a bucket with the
lifecycle TTL fast path on. In any other bucket the TTL of a flagged
object came from a path rule, and s3_lifecycle, which expires by its
rules, never removes it: a bucket whose only rule aborts multipart
uploads, or expires another prefix, kept such objects.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: filer_ttl leaves a bucket to s3_lifecycle only for a rule the fast path stamps
A fast-path bucket whose configuration is empty, or holds only rules
that expire nothing after days (abort multipart uploads, noncurrent
versions, tag filters), stamps no TTL, so its flagged objects carry the
path rule's TTL like any other bucket's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: filer_ttl defers only the objects a stamping rule matches
A fast-path rule stamps its TTL only on keys under its prefix and
within its size filters, so another object in the same bucket got its
TTL from the path rule.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: filer_ttl lists each rule once more for the S3 objects its cursor passed
The cursors saved so far moved past every S3 object, which the replay
skipped, and nothing lists a rule that has a cursor. They are now saved
under a new name, so after the upgrade each rule is new once: it is
listed, which removes the expired objects, and replayed from a fresh
cursor.
* worker: filer_ttl defers only a TTL the fast path stamped
A flagged object whose TTL differs from the one its matching fast-path
rules stamp got it from a path rule (a multipart upload, or an object
written before the rule), so filer_ttl expires it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: filer_ttl lists a rule again when its buckets' fast-path rules change
The replay moves past an object it leaves to s3_lifecycle. Each cursor
now keeps a signature of the fast-path rules of the buckets its rule
covers, and a different signature has the rule listed, which removes
the objects whose lifecycle rule was removed or changed once they are
due.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: filer_ttl quotes the prefixes it hashes into a lifecycle signature
A prefix holding a tab or newline could make two rule lists hash alike.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* admin: show the configured S3 endpoint in the service account CLI example
The credentials modal always printed AWS_ENDPOINT_URL=http://localhost:8333.
Use s3.public_endpoint from admin.toml (or weed mini's own S3 address) when
it is set, and keep localhost:8333 only as the fallback.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* admin: test the service account CLI example endpoint
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* admin: shell-quote the S3 endpoint in the service account CLI example
A configured endpoint may contain characters such as ';' in its path, which
would split the copied export command.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* filer: resume chunk reads where the last one ended
ChunkReadAt walked the chunk views from the front on every ReadAt, so
reading a file of n chunks front to back took time proportional to n
squared. S3 GETs (256 KiB reads) and WebDAV downloads (32 KiB reads)
both read whole files through it: a 32 KiB read near the end of a file
of 100,000 chunks took 164 µs instead of 8 µs.
Keep where the last read ended and start the next walk there when it is
at or before the new offset. The mount merges new chunks into a live
reader's views, so the interval list now counts its edits and a kept
position is only used while the count is unchanged.
* filer: benchmark ChunkReadAt reads
Whole-file sequential reads at 1 to 100,000 chunks, one-chunk files read
with a new reader, and random reads, all served by mockChunkCache so they
measure the reader itself.
* filer: trim the resume-point comments
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Denis Maier <denis@dAir.lab>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
TestReadWithVolumeServerDown wrote three files and required each volume
server to hold a chunk of one of them. When the mount starts before the
master is elected, the first writes can all land on the volumes one
server lacks, and the test stopped before stopping anything. Write three
more at a time, up to twelve, until every server backs a file.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* go.mod: take seaweedfs/go-fuse from #5 until it is released
The handover builds on the server API of seaweedfs/go-fuse#5: Server.Stop,
Start and Shutdown, Server.Dev and NewServerFromDev. Until that pull request
is merged and tagged, go-fuse is replaced by its branch; the replace goes
with the release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: quiesce the background writers, pause and resume the metadata subscription, and give a takeover its own cache directories
The periodic metadata flush, the proactive chunk flush and the idle directory
eviction check a gate before each tick, so a handover can stop them and wait
for the work they run. PauseMetadataFollow and ResumeMetadataFollow end the
subscription and start it again from the position of the last event it
handled, with the filer.conf follower it had.
A successor keeps the subscription's client id (the signature crosses), so
it subscribes at an epoch above its predecessor's: the filer then replaces
the old subscription instead of refusing the new one as a duplicate and
making it wait for a retry.
A process that takes a mount over (Option.Takeover) uses <id>.t<pid> for its
read and swap directories, as the predecessor still uses <id>. A normal start
removes the stale <id>.t* siblings.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: the handover protocol, old side and new side
A running mount listens on a unix socket (0600; the peer's uid is checked
with SO_PEERCRED on both ends, ours or root). A successor connects, says
hello, receives the FUSE fd with the INIT negotiation and the exported state,
answers ready, and is told go.
The hello carries the mount directory, the filer path and the options the
state depends on (writeback cache, routed locks, nfs export): the running
mount refuses a mismatch, a blocked lock request and a peer chunk server
before it flushes or pauses. A connection closed before its hello is a probe
(HandoverAnswers), logged at V(1).
Until go the old side rolls back at every step (pre-flush, quiesce, stop,
final flush, pause of the subscription, export, ready) and keeps serving: the
subscription restarts from its position, the background writers and the nfs
export writer resume, the server reads again. After go it closes its server
without unmounting and marks itself committed, so its exit leaves the mount
and the successor's sockets alone.
The fd is carried by a fixed-size header written with one sendmsg and read
with one recvmsg; control messages are length-prefixed JSON, and the state
stream and the go frame are read through one bufio.Reader.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: a new mount on a live mount directory takes it over
A weed mount started on a directory that is mounted already, whose weed
mount answers on the handover socket, takes that mount over instead of
replacing it: open files, locks and working directories inside it carry on.
- Every Linux mount listens on a socket next to its local gRPC socket,
<localSocket without .sock>.handover.sock, /tmp/seaweedfs-mount-<hash>.handover.sock
by default; a deployment that keeps the local socket where the next mount
process can reach it gets the same for this one. Not with -peer.enable,
whose listen port has a single owner, nor with -filer.tokenFile, as read
tokens and chunk proofs do not cross.
- Those mounts read /dev/fuse in the stoppable way.
- A new mount takes over when its directory is in the mount table and a
process answers on the socket. When none answers (none runs, it crashed,
it is an older weed), the mount proceeds as before.
- A takeover skips the pre-mount unmount and the mount point check, binds the
local gRPC socket and the handover socket only after the old process said
go, and uses cache directories of its own. One that does not go through
exits non-zero and leaves the running mount serving; to mount anew, stop
that weed mount or unmount first, as for a busy mount today.
- After go, a socket the new process cannot bind is logged, not fatal: the
mount goes on without mount.configure or without a next handover, rather
than going down.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: end-to-end handover test
test/fuse_handover starts a real weed mini and weed mount processes with the
same arguments, and lets each new one take the live mount over, twice in a
row and once more after a refusal. An appending writer, a streaming reader,
an mmap, an unlinked temp file, an unclosed new file, a directory walk and a
listing in progress, a held flock and POSIX lock, a process working inside
the mount and a renamed open file run through it. It checks that the mount
was never unmounted (mount id and st_dev), that the old processes exit 0,
that a takeover refused because a SETLKW is blocked, or because the options
differ, leaves the mount serving without a pause, and prints the pause.
With HANDOVER_SCALE_FILES=<n> a second test creates n files, takes the mount
over, and logs the pause and the size of the state. On a 2-vCPU VM: 10k files
18 ms and 360 KB, 100k files 134 ms and 2.9 MB, 300k files 410 ms and 7.1 MB.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: answer the first review of the handover
The checks before anything pauses:
- The hello carries the filer addresses, sorted, and -defaultPermissions:
the running mount refuses a successor of other filers (its open files and
inode table name entries and chunks of this filer) or of another
default_permissions (without it the kernel leaves the permission checks
to the mount, and a successor that counts on the kernel would make none).
- A successor finds the live mount for a relative -dir and for a path with a
space: the mount table is read with the absolute path, and its octal
escapes (\040 ...) are undone, which checkMountPointAvailable gets too. The
local socket keeps its name.
Rollback and commitment:
- A rolled back handover starts the FUSE server first. A subscription that
did not end in time may wait for a request to be served, and the rollback
waited for it before the server read again. The subscription now starts
again in the background once the old one has ended; until then a new
handover is refused before anything pauses.
- A successor reads the filer configuration (PrepareBackgroundTasks) before
it connects, since a failure there after go would end the process with
nobody serving the mount, and it does not create the mount root, which the
running mount serves.
- A reconnecting subscription publishes its epoch, so that a later one with
the same client id starts above it instead of being refused as a
duplicate.
- A takeover's cache directories are <id>.t<pid>-<random>: two processes
that each run as pid 1 of a container sharing the cache base got the same
directory.
Tests:
- The protocol tests run on Linux only, as the protocol does; those of the
background gate and of the cache directories run everywhere.
- The end-to-end harness bounds the probes that go into the mount, waits
until the SETLKW helper sleeps in FUSE before it asks for a takeover,
counts only complete reader passes, closes the retained files on failure,
rechecks a log after its process exited, and cleans up only mounts below
its own directory.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: read the filer configuration again after a takeover
A successor reads the filer configuration before it connects, so that
nothing that can fail is left for after go. A change that the predecessor
applied in between does not come again with the subscription, which starts
where the predecessor stopped, and the successor kept the configuration it
had read. It now reads it once more when it starts its background tasks;
on failure the one read before stays.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: build the moved handover tests where their helpers are
handover_quiesce_test.go uses newHandoverWFS, which is defined in a test
file built everywhere but on Windows; it gets the same constraint. The
mount readiness probe of the end-to-end test is also capped at the
remaining deadline.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: renew the routed lock leases before the background tasks wait on the filer
A successor with -dlm holds the routed locks its predecessor took, and the
filer drops their leases 15 s after the last renewal. StartBackgroundTasks
began renewing only after it had read the filer configuration again, a
filer call that can take longer than that. The renewal now starts first.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: compare -readOnly and -allowOthers in the hello, and drop a filer configuration that is gone
- -readOnly and -allowOthers are kernel mount options, fixed when the mount
was made: a successor started with others would run with the old ones
without knowing. The hello carries them and the running mount refuses a
mismatch before anything pauses.
- The filer configuration read again after a takeover clears the one read
before when the file is gone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: close the held lock files of the handover workload on failure
The flock and POSIX lock files are opened before the takeovers and closed
in finish(); an assertion that fails in between left them open. They get a
cleanup right after they open, like the other retained files.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: compare the kernel's mount options as -o sets them too, and retry the filer configuration read after a takeover
- allow_other, ro and default_permissions can come from -o as well as from
their flags. The hello compared the flags only, so a successor started
with -allowOthers=false could take over a mount made with -o allow_other.
The mount now records the kernel's options from both (KernelReadOnly,
KernelAllowOther, KernelDefaultPermissions), and the hello compares
those.
- The read of the filer configuration after a takeover is tried three times
before the subscription starts, which can wait: it starts where the
predecessor stopped. Only if all fail does the configuration read before
the takeover stay until its next change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: drop the WEED_MOUNT_HANDOVER_STOP_TIMEOUT test hook
The drain bound stays at its 10 s default; the end-to-end tests wait well
over that for a refusal, so they do not need a setting of their own.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: close a descriptor that comes with a refused handover
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: take a mount over when the new process shares a filer with it
The hello required the sorted -filer list to match exactly, so a
successor started after filers were added to the cluster or taken out of
it was refused, and the old mount kept serving. A filer serves one filer
store: one filer in common means the store that the open files, the
inode table and the chunks belong to.
Compare the filers as host:port, as ServerAddress.Equals does, so that
an address written with its gRPC port counts as the same filer, and
refuse only lists with no filer in common.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* ci: run the FUSE mount handover end-to-end tests
test/fuse_handover starts a real weed mini and weed mount processes and
lets each new mount take the live one over; no workflow ran it, so only
the unit tests guarded the handover in CI. The job follows the FUSE DLM
one: it repairs the fusermount3 setuid bit, builds weed and runs the
tests with WEED_BINARY. The tests mount as the runner user without
allow_other, so fuse.conf is left alone. A failed run uploads the weed
logs, which the harness keeps in /tmp/fuse_handover_*.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: compare the kernel's mount flags in the hello, resolved in order
The hello compared ro as "-readOnly or -o ro", and no other mount flag.
-readOnly puts ro before the -o options, and both fusermount3 and
go-fuse's direct mount apply the options in order, so -readOnly with
-o rw mounts read-write while the hello said ro. A successor started
with -o noexec, nosuid or nodev also got the old mount's flags without
knowing.
Resolve the generic flags from the option list go-fuse mounts with, in
order, from nosuid and nodev as both mount paths start, and refuse a
successor whose flags differ before anything pauses. relatime is left
out: the kernel uses it unless noatime or strictatime is set.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: do not send a handover control frame the peer would refuse
writeControl sized its buffer from the encoded message without a bound,
while readControl refuses a frame over maxControlFrame. Refuse the
larger frame before allocating, as the reading side does (CodeQL
go/allocation-size-overflow).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: unmount the handover e2e mounts with fusermount when fusermount3 is missing
The harness detached leftover mounts with fusermount3 only. A fuse2 host,
such as CentOS 7 or an Alpine image with the fuse package, has only
fusermount, so the last step of TestHandoverEndToEnd failed there after
every handover had passed. Try fusermount3, then fusermount.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* go.mod: use go-fuse v2.9.6 instead of the branch of seaweedfs/go-fuse#5seaweedfs/go-fuse#5 is merged and tagged v2.9.6, whose tree is the one
this pull request was tested with (1eec9a8). Drop the replace with the
fork and require the release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: whitebear009 <whitebear009@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
* filer: answer a forwarded create or update after replaying it
A conditional or exclusive create, or a conditional update, is forwarded
to the entry's write owner and stored there first. When the owner keeps a
store of its own, the forwarding filer sees the write only once it replays
the owner's event, so the caller's next lookup through it could find the
file missing or stale: a mount reopening the file it just closed got
ENOENT. Wait for that replay before answering, as a forwarded rename
already does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: answer a forwarded delete after replaying it
A delete forwarded to the write owner removes the entry there first; until
this filer replays the owner's event, a lookup through it still finds the
entry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: skip the replay wait for an owner on this filer's store
An owner that runs on this filer's store wrote the entry there already, so
waiting for its event to replay only delays the answer.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: return the object's SSE headers from CompleteMultipartUpload
AWS answers CompleteMultipartUpload for an encrypted object with
x-amz-server-side-encryption, the KMS key id and bucket-key-enabled.
Read them from the committed entry the way HEAD does, on both the first
answer and a retry answered from the committed object. SSE-C customer
headers are not echoed, as AWS does not send them on Complete.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: test CompleteMultipartUpload SSE response headers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: answer CompleteMultipartUpload SSE headers from the entry only
setSSEResponseHeaders falls back to the request's KMS key id and
bucket-key headers, so a Complete request carrying them could report a
bucket key the object does not use. Complete's own headers say nothing
about the object; pass none.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: test that Complete does not echo request SSE-KMS headers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: return the upload's SSE headers from CreateMultipartUpload
CreateMultipartUpload now answers with the encryption the upload was
initiated with, as AWS does: x-amz-server-side-encryption for SSE-S3 and
SSE-KMS, the KMS key id, encryption context and bucket-key flag, and the
SSE-C algorithm and key MD5. Bucket-default encryption is reported the
same way, from the config stored on the upload entry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: validate the SSE-C key and KMS context on CreateMultipartUpload
Initiate accepted an SSE-C key whose MD5 did not match, an incomplete
SSE-C header set, and a KMS encryption context that was not base64 JSON,
then created the upload. Reject them before creating the upload with the
same codes PutObject returns, so the headers the response echoes are ones
the parts can use.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: encrypt multipart parts with the context given at initiate
CreateMultipartUpload stores the x-amz-server-side-encryption-context
header as received, base64 JSON, but UploadPart and UploadPartCopy
parsed it as raw JSON, failed, and fell back to the default context. Every
part's data key was wrapped without the context the client asked for.
Parse the stored value the way the header is parsed on PutObject.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: reject KMS encryption contexts the key service refuses up front
CreateMultipartUpload accepted a context with control characters, a
whitespace-only key or too many pairs, so every part then failed; PutObject
answered the same input with a 500. Both now build the merged context once
and apply the KMS checks, answering InvalidRequest.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: keep the derived aws:s3:arn in a client's KMS encryption context
A context header naming aws:s3:arn replaced the object or bucket ARN sent to
the key service, on PutObject and, through the context stored at initiate,
on every multipart part, so a key policy conditioned on aws:s3:arn could be
met with another bucket's ARN.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The shutdown leaves the lock ring and drains gRPC and HTTP before
Filer.Shutdown runs the final metadata log flush. Those steps can take
longer than a container's termination grace period, and a kill before the
final flush drops every local event since the last periodic flush. On a
shared store peers keep those events only in memory, so they vanish from
every filer's aggregated stream.
Start a flush of the local metadata log first, in the background, so the
events accepted before the signal are persisted within seconds.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: stop at startup when the -s3.config KMS block doesn't load
A kms block in the -s3.config file that failed to load was only logged,
so S3 came up healthy with SSE-KMS off. Every SSE-KMS write and every
read of an SSE-KMS object then failed with 500, and nothing at startup
pointed at the config.
loadS3ApiConfigurationFromFile now returns the KMS error once it has
applied the identities, and startup already stops on any error it
returns. A SIGHUP reload still applies the identities, so a revoked
key stops working, keeps the previous KMS providers and logs the error.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: shorten the KMS load-order comment
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>