mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
41f1c25d0174a4ff2fdf5f0035a52ff3f0fed13a
10847
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
41f1c25d01 |
s3api: drop bucket size gauges on an instance that lost the metrics lock (#13019)
* s3api: drop bucket size gauges on an instance that lost the metrics lock Only the S3 instance holding the s3.leader lock collects bucket sizes and quota state, once a minute. An instance that loses the lock and keeps running never clears what it set. bucketMetricTTLControl drops a bucket's gauges only after 10 minutes without activity, and every request the instance serves for the bucket counts as activity. So for the buckets clients keep using through it, its bucket_size_bytes, bucket_physical_size_bytes, bucket_object_count, bucket_quota_bytes and bucket_read_only series stay at the values it collected last, next to the new holder's current ones. Summing a gauge over instances counts those buckets twice, and taking the max shows a bucket that has shrunk since at its old size. On every tick without the lock, reset these five gauges. Only the holder's collection sets them, so an instance that never held the lock loses nothing, and one that lost it stops reporting within a minute. In a cluster with seven S3 instances, one kept 10 to 14 buckets at their old values for four days after losing the lock; at one point the max over instances put a bucket 37 TB above its size. TestBucketSizeMetricsTickWithoutLockDropsGauges sets the gauges for two buckets, checks that a tick with the lock leaves them, and that a tick without it removes all five. Without the reset it fails for each gauge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: shorten the bucket size metrics lock-loss comments 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> |
||
|
|
d2276f531e |
master: apply the whitelist to management gRPC RPCs (#13022)
* master: gate operator-only management RPCs on the whitelist CollectionDelete, DisableVacuum, EnableVacuum, VolumeGrow, ResumeVolumeGrowth, LeaseAdminToken and ReleaseAdminToken now call checkGrpcAdminAuth, matching the whitelist their HTTP counterparts already enforce. VolumeGrow stays open to the in-process growth loop, and callers on the local gRPC socket of weed server/mini are local. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: admit unknown masters over KeepConnected only from the whitelist A KeepConnected registration as a master pulls that address into the raft quorum. Accept it from any caller only for this master and its -peers; any other master address now needs a whitelisted caller, the same check RaftAddServer applies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: test that every RPC is gated or listed with a reason Port the volume server's coverage test so a new master RPC cannot skip checkGrpcAdminAuth without an explicit exemption. The proto and AST helpers now take the proto file and receiver name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: admit callers on the local gRPC socket weed server and weed mini route same-host gRPC dials through a unix socket, whose peer address carries no IP. With -whiteList set the volume server refused the in-process master's AllocateVolume, so no volume could be grown. The Rust volume server serves gRPC over TCP only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: match a KeepConnected master against configured peers by gRPC endpoint Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pb: bind the local gRPC socket for the owner only Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: warn when a deleted bucket's collection is left on the master Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pb: bind the local gRPC socket in a private directory before moving it into place Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: report an unconfirmed bucket collection delete as such Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
a00dbff13b |
sftp: apply the bucket's default Object Lock retention to uploads (#13017)
* s3_objectlock: read a bucket's default retention from its entry Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: give uploads into an Object Lock bucket its default retention Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: match uploads against the cleaned buckets folder Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
87ee3c57cb |
s3: keep the EOF read out of the timed body in the put stage test (#13016)
* s3: do not delay the EOF read in the put stage timing test TestPutStagesRecordEachStage checks that the storage stage is at least 5ms. That stage is the second chunk's assign wait (20ms) minus the final read that only returns EOF, which slowReader also delayed by 10ms. When busy goroutines hold every P, the reader's wakeup can lag the assign's by as much as a preemption slice, and storage drops below the floor. slowReader now delays only reads that return data, so the EOF read is instant and storage covers the whole assign wait. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: keep the EOF read out of the timed body in the put stage test Skipping the delay on the EOF read still left that read inside timedBody, so a stall there was subtracted from storage. Feed the upload through an eight-byte limit instead: the final EOF comes from the limit reader without reaching the timed body, so storage always covers the second chunk's full assign wait. slowReader goes back to delaying every read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
dcce121d95 |
weed fix.recover: recover needles past damaged .dat regions (#13002)
* feat: weed fix -verify to resync past damaged regions in .dat Plain `weed fix` walks .dat by trusting each needle header, so a damaged region in the middle loses or misindexes everything after it, and a torn or garbage tail ends up in the index and keeps the volume read-only. -verify reads every needle, checks structure and CRC32, and on a failure searches forward at needle alignment for the next verifiable needle. Each skipped region is reported as zero-fill / garbage / garbage+zeros with its length, zero windows and the fid of the needle that was hit. The index is rebuilt from verified needles only (old one kept as .idx.bak); -truncateTail cuts trailing garbage so the load-time integrity check passes, -dryRun only reports. Works with the 5BytesOffset build. * feat: add weed fix.verify, a read-only check of .dat files Runs the same needle/CRC verification and resync scan as `weed fix -verify` but never writes: no .idx rebuild, no truncation. Takes folders and/or .dat files, filters with -collection / -volumeId, prints the damaged regions (optionally to -report) and exits 0 when clean, 3 when damage was found and 1 when a file could not be verified. The scan options are shared with `weed fix -verify`. * feat: weed fix -compact, verify and compact a damaged volume in one pass -compact implies -verify. While the .dat is scanned, every verified needle gets an index entry, and from the first damaged region in the middle of the file the needle bytes are streamed into a new .cpd as well (the intact prefix before it is copied as one block). The result is a .dat without the damaged regions and an append-ordered .idx that matches it exactly, so a full volume scrub no longer complains about the .dat size. The compaction revision is bumped like a vacuum does. A volume without damage is left untouched, and damage only at the tail is just cut off in place, so neither costs a .dat copy. The old .idx is kept as .idx.bak and the old .dat as .dat.bak (-deleteOriginal removes it). The free space needed for the new .dat is checked before anything is written, a failing swap is rolled back, and progress is printed every 30s. * refactor: reuse backend, super block and throttler code in weed fix -compact - create the .cpd with backend.CreateVolumeFile and preallocate the bound of the new .dat; the result is truncated to its real length at the end - read the super block with super_block.ReadSuperBlock (also in the verifier) and write the bumped compaction revision with SuperBlock.Bytes() - throttle the .dat writes with util.WriteThrottler (-compactionMBps) - fsync the directory before and after swapping the new files in ReadSuperBlock cannot read a super block with extra data, so such volumes are rejected with its error instead of being handled by a hand-written parser. * refactor: drop helpers that duplicate existing code in weed fix -compact / fix.verify - util.FsyncDir instead of a local fsyncDir - io.NewOffsetWriter instead of a hand-written WriterAt adapter; the throttle now sits in one small writer wrapper used for both the prefix copy (via io.CopyBuffer) and the streamed needles, replacing the manual copy loop - needle.NewVolumeId instead of strconv for volume ids parsed from file names * fix: resync in weed fix -verify must not accept payload-less look-alikes After damage, a few bytes of a needle's tail followed by the next record's header could parse as a payload-less needle and be confirmed only because the file ended right after it, so a made-up key got into the index and swallowed the real delete record behind it. A payload-less candidate is now accepted without a verifiable successor only if it is a size-0 tombstone ending exactly at the end of the file (or, with a set timestamp, leaving less than a header); a set but implausible v3 timestamp rejects it. Anything else needs the next needle to verify. * test: recovery integration tests for damaged .dat heads (#5674, #12914) - zero-filled head (aligned and cut next record): all survivors indexed, region reported as zero-fill, trailing tombstone kept - plain weed fix stops at the first bad header (#12914 item 1) while -verify recovers the needles behind it - a needle rewritten after a damaged region is indexed at its newest copy - a zeroed superblock fails with an explicit unsupported-version error and fix.verify counts it as not verifiable (exit 1) - v1/v2 needle layouts verify cleanly * fix: reject a super block extra in fix -verify A super block extra describes an erasure-coded layout; the .dat behind it was re-striped into .ecXX shards and is not a plain needle file. Scanning it as one silently produced damage reports instead of telling the operator the file is out of scope. Return an explicit error instead. * fix: guard fix -verify/-compact against pending compaction commits and -dir.idx - refuse to start while a .cpc marker exists: an interrupted vacuum commit is pending and the volume server must reconcile it first (roll forward/back); writing a rebuilt .idx or new .cpd/.cpx over that decision would race it - clear a stale .cpc after a completed swap so it can never be rolled forward later (defensive; the start guard already refuses this state) - spell out in the help and print after a rebuild that the index is written next to the .dat: with a separate -dir.idx directory the .idx must be moved there and any stale .ldb dropped - tests: refusal leaves the marker and writes no .idx; a completed swap clears a marker that slipped past the guard * refactor: narrow this change to weed fix -verify Drop weed fix.verify and weed fix -compact from this change; they follow in their own pull requests. -report, -windowMB and -zeroWindow go with them: the scan uses fixed windows and prints its report to stdout. * fix: weed fix -verify: address review findings - -maxNeedleSizeMB limits only guesses made while resynchronising; a record reached at a known boundary may be as large as the file allows - a v2/v3 record whose parsed fields do not add up to its size, or a live record without data, is damage: a zero fill over the data length used to pass as an empty file because the CRC is only checked when there is data - a stamped v3 delete record found after damage stands on its own when its time is believable, not older than the last verified record and followed by zero padding, so a delete before a damaged tail is not lost - a read error while searching for the next needle fails the run instead of ending the scan and treating the rest as a garbage tail - keys whose newest record is damaged while an older copy is indexed are reported as stale-version warnings - the rebuilt index is staged as .idx.tmp and swapped in when complete; a stale .ldb next to it is removed so the volume server rebuilds it - -ignoreError reports a volume that cannot be verified and goes on - -truncateTail does not cut a tail it could not read and removes a partial tail backup - volume ids are parsed as uint32 - the test fixture stamps every record the way the volume server does * fix: weed fix -verify: prove deletes found after damage, swap the index safely - a delete record found while resynchronising must prove itself: a v3 one needs a believable time not older than the last verified record and zero padding (every v3 writer stamps deletes); a v1/v2 one needs the following records to reach data that passes its CRC, or the exact end of the file. Stray bytes in a zero-filled region used to pass as deletes of live keys. - the rebuilt index is fsynced before the swap, the previous one is kept as a hard link, and the new one replaces it in one rename, so a live .idx exists at every moment - .sdx and .rdb caches are removed with the .ldb - -verify exits non-zero when it found damage, like plain fix and -verifyCrc - with -ignoreError a file name whose volume id does not fit uint32 is reported and the batch goes on - the help and the printed hint say that a volume server prefers an .idx next to the .dat over the one in -dir.idx * fix: reject weed fix flag combinations -verify cannot honour -verify -remoteFile skipped an explicit .dat and reported success, -dryRun and -truncateTail were silently ignored without -verify, and -dryRun -ecx still rebuilt EC indexes. Check the combinations before any file is touched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: apply -volumeId before rejecting an out-of-range volume file name With -volumeId set, an unrelated file such as 4294967296.dat aborted the run before the filter could skip it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: check the data length before reading a record body in fix -verify A damaged size field at a known record boundary made the scan allocate and read a body of that size before rejecting it. Check that the data length after the header fits the record first, as the resync probe already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: accept a v1/v2 delete chain that reaches the end of the file on its last probe Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: keep an implausible needle timestamp out of the fix -verify resync baseline The data CRC does not cover the v3 timestamp, so a corrupted one passed and then rejected every genuine delete record found after later damage. Report it as a warning instead of using it as the lower bound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: stop fix -verify on a read error at a known record boundary An EIO while reading a record was treated like damaged bytes: the scan resynchronised past the unread record and the rebuilt index dropped it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: sync the fix -verify tail backup before truncating the .dat A crash right after the truncate could persist it before the backup's data or directory entry, losing the cut bytes from both files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: let fix -verify -truncateTail retry when a tail backup already exists After a backup succeeded and the truncate failed, the next run hit the existing backup and could not get past O_EXCL. Keep the first backup and save the tail under a new name, as the index backup does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: drop stale index caches before fix -verify swaps in the new index Removing them after the rename left a window where a crash paired the new .idx with the old .ldb, whose newer LOG skips the replay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: pin fix -verify fixtures to needle version 3 -verify reads v1 to v3 records, so its fixtures should not follow the build's current needle version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: refuse fix -verify on remote-tiered volumes A remote-tiered volume is read from its remote .dat through the existing .idx, so rebuilding that index from a local .dat would point it at the wrong bytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: pick a free backup name when fix -verify retries within one second backupName fell back to path.bak.<unix time> without checking it, so a second retry in the same second reused that name and the exclusive create (or the .idx hard link) failed. Add a .<n> suffix until the name is free. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: refuse fix -verify when the volume info cannot be read An unreadable or unparsable .vif may name a remote tier, so treat it like one and keep the existing index. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: pass weed fix -verify options explicitly * feat: move weed fix -verify into a weed fix.recover command * docs: weed fix.recover help, point weed fix at it * fix: keep the volume file helpers below runFix Leaves the region between VisitNeedle and runFix as on master. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: build fix.recover fixtures at needle version 3 fix.recover reads needle versions 1 to 3, so its tests must not follow GetCurrentVersion; writeFixTestVolume now takes the version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: whitefox <whitefox@mayflower.work> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
25f7e8a0fd |
filer: refuse chunk appends onto inline and remote-only entries (#12993)
* filer: refuse unsafe chunk appends * filer: report append representation preconditions * filer: cover cached remote append eviction safety * filer: cover lazy remote append refusal * filer: refuse HTTP appends and offset writes onto remote-only entries An HTTP append or offset write onto a remote-only entry stored the new chunk with nothing below it, so reads returned zeros where the remote bytes were and the entry stopped being remote-only. Small appends failed with a retryable "inline file changed" error instead. Refuse both with a client error, matching AppendToEntry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: AppendToEntry appends after a sparse tail AppendToEntry placed new chunks at the end of the existing chunks, so a file extended past them by a truncate got the appended bytes inside its logical length instead of after it, and its size did not grow. Use the entry size, as the HTTP append path does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d2ae75516c |
notification: keep chunk cipher keys out of webhook payloads (#13014)
* filer_pb: scrub cipher keys from both entries of an event Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * notification: keep chunk cipher keys out of webhook payloads Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f079b68f2b |
filer: grpc_require_token with authenticated filer-to-filer peer calls (#13011)
* filer: require bearer tokens for configured gRPC calls * filer: authenticate owned peer RPCs with per-call admin tokens * filer: retain scoped forwarding refusals with required authentication * filer: preserve tokenless HTTP forwarding outside require mode * filer: honor clock tolerance for gRPC admin fallback * filer: preserve caller token on lock owner forwards * filer: forward caller auth on target ping * filer: authenticate startup peer digest checks * filer: verify required subscription bearers independently of mTLS * filer: assert exact caller bearer on forwarded ping * filer: sign peer tokens with the gRPC verification key peerContext signed filer-owned RPCs with jwt.filer_signing.key only. With grpc_key as the only key and require-mode on, peer calls went out tokenless and were refused. With both keys set, peers that verify with grpc_key and lack the shared-key admin fallback refused the shared-key token even with require-mode off. Sign with the key filesystem gRPC verifies, and keep the shared key for metadata subscriptions, whose verifier accepts admin tokens signed only with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep a subscription token's scope over mTLS in require-mode Require-mode admitted a dedicated subscription bearer without the mTLS shortcut, but the handler re-checked it with the certificate, which granted the full stream past the token's prefixes and expiry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: delete uploaded chunks when the write owner refuses authentication A forwarded HTTP append or offset write that the owner refused as Unauthenticated kept its new chunks as if the outcome were unknown, orphaning them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: hand the admitted subscription scope to the handler The handler re-verified a dedicated subscription token after reading the request. If the token expired in between, an mTLS peer fell back to the certificate and got an unrestricted stream. The interceptor now passes the scope it admitted, and the handler refuses it once expired. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: accept grpc_key admin tokens on metadata subscriptions A filer with only grpc_key signs peer subscriptions with it, but the subscription verifier checked admin tokens against the shared key only, so with a subscribe key set the aggregator's peer streams were refused. An unscoped grpc_key token already has full filer gRPC access. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: delete the generated manifest when the write owner refuses authentication A forwarded HTTP append that crossed the manifest threshold left the manifest blob it had uploaded orphaned when the owner refused the call as Unauthenticated. The blob alone is deleted, since the manifest also lists committed chunks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
a1764358cf |
filer, mount: keep a hard-linked file to one link id and count its names on the filer (#13006)
* filer, mount: keep a hard-linked file to one link id and count its names on the filer A hard link's bookkeeping was done by the client. To link a file a mount reads its entry and sends two writes, an update of the source and a create of the new name, both with a link id and a count of the file's names. Two clients that link one file at the same moment each worked from the entry as it was before the other's writes: - With no link id on the entry yet, each made one up. The second update moved the source to its id, the store took the name off the first, and the first client's new name was left alone on it: one file's chunks under two link ids. - With a link id there, both read the same count and sent it plus one. The record counted one name fewer than the file had. Any write through a name carried the client's copy of the count and replaced the record the same way. Either way the delete of the last counted name deleted the record and the chunks while another name still read them. The filer's own store now counts the names of a hard-linked file itself (countLink): one more when the name written did not hold the link before, the same when it did or when a rename moves it there (WithMovedLink), one for a record that starts. The count sent is not used, and the entry gets the count stored, so the response and the event carry it. The lookup of the name, the count, the record and the name are stored as one change of the record (changeLinkRecord), which DeleteHardLink goes through as well: under a lock per link id, and in a transaction where the store refuses a commit over a change made since it began, run again when it does. A wrapper around a copy of some entries, such as a mount's metadata cache, sees only some of the names and stores the count it is given. UpdateEntry refuses to give a name that holds a hard link another link id that no file has yet (refuseSecondHardLink). The mount sends a file's first link's update as a unary RPC, which keeps that refusal apart from an I/O failure, reads the entry again and links under the id the file has by now. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * filer: take a replicated update's link id without refusing it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: look a path-specific name up outside the record's transaction Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: check the leveldb open and close it in the hard link test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: send a refused first link again from the entry as stored Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: keep a first link's refusal over the next filer's error Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: count a hard link's names next to the clients' count instead of in its place The filer's count replaced the one clients send, which lost two things that count did by being worked out ahead: - A link's first write, the update of the source, carries the count with the new name in it already. While the second write is on its way that kept a delete of the source from being taken for the delete of the file's last name (lastLinkDropped goes by the count it read), and the chunks from being deleted under the name about to come. Counted only when it arrived, the new name was stored with chunks that were gone: 104 of 300 rounds of a mount linking a file while another deletes it. - A write of a name the store refused had counted the name already, and sent again counted it once more. The filer now keeps its count of the names in a key of its own next to the record (linkNames), written once the name is stored, and the record gets whichever is higher: the count the client sent or the names counted. It is never lower than what the client alone would have left, and never lower than the names the file has. A record from before has its count recorded as the names when it is first written again. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * mount: send a refused first link again with the file's inline content The second attempt builds the new name's create from the entry as the filer has it by now: attributes, chunks and extended attributes. A file the filer keeps inside its entry has its bytes in Content, and the create is what the filer writes the link's shared record from, so without them the record lost the file's content. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * filer: store a path-specific name before the record's lock is let go A second create of the same new name on this filer took the lock between the first one's count and its name write, missed the name, and counted it again: the file's record and chunks then outlived its last name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep a link's names key out of the keys of a directory's entries The key began with the link's random id. One that began as the root's entry keys do in a store keyed by path put the names' 4 bytes in the root's listing, and it failed to decode: listing / and the etcd scan under fsck failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: record a hard link's name before it is stored, and take it off if it is not The names counted for a hard link were recorded once the name was stored. On a store without transactions a failure of that write left the name stored and not counted, and the write sent again found the name there and did not count it either: the names recorded stayed one below the names stored, the side a file is deleted under a name from. They are recorded first now, inside the change of the record that counted them, and a name the store then does not take is counted off again (storeCountedName). A failure halfway leaves them one above the names stored, and the file leaked. A name in a path-specific store is recorded with the record as well, and counted off in a change of its own. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * filer: keep a hard link's name counted when a failed write stored it A write whose deadline passes after the store took the name returns an error, and counting the name off then left the names one below the names stored. A later write with the count from before the link lowered the record to them, and the file was deleted under a name it still had. Read the name back first, and keep it counted where that cannot be told. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: carry the stored RemoteEntry into the name a retried first link adds The retry rebuilds the new name from the entry the file has once another client linked it, but kept the RemoteEntry of the entry first read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
fb0a734dc4 |
feat(remote_storage): add Yandex Disk as a remote storage backend (#13012)
* feat(remote_storage): add a Yandex Disk backend Yandex Disk joins s3/gcs/azure as a remote storage type, so it can back remote mounts and sink replication (filer.remote.sync, filer.remote.gateway) without a separate sink. The Disk API has no buckets and no place for a file's mtime: a top-level folder under yandex_root plays the bucket, and the entry's modification time and content encoding travel as custom resource properties (seaweedfs_modified, seaweedfs_content_encoding; rclone_modified is read too). The client also handles the API's asynchronous operations (202 + operation polling), the short-lived, single-use download links (a fresh link per read and per retry), single-PUT uploads, mkdir -p of an S3-style key's parents, server-side copy for a remote-only rename, and a ranged read that refuses a short body. A caller-supplied endpoint goes through the guarded client like the s3 and azure endpoints. * feat(shell): configure and issue Yandex Disk tokens remote.configure gains the yandex flags (token, client_id, client_secret, root, trash, app_folder, endpoint). A refreshable token is issued in two steps without a browser on the server: -yandex.oauth_url prints the authorization url and keeps the app credentials, -yandex.code exchanges the copied code for a token and stores it. The token and the client secret are masked in the configuration listing. docs/remote-storage-yandex.md walks through the OAuth app, both token flows, the mount and replication commands, and the platform's limits. * fix(remote_storage): handle missing Yandex folders on stat, copy and upload A missing object is confirmed against the bucket folder rather than its immediate parent, as the gcs client does: a key whose subfolder does not exist yet (a rename destination) is a missing object, not a vanished mount, and the sync only proceeds on ErrRemoteObjectNotFound. CopyFile creates the destination's parent folders, so a remote-only rename into a folder the remote does not have yet succeeds. The Disk API answers a missing parent with 409 DiskPathDoesntExistsError; upload and copy treat it like a 404, and the fake answers the way the API does. An operation poll refreshes the token once on 401 and then fails, instead of polling without a pause until the operation deadline. * fix(remote_storage): retry a locked Yandex resource A folder that is still being deleted asynchronously answers a write with 423 DiskResourceLockedError for a moment. The client now retries it with the same backoff as 429/5xx/509, and the error stays transient for the sync's upload retry when the client's retries run out. * fix(remote_storage): harden the Yandex backend after review Traverse reports objects only, like the s3, gcs and azure clients: its callers (remote.cache, remote.copy.local) read the stamp of every entry, and a folder came with none. Deletes no longer reach what they were not meant for. A Disk API delete is recursive, so DeleteFile keeps a folder that took a file's place on the remote, and DeleteBucket removes an empty bucket folder only, the rule S3 and GCS apply to a bucket. CopyFile keeps the destination until its replacement exists: it copies with overwrite and removes the old object (to the trash when configured) only when the service kept it anyway. It refuses to replace a folder, treats a copy onto itself as done, and carries the source's resolved modification time, including rclone_modified and the service's own time. Every metadata request and operation poll has a deadline that covers reading the answer, and a token refresh or code exchange has its own, so a stalled endpoint cannot block the client. Redirects are checked like the transfer links, an endpoint that would send the token over plain http is refused unless it is on a loopback host, a 202 without an operation link is an error, and a read with an offset and no size starts at the offset. * chore(seaweed-volume): keep only the Yandex fields in the remote.proto copy * yandex: retry a failed operation poll One throttled, failed or timed-out status poll ended a wait of up to 30 minutes while the operation kept running on the service, so a large delete or copy was reported failed and redone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * yandex: refresh a token once for concurrent 401s Every request rejected with the same access token replaced the token source, so N concurrent 401s refreshed, and rotated the refresh token, N times. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * yandex: retry an operation poll whose answer was cut short A status poll that got its 200 headers but lost the connection before the JSON body ended failed with io.ErrUnexpectedEOF, which the poll retry did not treat as transient, so the wait ended while the operation kept running. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Konstantin Lebedev <whitefox@mayflower.work> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
5e796fa985 |
mount: keep a file's inline content when it is written to or resized (#13009)
* mount: keep a file's inline content when it is written to or resized A small file the filer keeps inside its entry (-saveToFilerLimit, or ?saveInside=true on the upload) has its bytes in the entry's content and no chunks. A mount dropped the content at the first write to the file, or copy into it, and published the write's chunk alone: the bytes the write did not cover read as zeros from then on, for an append as for two bytes in the middle. A change of size left the content as it was. Grown, the file read no further than its content on the mount and as zeros through the filer; cut and grown again, it had the bytes that were cut off back. The content now becomes a write of the handle's own, older than the one about to change the file, and is flushed with it as a chunk (bufferInlineContent: Write, CopyFileRange, Fallocate). SetAttr cuts it to a smaller size, and stores it as a chunk before the file grows past it (resizeInlineContent). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * mount: store resized inline content in chunks of the mount's chunk size A file that grows past its inline content had the content stored as one chunk, whatever its length, where a buffered write is split at the mount's chunk size: content longer than a volume server takes in one upload could not be stored, and the file could not grow. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> --------- Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> |
||
|
|
bd1f24a09b |
mount: carry a file's inline content into the name a hard link adds (#13008)
* mount: carry a file's inline content into the name a hard link adds A small file the filer keeps inside its entry (-saveToFilerLimit, or ?saveInside=true on the upload) has content and no chunks. To link it a mount updates the source and creates the new name, and the filer writes the link's shared record from each of the two. The create carried the source's attributes, chunks and extended attributes but not its content, so the record was left with a size and nothing behind it: both names read zeros from then on, through the mounts and through the filer. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * mount: carry a remote-only file's RemoteEntry into the name a hard link adds A file under a remote mount that is not cached yet has no chunks and no content; its RemoteEntry is what sends a read to fetch the object. The create of the new name left it out, so the hard link's shared record lost it and both names read zeros. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: cache a remote-only file before a hard link gives it a new name The filer resolves a remote object from the name a read goes through, and the new name has no object of its own, so a read through it failed until the source name had been read. The link now has the filer cache the object first, so every name shares its local chunks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: cache a linked remote-only file through its open handle The cache moved the stored entry off the base of a handle open on the source, so the handle refused the link change and its next flush failed. A handle with buffered writes now publishes them first, and the cache goes through the handle as a read does, which moves its base along. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
8abfdf1e21 |
s3: abort in-flight requests whose access is revoked (#12986)
* s3: abort in-flight requests whose access is revoked S3 checks access when a request starts, so a download or upload that started before an identity, policy or bucket policy change runs to its end. With -s3.abortRevokedRequests the gateway re-checks the requests it is serving after such a change and aborts the ones now denied: an HTTP/1.x request has its connection closed, an HTTP/2 request is canceled. The re-check looks the identity up again and repeats only authorization, not the signature check, so clock skew or an expiring presigned URL never cuts a long transfer. Off by default. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * s3: check revoked requests against whole reloads and configured identities - A re-check pass holds reloadMu, so it never sees identities installed before their policies are synced. - STS and JWT sessions are not tracked: re-validating their token checks its expiry, which a re-check cannot tell from a revocation. - A request whose access changed while it was being admitted is checked again once it is tracked. - The identity source comes from how the request authenticated, and a rotated secret revokes the requests signed with the old one. - An aborted HTTP/2 request also has its body closed. - Browser form uploads, which their handler authorizes, are not tracked. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * s3: track SigV2 requests that carry a session token SigV2 never reads a session token, so a configured key that sent one was classified as a session and skipped the re-checks. Only SigV4 resolves a token, and it marks one it tolerated for a configured key ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: let the admission-race test pass only through the generation check The re-check that the change schedules could run after the request was tracked and abort it, so the test passed without the generation check. Wait for that pass to take its snapshot before the request starts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: drop the executable bit from the revocation test file Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: bump the re-check generation before its scope can be taken scheduleRevalidation released t.mu before bumping the generation. A pass already kicked could take the new scope in between, before a request was tracked, and that request then saw the old generation and was never checked again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: judge a re-checked request as of when it was admitted A re-check evaluated aws:CurrentTime and a key's expiration at the time of the pass, so an unrelated change aborted a transfer whose time-bounded grant expired after it started. The re-check's copy of the request now carries its admission time, which RequestConditionValues uses for aws:CurrentTime and aws:RequestTime, and a key's expiration is compared with it too. A test covers a revoked HTTP/2 upload: closing its body releases the blocked read, and a download on another stream of the same connection runs to its end. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * stats: let http.ResponseController reach the writer under StatusRecorder Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: reset a revoked HTTP/2 request's stream A deadline in the past resets only that stream, so a download blocked writing to a client that stopped reading is released too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: keep in-flight requests when their key's secret is rotated A new secret for the same access key is a rotation, not a revocation. Removing or deactivating the key, or losing the grant, still aborts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: always abort in-flight requests whose access is revoked Drop -s3.abortRevokedRequests: the gateway tracks the requests it admits and re-checks them on every change that can revoke access, so a revoked client's transfers stop without a restart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: a catch-up re-check does not advance the revocation generation A request tracked after an access change scheduled its bucket's re-check through the same path as the change, which advanced the generation again. A request that began authenticating before that advance then scheduled another bucket-wide re-check, so overlapping admissions could keep the re-check loop busy, holding reloadMu, with no access change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
802be6dd7b |
volume: vacuum keeps a needle's own unexpired TTL and checks against an independent index tally (#12987)
* volume: vacuum keeps a needle's own unexpired TTL on a volume without TTL Vacuum measured a needle's expiry against the volume TTL. On a volume without TTL that is zero, so every needle carrying its own TTL was dropped by the first vacuum while reads still served it. Fall back to the needle's own TTL and append time, the rule reads use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): vacuum applies a needle's own TTL on a volume without TTL Rust vacuum kept every needle with its own TTL on a volume without TTL, even long after reads stopped serving it. Use the read path's expiry rule there, matching the Go vacuum. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: check vacuum against a tally taken while loading the index The compacted-size check summed its expected bytes inside the loop that copies, so an entry the traversal never visited was missing from both sides and the check could not see it. Tally the live entries while replaying the .idx rows, count every copied, expired and unreadable needle, and fail when they do not add up to the snapshot. The explicit accounting also covers volumes with a TTL, so they are checked too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): check vacuum against a tally taken while loading the index Mirror the Go change: tally the live entries while replaying the .idx rows, count every copied, expired and unreadable needle, and fail when they do not add up to the snapshot, on volumes with a TTL too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: treat a TTL flag without TTL bytes as no TTL A record can set the TTL flag and end before the TTL field, leaving Ttl nil. Checking such a needle's own TTL panicked in reads and, now, in vacuum on volumes without TTL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: log each TTL-expired needle vacuum drops Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): log each TTL-expired needle vacuum drops Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e13f36275b | filer: rename a directory that holds a hard link on SQL stores (#13001) | ||
|
|
432826f1b2 | filer: allocate the interval points of readResolvedChunks at once (#12995) | ||
|
|
37c0b2f162 |
webdav: store a real md5 for each uploaded chunk (#12988)
* webdav: store a real md5 for each uploaded chunk Chunks written through the shared gateway uploader had no md5, so the file ETag was built from empty digests: every overwrite of a multi-chunk file kept the same ETag (If-None-Match answered 304 for new content) and single-chunk files had no ETag at all. Ask the uploader for Content-MD5, as mount and filer.copy already do. * webdav: quote the ETag it serves DAV:getetag and the ETag header must be entity-tags. A bare digest never matches a client's quoted If-None-Match or If-Match in http.ServeContent, and single-chunk files now carry a digest instead of webdav's quoted fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: serve no filer ETag built from chunks without digests Files written before chunks carried an md5 all hash to the md5 of empty digests plus their chunk count, so unrelated files with as many chunks share one tag and a conditional GET can answer 304 for changed content. Leave the tag to webdav's modtime and size fallback for those. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: answer a PUT with the ETag of the content it committed webdav.Handler stats the file before Close uploads the last chunk and updates the entry, so every PUT answered the empty created entry's tag and an If-Match with it failed against the stored file. Close now records the committed entry's tag on the PUT outcome and the response writer sends it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: serve no filer ETag for inline content without an md5 filer.ETag hashes only the chunk list, so every inline entry without Attributes.Md5 gets the empty-list tag. Fall back to webdav's own tag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: upload the PUT test's chunk during Close Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: tag inline content without an md5 by its bytes The modtime+size ETag webdav derives matches two equal-size contents stored in one second, so a replace could answer 304. util.Md5 follows the cluster's digest, which fips140=only keeps off MD5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: tag chunks stored without digests by their file ids The modtime+size ETag webdav derives matches two equal-size files stored in one second. A rewrite stores new chunks, so their file ids and placement tell contents apart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
a5e52b68f1 |
server, filer, s3: log downloads the client hung up on below error level (#12991)
* server: log a response the client hung up on below error level A client that closes a download early (a video player seeking, a browser cancel) fails the next response write with a broken pipe, a connection reset, or an HTTP/2 stream close, and ProcessRangeRequest logged each one as an ERROR. net/http cancels the request context once a write to the client fails, so a canceled context now logs at V(3); a failure under a live request still logs as an error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: log a stream the client hung up on below error level The filer logged "failed to stream content" as an ERROR for every download a client closed early, next to ProcessRangeRequest's own line. It now goes through the same check, so only a failure under a live request reaches the error log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: log a GET the client hung up on below error level A client closing a download early made GetObject log two ERROR lines, from streamFromVolumeServers and from GetObjectHandler, and the SSE copy paths logged a third. The write fails with a broken pipe or connection reset rather than context.Canceled, so the canceled-stream check missed it. net/http cancels the request context once a write to the client fails, so streamCanceled also treats a canceled request as the client leaving. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: log a canceled chunk read below error level A ranged S3 GET reads through ChunkReadAt with the request context, so a client hanging up cancels the chunk fetch and the reader logged "fetching chunk ...: context canceled" (and, when the lookup was the step canceled, "operation LookupFileId ... failed") as an ERROR. A read whose caller canceled it now logs at V(3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
7da99cd760 |
sts: honor the provider role mapping for web identity roles it names (#12982)
* sts: honor the provider role mapping for web identity roles it names AssumeRoleWithWebIdentity only checked the role's trust policy, so with trust policies that allow the provider without claim conditions any token from that provider could assume any of its roles, including ones the provider's roleMapping assigns to other claim values. Bearer auth already uses the mapped roles. A role named by the mapping (a rule or the default role) is now issued only to tokens the mapping gives that role; roles the mapping does not name keep the trust-policy-only check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sts: trim role mapping targets when checking which roles the mapping names Bearer auth trims mapped roles, so a padded target still assigns that role; without the trim the web identity check treated the role as unnamed and left it to the trust policy alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sts: compare the provider's mapped roles as a list, not a comma-split string The OIDC provider joins mapped roles with commas, and role names may contain commas, so splitting the joined attribute could match a piece of one mapped role against a different role, or miss the mapped role. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sts: check the session role in the web identity role mapping test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
7638cf2f66 |
mount: keep the data past a sparse file's first hole when merging chunks (#12978)
* mount: merge each run of a sparse file's data, not just the run before its first hole The chunk stream reader ends at a hole, so the merge stopped there and replaced every chunk with ones covering only the data before the first hole. Read and save each contiguous run of visible data on its own, and leave the holes between runs unwritten. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: skip the small-chunk merge for a sparse file The merge reads the chunks through the stream reader to its end, which stops at a hole, and keeps only the chunks before its start offset, so an append to a sparse file lost the data past the first hole after it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
1815f140b6 |
fips140=only: refuse JWT signing keys and S3 secrets too short for HMAC (#12912)
* fips140=only: refuse HMAC keys too short for FIPS mode where they are configured Under GODEBUG=fips140=only, hmac.New panics on keys shorter than 112 bits (14 bytes). A short JWT signing key starts fine and then kills weed server on the first write (the master's Assign mints a volume JWT in an unrecovered gRPC handler), and an S3 secret of 8 or 9 characters (the SigV4 signing key is HMAC keyed with "AWS4"+secret) makes every request from that identity panic in its handler. Only under crypto/fips140.Enforced(): - security.toml: LoadSecurityConfiguration exits with an error naming the setting when a jwt.signing / jwt.filer_signing key, read key or previous key is under 14 bytes. LoadFilerJwtFromFile (filer.sync -a.security/-b.security) returns the same error, and Guard.UpdateSigningKeys keeps the keys in effect on a reload that brings in a short key. - S3: SigV4 (header, presigned, streaming seed and POST policy) answers InvalidAccessKeyId, as for an inactive key, when the credential's secret is under 10 characters, and logs the access key. Loading such a credential logs a warning; it stays loaded and stored. - IAM CreateAccessKey (IAM API, embedded IAM, admin UI) requires a caller-supplied SecretAccessKey of at least 10 characters. Refs #12839 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fips140=only: check jwt.filer_signing.subscribe.key and the imgproxy key too The filer verifies metadata subscription tokens with jwt.filer_signing.subscribe.key and `weed shell fs.meta.token` signs them with it, so under GODEBUG=fips140=only a short value panics on first use; LoadSecurityConfiguration now refuses it with the other JWT keys. `weed image` signs imgproxy URLs with HMAC keyed with IMGPROXY_KEY; gateway.New refuses a key under 14 bytes in that mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: warn about JWT keys too short for fips140=only outside that mode Outside GODEBUG=fips140=only a JWT signing key under 14 bytes works, so LoadSecurityConfiguration (every weed command but fuse) and LoadFilerJwtFromFile now log a warning naming the setting instead of saying nothing: such a key is refused under fips140=only, and a future release may refuse it in every mode, so the warning asks for a rotation to a longer key with previous_key while it still works. A short previous_key holds the old key during that rotation, so its warning only asks to clear it afterwards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: refuse a short secret under fips140=only with AccessDenied, not InvalidAccessKeyId InvalidAccessKeyId says the access key does not exist, so a client refused for a secret too short for fips140=only went looking for a missing key. The new ErrFips140SecretTooShort answers AccessDenied (403) with "This access key cannot be used while the server runs in FIPS 140 mode. Ask the administrator for a new secret." The message leaves out the length rule: the refusal comes before the request's signature is checked, so any caller that knows the access key ID would learn the secret is short. The embedded IAM API maps it to AccessDenied as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: log an S3 secret too short for fips140=only at error level Under GODEBUG=fips140=only every request signed with such a key is refused, so the identity is unusable; the load-time message is an error, not a warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util, security: name every JWT key too short for fips140=only in one error CheckFips140SigningKeys stopped at the first short key, so a cluster with two short keys failed at startup, was fixed, and failed again on the next one. CheckFips140HmacKeys checks every setting and names each short key ("jwt.signing.key is 10 bytes, jwt.filer_signing.key is 8 bytes; ..."); with one short key the message is unchanged. Guard reloads use it as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fips140=only: say what happened, to what and what to do in the short-key messages The messages about S3 secrets and JWT keys too short for FIPS 140 now start from the process's mode, name the key, its owner or file, the limit, and the fix: - loading S3 identities: "this process runs with GODEBUG=fips140=only, and refuses all S3 requests signed with access key ... (identity ...) because its secret is shorter than the 10 characters FIPS 140 needs for SigV4 secrets; give that access key a new secret of at least 10 characters"; - a refused request logs its request ID, which the client gets back, its client IP (as the audit log records it, s3err.RemoteIP) and the identity; - the startup refusal names security.toml's path and every short key, and links the wiki section on replacing them with or without downtime; - the startup warning outside fips140=only says the server would not start in that mode, and links the same section. A short previous_key no longer gets a warning outside fips140=only: it holds the old key while switching to a longer one, and under fips140=only the startup refusal names it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * security: a reload under fips140=only drops short previous keys, not the new keys UpdateSigningKeys refused the whole key set when a previous key was too short, so a volume server kept its old keys while the filer's volume signer, which gets no previous keys, took the new ones; proxied chunk reads then failed with 401. Short current keys still keep the keys in effect. A short previous key is dropped with an error log instead: nothing under fips140=only can sign with it, so no token is lost, and every server ends up with the same current keys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * security: check only the filer keys filer.sync uses in its security files LoadFilerJwtFromFile checked every JWT setting in a -a.security/-b.security file, so under fips140=only filer.sync refused to start over a short volume or previous key it never uses. It now checks jwt.filer_signing.key and its read key, after the fallback to the process-wide configuration, which startup checks already. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: answer a short secret under fips140=only with SignatureDoesNotMatch A distinct answer before the signature is checked told anyone who knows an access key ID that its secret is short. The refusal now runs where the signature would be checked, after the permission, expiry and signed-header checks, and answers the SignatureDoesNotMatch a wrong signature gets. The server log keeps the cause, the request ID and the client. This drops ErrFips140SecretTooShort and its IAM mapping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * security, filer: keep Basic Auth on a reload whose JWT keys are refused When a reload under fips140=only refused the new filer JWT keys, the filer still removed Basic Auth, so a configuration that switches from Basic Auth to short JWT keys left the filer with neither. UpdateSigningKeys and ReloadSigningKeys now report whether the new keys are in effect, and the filer drops Basic Auth only when they are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util/http: do not install a volume read key too short for fips140=only A reload installed jwt.signing.read.key into the read-signing cache without a length check, so under fips140=only a short key made later chunk reads panic signing with it. loadJwtConfig now leaves the key in effect when the new one is too short. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util/http: keep the volume read key when the volume guard would refuse the reload Under GODEBUG=fips140=only a volume server's reload keeps its keys when jwt.signing.key or jwt.signing.read.key is too short. The read-key cache checked only the read key, so it could sign reads with a key the volume servers had not taken. It now checks the same two keys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: build the short-key list in one append in CheckFips140HmacKeys Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: keep the blank line before the permission check in verifyV4Signature Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: skip TestFIPS140OnlyShortSecret under real fips140=only enforcement 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> |
||
|
|
5b300ea909 |
filer: scope metadata subscriptions to a token's prefixes (#12931)
* filer: scope metadata subscriptions to a token's prefixes * filer: check scoped updates before preparing chunks * filer: recheck scoped WORM policy after chunk preparation * filer: preserve scoped event parents and recheck update authority |
||
|
|
dd443065fe |
admin: keep stored plugin job data and config from read-only sessions (#12973)
* admin: return compact plugin job detail to read-only sessions Read-only sessions got the stored parameters, labels, description and result output of a job, while job listings already leave them out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: require admin access to read plugin job type config The stored config holds literal values such as the admin script, so a read-only session must not read it, the same as it cannot write it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * plugin worker: log only the command name in admin script activities The activity timeline is readable by read-only sessions, and command arguments can carry secrets; the full command lines stay in the output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: keep only the command name in admin script running activities Activities stored before the worker change, and activities sent by workers that have not been upgraded, still carry full command lines. Reduce them when they are loaded and when they arrive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: redact admin script activities whose report omits the job type A progress report for a tracked job can leave the job type out; use the tracked job's type so the command arguments are still dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: keep a test comment on its test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: require the job-type-less admin script report to be recorded Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: type untracked admin script progress from the pending execution A progress report that carries neither a job type nor a tracked job id still belongs to the execution the admin sent under its request id; use that job type so its admin script activities lose the command arguments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: redact running executor activities whose job type is unknown A report that arrives after its execution timed out or was cancelled can carry only a request id. Its job type cannot be resolved any more, so treat it like an admin script report and keep only the command name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: test the plugin config route on a bare handler in its own file Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: match the unredacted admin script message exactly in the test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
612e170caf |
perf(s3tables): read bucket policy from the listing (#12949)
* s3tables: read bucket policy from the listing ListTableBuckets looked up every listed bucket again to read its policy, which is already on the listed entry: one extra filer lookup per bucket. Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com * s3tables: cancel the list test helper's context The handler stops reading the filer listing once a page is full, so a call made with a context that is never cancelled leaves that stream open until the connection closes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3tables: drop the list tests' note about master Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
dbc64144ca |
mount: support NFS re-export file handles after inode eviction (-nfsExport) (#12979)
* mount: update go-fuse for the export support option Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: optionally retain the paths of forgotten inodes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: answer lookups of "." and ".." for file handle decoding Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: add -nfsExport to negotiate export support and retain forgotten inodes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: test file handle lookups of "." and ".." Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: fail a file handle lookup when its path now holds another file A "." lookup resolved a forgotten inode by its remembered path, so a file created at that path since was served to the old handle. Compare the entry's inode with the handle's and answer ESTALE on a mismatch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: register a file handle's inode under the table lock A "." lookup checked the file at the remembered path and then registered it with Lookup, which hands back whatever inode holds the path by then. LookupHandle takes the reference on the handle's own inode, or enters it at the path only while no other inode holds it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: keep a forgotten inode's retained path across a rename A rename whose source inode the kernel had already forgotten left the retained path at the old name, so its file handle failed with ESTALE. An index from retained path to inode lets MovePath move it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: register a file handle only at its current retained path A rename between resolving a forgotten inode's path and registering it moved the retained entry, yet LookupHandle still entered the old path. It now compares the path with the retained one under the table lock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: drop the target a forgotten inode is renamed over Moving a forgotten inode's retained path onto a live name left the replaced inode mapped there. Once a retained entry moves, the target is taken apart as for a live source and reported as replaced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: test that a renamed path-inode file fails its file handle closed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * go.mod: use the go-fuse v2.9.5 release Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
7c33a8449f |
volume: check a CRC32C of each chunk upload, in every digest mode (#12999)
* volume: check a CRC32C of each chunk upload, in every digest mode In sha256 digest mode the uploader sends no Content-MD5, so the volume server and its replicas store a chunk without checking that its bytes arrived as sent. The uploader now sends X-Seaweed-Content-Crc32c, the std-base64 of the big-endian CRC32C of the bytes Content-MD5 is checked against (the file data after undoing Content-Encoding: gzip; the ciphertext for ciphered chunks), in both digest modes. Uploads that forward a stored needle (IsReplication) carry only a value the primary volume server checked. The Go and Rust volume servers refuse a mismatch or a malformed value with 400, as they refuse a wrong Content-MD5, and forward the checked value to replicas, which check it again. A gzipped upload without Content-MD5 is checksummed while its size is counted, without holding the uncompressed bytes. Servers that predate the header ignore it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): keep the first part's headers when no part has a filename Go's parseUpload falls back to the first multipart part with its Content-Type, Content-MD5 and Content-Encoding. The Rust fallback dropped them, so a gzipped part without a filename was stored as plain bytes and its X-Seaweed-Content-Crc32c was checked against the compressed body. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): read the RFC 2231 filename* of a multipart part Go's uploader names a part with mime.FormatMediaType, which writes filename*=utf-8''... for a non-ASCII name, and Go's Part.FileName() decodes it. multer reads only filename, so the Rust volume server missed the file part and lost its name, gzip encoding and Content-MD5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: send replicas the CRC32C of a rewritten JPEG Once the orientation fix rewrites a JPEG, the client's CRC32C no longer covers the bytes the primary forwards, so the replica got no checksum. Send the CRC32C of the stored bytes instead, in Go and Rust. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): read filename* only outside quoted parameter values A quoted name such as "note; filename*=utf-8''decoy" split at its semicolon and was taken for the part's filename. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): refuse a decoded filename* with control characters A percent-encoded CR/LF in the name would end the header block of the part the primary forwards to its replicas. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: read the forwarded CRC32C with the replica response in the test A failing assertion left the CRC32C in the one-slot channel, so the next subtest's replica blocked instead of the test reporting the failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): use naïve for the non-ASCII filename test data codespell reads the ASCII part of café as a misspelling of calf. 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> |
||
|
|
c0f3182046 |
filer: run scoped UpdateEntry checks before chunk preparation (#12965)
* filer: check scoped updates before preparing chunks (cherry picked from commit |
||
|
|
d95f5e67fb |
mount: refuse an exclusive create of a name another mount holds (#12966)
* mount: create at the filer only where no entry is stored A create sent to the filer at open time (mknod, and every create under EagerFilerCreate) went without OExcl, so the filer stored it as an update of a file another mount had created there: open without O_EXCL emptied that file and mknod replaced it. Send OExcl, report EEXIST, and drop the cached listing so the reopen finds the stored entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: store an exclusive create at open A create is deferred to the first flush and checks only this mount's view, so two mounts could both open the same new name with O_CREAT|O_EXCL. Send an exclusive create to the filer at open instead, where OExcl refuses the name another mount already stored. Writeback keeps deferring: it assumes one writer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
04b2698db2 |
iam: end a role session's bucket-policy access with its role (#12968)
A bucket-policy Allow skips IsActionAllowed and only asks IsPrincipalActionExplicitlyDenied for an overriding Deny. That check validated the session token and its revocation but not the role ID the session was issued for, so a session kept a bucket policy's grant after its role was deleted or replaced by a role of the same name. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
977a5d26f8 |
iam: match policy resources case-sensitively (#12974)
Object keys and bucket names are case-sensitive, so a statement naming one resource must not cover a key that differs only in case. Actions still match case-insensitively. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
36aea0020e |
weed fix: add -verifyCrc to index needles with damaged data as deleted (#12972)
* fix: add -verifyCrc to leave needles with damaged data out of the index weed fix reads only record headers, so a needle whose data was damaged is indexed and fails on every read. With -verifyCrc it reads each body and checks it; a needle that fails is not indexed, an older copy of its key is not brought back, and fix exits non-zero. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: read each record to verify it, so a read error fails instead of dropping it The scan passes a body buffer even when reading it failed, so -verifyCrc took bytes it never read for damage. Read the record through a handle of its own, drop it only when its bytes are corrupt, and fail the scan on any other read error. -verifyCrc needs the local .dat. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: -verifyCrc rejects a record with a size but no data A needle with no data is written with size 0, and the CRC covers only the data, so a record whose data size was zeroed parsed cleanly and skipped the CRC check. Treat it as corrupt, as the tail repair does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: index a needle that fails -verifyCrc as deleted Leaving it out of the index let loading the volume read the bytes past the last indexed needle as an interrupted append: the older copy of the key came back and the damaged record was cut. Handle it like a delete marker, so with -includeDeleted its tombstone keeps the key deleted and the loader leaves the .dat alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d6a657cd92 |
weed compact -method data: copy past an unreadable record like -method index (#12970)
* storage: resume data compaction past an unreadable record Compacting by data follows record headers through the .dat, so one corrupt header ended the scan: the compaction failed, or, when the header's size jumped past the end, every record after it was dropped. Compacting by index copies past such a record. When the scan stops on a corrupt header or jumps past live records, resume it at each live record the index places further on. A read error still fails the compaction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: do not copy a record whose header size disagrees with the index A live record whose header carries a damaged size was copied with that size, and the compacted volume indexed a needle it could not read. The index records each live record's size, so a header that disagrees is damaged: skip it, and let the scan resume at the next live record. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: verify a live record's body instead of comparing its size with the index Data compaction copied a record whose body failed to parse, and the size check dropped an intact record when only its index row was wrong. Read the body only for the record the index points at, drop it on the same errors -method index drops on, fail on any other read error, and keep the size the record itself carries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: resume data compaction at every live record the scan did not reach The resume started past the last header the scan parsed, so a corrupt size that landed on a later valid header lost the live records it jumped over. Track the records the scan copied or dropped, resume at each live record it did not reach in .dat order, and stop a resumed scan at a record an earlier pass already handled so nothing is copied twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * command: read the compacted volume's version from its super block in tests Compaction can write a different needle version than the source volume, so parse the .cpd with the version it records instead of the current one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: do not walk a run of damaged headers again on every resume A record whose header id is damaged is not marked as handled, so each resume at one of a run of such records walked the rest of the run before reaching a copied record, which is quadratic in the run length. Remember the offsets resumed scans pass, skip resuming at them, and stop a resume when it reaches one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: count the resumed scans' reads in the damaged-run test The kept keys come out the same when every resume walks the rest of the run, so bound the reads made through the volume's data backend instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: drop a record whose header size runs past the end of the .dat Reading such a record sized its buffer from the corrupt header: a size near 2 GiB allocated that much on 64-bit and panicked in makeslice on 32-bit. Check the record end against the file size first and drop the record as unreadable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * needle: compute ReadBytes slice bounds in int NeedleHeaderSize+size was Size arithmetic and wrapped for a damaged size near MaxInt32, so the slice panicked instead of failing the read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * needle: fail ReadNeedleBlob for a size that does not fit in an int On 32-bit a damaged size near MaxInt32 made the buffer length negative and panicked in makeslice. Return ErrorSizeInvalid instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * needle: compare DataSize bounds in uint64 On 32-bit builds int(DataSize) is negative for a damaged DataSize of 0x80000000 or more, which passes the bounds check and panics on the slice instead of returning ErrorCorrupted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
0f6e07c4d0 |
s3api: refuse a marker delete on a stored version's physical path (#12981)
* s3api: refuse a marker delete on a stored version's physical path A delete of "<key>.versions/v_<id>/" was answered AccessDenied only when the version file held neither chunks nor remote data, and since the check for a file rather than a directory moved to the front, not even then: the delete reported success. The version-file check now runs first, as it does for the same key without the slash. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: test a marker delete on a chunked version file Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
9ffb5fe185 |
filer, s3, filer.sync: one digest per cluster, set by the filer's -digest and followed by its clients (#12913)
* util, filer: choose the digest at filer startup with -digest
NewMd5 and NewSha1 returned SHA-256 cut to size whenever the process ran
under GODEBUG=fips140=only, so the kind of digest a cluster stores followed
each process's own environment. They now follow a digest mode set once at
startup: util.SetDigest("md5"|"sha256"), or "" to keep following
fips140.Enforced(). The default is unchanged.
weed filer -digest, weed server -filer.digest and weed mini -filer.digest
set it; fips140=only refuses md5 at startup. The leveldb2/leveldb3
directory-key marker follows the mode, as do the places that compare a
NewMd5 digest with Content-MD5 or pass it on as one: S3 PutObject, filer
HTTP uploads, the Content-MD5 the filer returns, and the uploader's
Content-MD5 to volume servers. Places that verify Content-MD5 with a real
MD5 (volume servers, S3 request bodies and archive uploads) keep keying on
fips140.Enforced(), since they can check it whenever MD5 is available.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer, command: report the filer's digest and make its clients use it
GetFilerConfigurationResponse carries the filer's digest mode in a new
field 16, digest. weed s3, mount, webdav, sftp, iam and filer.copy adopt
it before they serve or write, so a gateway started with a different
GODEBUG writes the same kind of ETag and chunk digest as the rest of the
cluster. A process under fips140=only refuses a filer that reports md5. A
filer that reports no digest predates the field; the client then keeps
its own mode and logs a warning.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer.sync, s3 sink: keep digests within one kind
filer.sync copies entry digests and ETags as they are, so syncing a filer
with digest sha256 into one with md5 left SHA-256 ETags in the md5
cluster. It now reads both filers' digests and refuses to start when they
differ, with a warning when either filer does not report one.
The S3 sink sent the entry digest as Content-MD5 unless its own process
ran under fips140=only. From a sha256 source into a target that checks
Content-MD5 every single-part upload failed with BadDigest and the backup
retried it forever. It now asks the source filer for its digest once and
forwards the entry digest only when that is md5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer.meta.backup, filer.backup, filer.replicate: keep digests within one kind
filer.meta.backup opened its backup store in its own digest mode, so a copy
of a sha256 filer made by a process outside fips140=only got MD5 directory
keys and could not be opened as that filer's store. It now adopts the source
filer's digest before the store opens.
filer.backup and filer.replicate with a filer sink copied entry digests into
the target filer without comparing digests, as filer.sync did before. Both
now refuse, and exit, when the source and target filers report different
digests. replication.CheckDigestsMatch is the shared check; filer.sync uses
it too.
weed server and weed mini apply -filer.digest before they start the master
and volume server, so every part of the process hashes with one digest.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer, filer.sync: refuse a peer filer with another digest; exit on mismatch
Filers peering through the meta aggregator now compare digests. A peer with
a store of its own would replay entries holding the other kind of digest
into this filer's store, so its changes are refused and the reason logged
on every reconnect. A fresh filer bootstrapping from such a peer refuses the
copy, so a new filer whose digest differs from the existing filers' exits at
startup. A peer on the same store writes into it directly, and refusing its
stream would only starve this filer's subscribers, so that mismatch is
logged as an error and the stream kept.
filer.sync exits with status 1 when the two filers use different digests,
as filer.backup and filer.replicate do: it is a configuration error a
restart cannot fix.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: -digest help says a store keeps the digest it was created with
The help text said existing data keeps the digest it was written with,
which reads as if the flag could be changed on a store with data. Stores
that hash keys stop finding existing entries under another digest, so the
text now says to set it when the store is created, and that switching means
copying the metadata into a new store with fs.meta.save and fs.meta.load.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer, s3, replication, admin, iceberg: address review of the digest checks
- A filer checks its peers' digests on every start, not only at the fresh-store
bootstrap: the store signature is written when the store opens, so a fresh
filer refused at bootstrap restarted as an initialized store and served
without its peers' files.
- Under digest sha256 with MD5 available (not fips140=only), a client's
Content-MD5 is checked against a separate real MD5 of the body, in S3 object,
part and directory-marker uploads and in filer HTTP uploads. It goes
unchecked only when no MD5 can be computed.
- filer.backup and filer.replicate exit only on a DigestMismatchError; a filer
that cannot be reached is retried, so a backup started before its target is
up resumes once the target answers.
- The admin file browser and Iceberg compaction write chunks into a filer they
do not follow at process level. They read that filer's digest and pass it to
the chunk upload (ChunkedUploadOption.Digest), so their content and chunk
digests match the filer's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer, s3 sink: retire digest-refused peers; no Content-MD5 for an unknown digest
- A peer refused for its digest counts as unreachable: the check now runs
before notePeerReachable and its error wraps errPeerUnreachable, so the
subscribe loop retires the peer from the low watermarks after the usual
grace instead of keeping its zero watermark, which held every aggregated
subscriber at the settled horizon.
- When the source filer's digest cannot be read, the S3 sink no longer sends
the entry digest as Content-MD5: it may be a SHA-256 digest the target
would reject.
- TestCheckPeerDigest skips the cases that need MD5 locally under
GODEBUG=fips140=only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* iceberg, util: tests for the per-filer digest
The Iceberg tests' fake filer serves GetFilerConfiguration, which uploads now
call to read the target filer's digest; it reports none, as a filer that
predates the setting does. TestNewContentMd5 computes a real MD5, so it skips
under GODEBUG=fips140=only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: bound each startup peer digest read with a timeout
CheckPeerDigests read each peer's configuration with the caller's context,
which at startup has no deadline, so a peer that accepted the connection but
never answered held the filer's startup. Each read now has its own
peerDigestReadTimeout (10s, inside the one-minute announce cap), after which
the peer is logged and skipped like an unreachable one.
setDigestForTest restores the previous digest setting instead of the default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* util, s3, filer: one-shot digests for data held in memory
Md5For hashes with md5.Sum or sha256.Sum256 instead of writing into a
hash.Hash, and the Content-MD5 checks of S3 directory markers and of filer
uploads saved inside the filer use BodyMd5Of on the bytes they already hold.
Streaming uploads keep their io.TeeReader.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: hash Content-MD5 on the upload's digest hash, not on its body
teeContentMd5 wrapped the request body in a TeeReader before
uploadRequestToChunks. CodeQL's go/reflected-xss query follows the body
from r.Body through the chunk upload to upload_content.go's
w.Write(prepared.data), which it resolves to the response-writer
wrappers in s3vectors, s3tables, webdav and server/common.go. Those
flows exist on master from other sources (extract, tagging, the
multipart POST); the wrapped body put them through lines this PR
changed, so CodeQL reported six of them as new.
newUploadHash now builds the digest hash that uploadReaderToChunks and
the inline-append paths already tee the body into, and adds the
separate MD5 there; uploadBodyMd5 reads it back for the check. The body
reaches uploadRequestToChunks as on master. Behaviour is unchanged:
under digest sha256 with MD5 available, Content-MD5 is checked against
the body's MD5, including empty and inline appends.
Checked with CodeQL 2.27.6 (go-queries 1.6.16, ReflectedXss.ql) on this
tree: no flow of the nine reflected-XSS results passes a changed line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* replication: keep the ReadFilerSignature name and return the digest with it
Renaming it to ReadFilerSignatureAndDigest left its other callers with an
undefined function. Keep the name and add the digest to what it returns.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* util: keep HashToInt32 off the digest mode
HashToInt32 names things that processes derive on their own, such as a
mount's local socket path and MQ partition key hashes. weed mount adopts
a -digest=sha256 filer's digest before it names its socket, while
weed shell mount.configure keeps md5 and dialed a different socket.
Follow GODEBUG only, as before the digest setting.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer.meta.backup: wait for the source filer's digest instead of exiting
A backup with a saved offset used to start its stream loop and retry
until the source filer answered. Reading the digest first made it exit
when started before the filer. Retry the read; exit only when the
digest is refused.
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>
|
||
|
|
1ddc01d93f |
filer: match the read-only rule on the entry path a write lands on (#12969)
* filer: check the read-only rule on the path a POST or PUT writes A write to an existing directory without a trailing slash stores the entry under it (the multipart file name, or the base name on PUT), but the read-only rule was only matched on the request path, so a rule on the directory's slash-terminated prefix did not apply. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: check the read-only rule on the copy destination entry Copying into an existing directory stores the entry under it, so match the read-only rule on that final path rather than only the request path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: check the read-only rule on the path saveMetaData persists saveMetaData resolves the target path with its own directory lookup, so a directory created after the early check could still route the entry under a read-only prefix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
79ddcb49e6 |
filer: send a delete that misses locally to the write owner (#12967)
* filer: record which peers share this filer's store Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: send a delete that misses locally to the write owner Exclusive and conditional creates are stored on the path's write owner. With separate filer stores, a delete sent to another filer before it has replayed the create found nothing, reported success, and left the entry on the owner, from where it replicated back. Such a delete now goes to the owner, unless the owner runs on this filer's store. A forwarded delete is applied only by the filer its own ring names as the owner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: delete a directory marker on its write owner The marker is read on the key's write owner, but the delete went through the connected filer. When the marker still has children, the filer refuses the delete and the marker is demoted by a lookup and an update on that same client. A connected filer that has not caught up with the owner misses the marker there and reports success, so the owner keeps listing the key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: also delete a directory marker on its prior owner While a ring change is in its cooling-off window, the routed read can find the marker on the key's prior owner before it reaches the new one. The delete went only to the new owner, so a nonempty marker was demoted on a filer that did not have it, and the prior owner kept listing the key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: check a directory marker on the prior owner before deleting it there The prior owner's delete ran unchecked and through the failover walk. When the new owner held an empty marker and the prior owner already held the object without the slash, the delete removed that object's data. And when the prior owner could not be reached, another filer reported the delete done while the marker stayed on the prior owner. The prior owner's entry is now read on that filer and judged like the routed one before anything is deleted, and its delete runs on that filer only. A prior owner that cannot be read fails the delete for the client to retry, which lasts at most the ring's cooling-off window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: probe a marker's prior owner when its write owner misses A miss on the write owner returned success before the prior owner was checked, so an unreachable prior owner that still held the marker left it in place behind a reported delete. The miss now falls through to the prior-owner probe, which fails the delete when that filer cannot be read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: check the entry a marker delete removes on the filer it runs on The read that decides the delete can be answered by another filer than the delete: the owner write walk fails over when the owner's channel does not come up. Each delete now reads its filer's own entry first and leaves an entry holding uploaded data alone, as the routed read already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: send no marker delete to a filer that misses the marker A filer that misses passes the delete on to the key's write owner, which applies it without the marker checks and may hold uploaded data under the key. The delete now runs only where the entry was checked; a miss on an entry the read found fails the delete for the client to retry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: leave the object without the slash alone when deleting its marker A marker delete removed the entry unless it carried chunks or remote data, so the object "dir" stored inline, or empty and known only by its promotion mark, went with a delete of "dir/". A plain file or a prefix object holds the key without the slash, as reads already treat it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
64cc7f5142 |
filer: break two reader cache budget deadlocks that wedge mount reads (#12950)
* filer: free a closed file's chunks for a download waiting on the budget A weed mount stopped answering reads for three days. Its goroutine dump: 351 downloads waited in ReaderCacheBudget.reserve, all 31 releases sat in SingleChunkCacher.destroy waiting for one of them, all 100 reads waited for one of them as well, and a few goroutines spun in reserve's eviction loop. The stuck reads filled the 128 FUSE background slots, so every read of the mount blocked. Closing a file runs ReaderCache.destroy, which takes the file's chunks out of the map and then destroys them one at a time. When it reaches a download waiting for budget first, it waits for that download, and the budget the download needs can be held by the file's other chunks, which are out of the map as well: - Eviction skips a finished chunk that is out of the map. removeUnpinned refuses it, so reserve puts it back on the idle list and retries at once. When a stream is positioned in it, remove() does nothing, so reserve only takes it off the idle list. - A download that fails is never evictable, and a download destroy() cancels fails too. remove() does nothing for one that is out of the map, so its reservation stays until destroy() reaches it. Since #12616, destroy() cancels the waiting download when nothing reads it. It does not when a stream is positioned in the download because the read that started it gave up, for example because its process was killed: closing a ChunkGroup does not release the streams. Eviction now destroys a chunk that is out of its file's map instead of skipping it. Whoever took it out destroys it too, and destroy() is safe to run twice. A download that fails gives its reservation back at once, also when it is out of the map. TestReaderCacheDestroyWhileDownloadWaitsForBudget closes a file while one of its downloads waits for budget, 30 rounds per case. When the waiting download is a prefetch nobody read, the test passes on master. When a stream is positioned in it, it hangs on master, both when the downloads holding the budget are prefetches the close cancels (the release fixes this) and when streams are positioned in them too (the eviction fixes this). TestReaderCacheBudgetStress runs reads (some given up midway), prefetches, failing downloads and close/reopen on four files that share a budget of four chunks; it hangs in 10 of 10 -race runs on master. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: do not wait for a dropped download while holding another chunk A read registers on its new chunk and only then drops the chunk its stream left (unpin, removeConsumed). When that chunk's download had not finished, removeConsumed cancelled it and then waited for it in destroy(), still holding the new chunk. The download could be evicting that very chunk for budget: reserve falls back to a chunk a stream is positioned in, and destroying it waits for its reads, this one included. Neither went on. A dropped chunk whose download has ended is still destroyed at once. One still downloading, cancelled when it was dropped, is destroyed by a goroutine once the download gives up, so the read goes on. TestReaderCacheBudgetStreamsStress moves eight streams between four chunks under a budget of two and gives up a third of the reads midway. In 20 -race runs it hangs 4 times on master and 8 times with only the previous commit, in this cycle; with this change it does not hang. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e22704d25e |
mini: bind Admin and WebDAV to -ip.bind by default (#12971)
weed mini is a single-host sandbox whose other components already listen on -ip.bind without authentication. Moving the unauthenticated Admin UI and WebDAV to loopback broke setups that open them from another machine on a private network. -admin.allowInsecureBind and -webdav.allowInsecureBind now default to true; set them to false to keep an unauthenticated Admin or WebDAV on loopback. The Admin worker gRPC control plane still defaults to loopback. Claude-Session: https://claude.ai/code/session_011UpvahFvcQGAmXWpPrXZY1 |
||
|
|
fe816eaac8 |
mount, filer: stamp merged and manifest chunks instead of leaving them at 0 (#12962)
* filer: stamp a manifest chunk with the newest chunk it folds mergeIntoManifest saved the manifest with tsNs 0, so manifest chunks carried no modification time. Give it the newest ModifiedTsNs of the chunks it holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: stamp merged chunks with the newest chunk they replace maybeMergeChunks uploaded the rewritten chunks with tsNs 0, so any older chunk that overlaps them later, like a covered chunk sent with the commit, outranked the merge. Give them the newest ModifiedTsNs of the chunks they replace. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: stamp a merged chunk with the oldest data it holds The newest stamp of the whole merge outranked a peer's pending write that is newer than the bytes the merge carries for its range but older than the newest of them. Stamp each merged chunk with the oldest visible data in its range, or 0 over a hole, so such a write still shows while chunks older than all of its data lose to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: find a merged chunk's range by binary search Each uploaded chunk scanned the visible intervals from the front. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
928c744977 |
filer: ask the master for log chunks the volume map lacks (#12937)
* filer: ask the master for log chunks the volume map lacks loadLogFileEntries reads the log chunks that SubscribeMetadata and SubscribeLocalMetadata replay from the persisted log, and it looked each chunk's volume up only in the filer's cached volume map. A volume missing there fails with "volume N not found", which isChunkNotFoundError takes for a deleted volume, so the replay skips the rest of the log file. Once the same pass reads a later entry from a file whose volume the map does hold, for any path, the subscriber's position moves past the skipped file, and filer.sync, filer.backup, filer.meta.tail or an S3 gateway never receive its events. A live volume is missing from the map in two cases: - A starting filer serves subscriptions once its gRPC port is up, but gets its volume map only when it registers with the master, and AnnounceOnceCaughtUp holds that until the peers found at startup have caught up (at most a minute). Until then the map holds only volumes the filer has looked up through the master for other reads. - A failed chunk read sets the volume's cached locations aside and looks the volume up again, which a cache-only lookup answers with "not found", as #11964 found for NewChunkStreamReaderFromFiler. Use GetLookupFileIdFunction, which asks the master on a miss, like the streaming reader since #11964 and the replay's other lookups. Asking the master adds one more way to fail: no answer, when the master cannot be reached before the client's retries run out. That error still reads "volume N not found", since no locations are known, but it says nothing about the volume, and skipping would lose the file's events for good. wdclient now marks it with ErrLookupUnanswered, and isChunkNotFoundError does not count a marked error as not found: the replay returns it, and the subscriber resumes from there once the master answers. A volume the master says does not exist is still skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: trim the replay lookup comments 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> |
||
|
|
fc4c7767f8 | admin: make directory paths readable in file browser URLs (#12942) | ||
|
|
800d80ed51 |
remote/s3: WEED_REMOTE_S3_CREDENTIALS=workload, the workload's identity only (#12939)
* remote/s3: WEED_REMOTE_S3_CREDENTIALS=workload, the workload's identity only A remote of type s3 with no access key and no secret takes its credentials from the SDK default chain, which looks at AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY first. A SeaweedFS process often holds keys of its own there: `weed mini` and `weed server -s3` read their initial S3 identity from those variables. On EC2, a remote mounted on an Amazon S3 bucket with the instance's role (no keys) therefore signs with the server's local identity, and every call answers InvalidAccessKeyId, while a filer.remote.sync of the same remote, started without those variables, works with the role. WEED_REMOTE_S3_CREDENTIALS=workload makes such a remote take the AWS workload's identity alone: web identity when AWS_WEB_IDENTITY_TOKEN_FILE and AWS_ROLE_ARN name one (EKS IRSA), then the ECS/EKS container credentials endpoint or the EC2 instance metadata service, on an unguarded HTTP client as the default-chain path already does. Environment keys and shared credentials files are never read. Unset, nothing changes. Keys in the configuration win; half a key pair and an unknown value are refused; other S3-compatible types are not affected. The volume server's client cache key includes the variables that choose the source. * remote/s3: a configured web identity has no instance-role fallback With AWS_WEB_IDENTITY_TOKEN_FILE and AWS_ROLE_ARN both set, a failed token read or role exchange fell through the chain to the container endpoint or IMDS, so requests were signed with the node's role. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * remote/s3: the workload credential session reads no shared files SharedConfigDisable still loads the shared credentials file, so a selected AWS_PROFILE whose role_arn lives there failed every workload client build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * remote/s3: exchange the web identity in the workload's region The credential session took the bucket's region, so with regional STS a pod whose only reachable STS endpoint is its own region could not sign for a bucket in another one. AWS_REGION/AWS_DEFAULT_REGION win; the bucket's region remains the fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: a container authorization token change rebuilds the guarded client The container credential provider captures AWS_CONTAINER_AUTHORIZATION_TOKEN and its _FILE path when it is built. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * remote/s3: the workload's web identity uses the regional STS endpoint SDK v1 still defaults to the legacy global endpoint for most regions, so a pod that reaches only its regional STS endpoint got no credentials. An explicit AWS_STS_REGIONAL_ENDPOINTS keeps its say. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: a workload region or STS endpoint mode change rebuilds the guarded client Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * remote/s3: a workload-mode storage session reads no shared files either A selected profile the SDK rejects still failed the storage session even though it carries the workload's credentials. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: hash AWS_ROLE_SESSION_NAME into the guarded credentials version Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: an IMDS endpoint or mode change rebuilds the guarded client Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: a keyed s3 remote's guarded version follows the credentials mode too Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: hash every AWS_* variable into a default-chain remote's guarded version Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
827a3d2a99 |
fix(s3api): validate ACL grant Permission (#12938)
s3api: validate ACL grant Permission Reject a grant whose Permission is missing or not one of the five S3 values with a new MalformedACLError, and skip grants without a permission when building GetAcl responses instead of panicking. Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com |
||
|
|
07e1299f98 |
mount: add -idmap to allow ID-mapped bind mounts (#12922)
* mount: add -idmap to allow ID-mapped bind mounts FUSE allows ID-mapped mounts only for a server that announces FUSE_ALLOW_IDMAP. Once announced, the kernel sends uid and gid 0xFFFFFFFF on most requests after checking permissions itself, so the checks that read the caller treat that value as already checked. * fuse: refuse an unsupported -o idmap before starting the child The child exits on checkIdmap, but the parent waits for its readiness signal and never returns, so weed fuse -o idmap hung on macOS and FreeBSD. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: refuse -idmap on Windows instead of ignoring it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fuse: take -o defaultPermissions as the mount flag -o defaultPermissions=false was forwarded to the kernel as an unknown option, which failed the mount, and left the flag at true, so -o idmap,defaultPermissions=false passed the idmap check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
feb488a84d |
s3api: create the stored object's missing directory before a recovery answers success (#12963)
* s3api: create a recovered PUT's missing directory The filer stores a new entry before its parent directories, and a parent that fails to insert leaves the entry stored with an error returned. Both PUT recoveries then find the stored entry and answer success, so the object reads by key but no listing shows it, and an overwrite takes the filer's existing-entry branch, which creates no parents either. Before claiming the stored entry, create its directory when it is missing, and answer an error when that fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: create a committed completion's missing directory A CompleteMultipartUpload whose commit stored the object but failed on its parent directory answered success through the committed-despite branch, and a retry that finds the committed object answered success the same way. Both now create the object's directory first and fail while it cannot be created; the upload directory is kept, so the retry can finish the job. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: test recoveries that create the stored object's directory Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: check every directory level when repairing an object's parent A repair mkdir stores the directory it creates before that directory's own parents, so a failure there can leave a lower level stored without its parent, and a retry that saw the lower level answered success. Walk from the bucket down and create each missing level. A file left by a failed prefix-object promotion is not a directory a listing descends, so it fails the repair rather than passing as an existing directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: free unused parts when a completion's directory repair fails The early return skipped the cleanup of parts the committed object does not use, and the retry that finds the commit removes the remaining entries metadata-only, so the unused parts' data leaked. Run that cleanup and keep only the upload directory for the retry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: test the per-level parent repair and the failed repair's cleanup Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: bound the parent repair with the recovery's lookup budget The repair's filer calls ran on a background context, so a filer that stopped answering held the object write lock without a deadline. The PUT recoveries pass their lookup context, and the completion gives the repair the same createLookupTimeout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: fail the parent repair when the bucket directory is missing The filer creates missing ancestors for a directory create, so walking down from an absent bucket directory would recreate a bucket deleted during the write as a plain directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
7e9ca16f72 |
shell: show the cluster UUID as the cluster.status id (#12964)
* master: include the cluster UUID in TopologyInfo VolumeList now returns the topology's persisted UUID alongside the topology tree, so clients can show which cluster they are looking at. Claude-Session: https://claude.ai/code/session_011UpvahFvcQGAmXWpPrXZY1 * shell: show the cluster UUID as the cluster.status id The id line printed the topology root's fixed name, topo, which is the same on every cluster. Print the cluster's persisted UUID instead, and fall back to the old value for masters that do not report it. Claude-Session: https://claude.ai/code/session_011UpvahFvcQGAmXWpPrXZY1 |
||
|
|
bc6db95f19 |
s3_objectlock: scan listing pages before subdirectories, and stop skipping backslash and .uploads keys (#12961)
* s3_objectlock: read each listing page before scanning its subdirectories The scan listed a subdirectory while the parent listing was still open. On a store with one connection, such as SQLite, a parent page that filled its stream window kept the connection the child listing needed. Pages now skip chunk lists, since only the lock metadata is read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3_objectlock: scan names that contain a backslash With backslashes allowed in object keys, a key such as a\b is stored under that name. The scan skipped it, and every key below such a prefix, as if the name were a path separator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3_objectlock: scan keys below a .uploads prefix The scan skipped every directory named .uploads, so an object stored below a key prefix such as a/.uploads/ was never checked. It now skips only the directories of pending multipart uploads, whose lock settings belong to an object that does not exist yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3_objectlock: keep only what the scan reads in a buffered page A page now stays in memory while its subdirectories are scanned, and a listing still carries the contents of files stored inline in the filer. A page keeps only each entry's name, directory flag and extended attributes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3_objectlock: scan objects stored below a pending upload directory A key such as .uploads/<upload id>/c is an ordinary object, and the scan skipped it along with the upload directory it sits in. The scan now descends into upload directories and ignores only the lock settings an upload directory holds for its future object. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3_objectlock: exempt upload directories only while under .uploads A renamed upload directory keeps its multipart key, so outside .uploads it is checked like any other directory marker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
5f97a9d088 |
mount: keep an unpublished create's writes, unpublished, when a peer renames onto its name (#12960)
* mount: publish an unpublished create's writeback drain after a peer rename onto its name With -writebackCache, the drain flushes metadata only while the saved path still maps to the handle's inode. Another mount renaming its file onto the name of a file this mount created and has not published moves that path to the peer's inode, so the drain skipped the flush and dropped the writes without an error or a failed-metadata record. A local rename or unlink of a draining handle waits for the drain or marks it, so for an unpublished create a lost mapping means another mount's file took the name. Skip the guard for it: the create-if-not-exists commit then keeps a recovery record when the name is taken and publishes when it is free. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(fuse_dlm): accept only EEXIST on O_EXCL as an early second-create refusal The concurrent create test returned early on any error from the second open, so an EIO, or an open failure in the O_TRUNC case, passed without writing either payload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: refuse publishing an unpublished create after a peer renames onto its name Another mount's rename onto the name of a file this mount created but has not published takes that name. The create used to publish there later with create-if-not-exists as soon as the name was free again: after a local unlink of what the name showed, it reappeared, and after a move of its directory it landed under a path no longer reachable. markHandleReplaced now records that the name was taken, and the publication check refuses the handle from then on: a writeback drain keeps a recovery record and default mode fails close. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
dbbf2907a6 |
webdav: refuse to delete, move or overwrite entries under Object Lock or WORM (#12959)
* webdav: refuse to delete entries under Object Lock or WORM DELETE removed versions under legal hold or retention and WORM files that the S3 API and the filer HTTP API refuse to delete. Check the entry, and for a collection everything below it, then pin the delete to the Object Lock state that was checked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: refuse to move entries under Object Lock or WORM MOVE could rename a locked version or WORM file away, move a directory holding them, or replace a protected target. Check the source, a source directory's contents and the target before the rename. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: refuse to overwrite entries under Object Lock or WORM PUT and COPY replaced a locked or WORM file with a fresh entry, dropping its content and its lock. Check an existing file before creating over it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: pin an upload's final update to the Object Lock state it read An upload writes the whole entry back when it closes. A hold or retention set on the new object while the upload was buffering would be dropped, so the filer now refuses the update if that state changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: recheck an upload's target when it commits instead of pinning it The precondition on the final update sent it to the path's write owner, while the placeholder create stayed on the connected filer. With separate filer stores the owner could miss the placeholder and refuse the update, leaving an empty file. The upload now rechecks the target right before the update, as the SFTP upload does, and the update stays local. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: share the WORM retention and subtree checks FilerConf.WormEnforced and IntersectsWorm replace the copies in the filer server and mount; ReadFilerConfFromClient reads filer.conf over a filer client. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp, webdav: use the shared Object Lock and WORM helpers Both servers now call FilerConf.WormEnforced, IntersectsWorm, ReadFilerConfFromClient and s3_objectlock.ObjectLockState instead of keeping their own copies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
763c3d1bdf |
s3tables: keep files a deleted table or view did not write (#12953)
* s3tables: let DirHoldsFiles count only files older than a cutoff A non-zero cutoff skips files created at or after it, and Iceberg metadata files directly under the walked directory's metadata/ folder, which a create stages before its record exists. Existing callers pass the zero time and keep counting every file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3tables: keep files a deleted table or view did not write DeleteTable purged the table's directory (or its decoupled data location) recursively, and DeleteView purged the view's directory, so files that were already there when the record was created, or that were written under a view, went with it. Those files now stay: the record's attributes are cleared and the directory is left as a leftover. A table still purges the files it wrote after its create, and its staged metadata. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg: skip the drop purge of a location holding older files DropTable and DropView purge the dropped entry's location after the catalog delete. A location that holds files older than the table, or any file other than metadata for a view, is left alone, matching DeleteTable and DeleteView. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3tables: count a file from the record's own second as older File creation times have second granularity, so an upload made in the same second as the table's create compared equal and was purged. An equal second now counts as older, and the view cutoff no longer needs the extra second. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3tables: count S3 objects stored on directories in DirHoldsFiles A trailing-slash key, or a file promoted to a directory by a child write, is an S3 object on a directory entry. The walk only counted plain files, so a delete purged such objects, including one on the purged path itself. They now count like files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3tables: keep every non-metadata file under a deleted view A view writes nothing but its metadata files, so a file under it counts whatever its creation time, including one stamped ahead of this clock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3tables: count a file from the record's own second as the record's File times are whole seconds, and a writer's first file (an insert right after a create, or a CTAS writing in the second it staged) often shares the record's second. Counting it as older kept the table's own files on drop, so a re-create at the location found it non-empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg: date a staged create's table from its stage The engine writes a staged create's first files before the commit registers the table, so they predate its record and a drop kept them. The commit now passes the time the stage marker recorded, in process only, and the table's CreatedAt starts there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3tables: say a view name holds plain files instead of a table A view deleted over files it did not write leaves its directory without a catalog record. CreateView reported that directory as a table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3tables: keep a view location's metadata files older than the view A view writes its metadata only after its record, so a metadata file from an earlier second at the location is not the view's and keeps the directory on a drop, like any other file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg: test that a view drop keeps older metadata at its location Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg: date both view drop test files from one record time Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg: drop only the table or view record the lookup read Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg: test a drop whose record is replaced after the lookup Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg: check the location claim again after the drop scan Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg: test a location claimed while the drop scans it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |