Commit Graph
21842 Commits
Author SHA1 Message Date
Chris LuandClaude Opus 5.5 22beba4e50 mount: refuse writes once the shutdown flush starts
A write admitted after its handle was flushed was acknowledged and then
lost when the process exited. The shutdown flush now sets a flag that Write
checks under the handle lock, takes every handle lock once to wait out the
writes already admitted, and reports whether every flush succeeded. The test
now buffers real bytes and checks they are uploaded and committed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 23:59:36 -08:00
Chris LuandClaude Opus 5.5 397f127f6b mount: flush open files before shutdown
On SIGTERM the mount unmounted and exited without uploading the buffered
writes of files still open, so a pod deletion dropped data the kernel had
already acknowledged. The interrupt hook now flushes every dirty open handle
like fsync, inside the existing 30s shutdown bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 23:46:40 -08:00
8760e2778b worker: dir_usage takes off what a TTL expires (#13369)
* worker: dir_usage takes off what a TTL expires

A plain TTL removes an expired row without an event, so a record kept
counting it until its bucket was seeded again. An entry's attributes say
when listings start leaving it out (Entry.ExpiresAt, which listingExpired
now uses), so a record keeps what each directory has still to expire,
grouped by the step it expires in, and each run takes off what came off
by its position. A step is an hour, or for a TTL of 200 hours or more the
largest power of two hours up to 1% of it, so a record stays bounded.

An event counts an entry only if the record has not taken it off yet, so
an S3 expiry, which logs a delete, comes off once. Record version 2 seeds
the records made before again.

Part of #13257.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dir_usage: decide a seeded directory's share after what expired

The seed took off what had expired by its position only after the final
share check, so a directory the walk kept could be dropped against a
total that still counted those entries. Take them off first, and hand
what a dropped directory has still to expire to the directory above.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dir_usage: drop a seeded directory below its share with dropTracked

A directory below its share has none above its share below it, so
dropping it with what is below, its entries staying counted above, is
what untrack did.

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>
2026-12-03 23:40:58 -08:00
Chris LuandClaude Opus 5.5 f796077361 s3: keep a shared STS signing key on the filer when no IAM config is given (#13368)
* s3: keep a shared STS signing key on the filer when no IAM config is given

Without an IAM config file, jwt.filer_signing.key, or an SSE-S3 KEK, the
IAM loader had no STS signing key and STS stayed off. The KEK used to be
created automatically, which made STS work out of the box; it no longer is.

In that zero-config case, read the key from /etc/iam/sts_signing_key on the
filer, creating it once with an exclusive create, so every gateway sharing
the filer signs and validates session tokens with the same key across
restarts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3: wait for the winning gateway's STS key after a refused create

With per-filer stores the exclusive create is decided by the write owner,
so the key another gateway created may reach this filer a little after the
create is refused. Keep reading until it shows up instead of leaving STS
off on the losing gateway.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3: refuse the filer STS key while an SSE-S3 key goes unloaded

A gateway whose SSE-S3 setup failed (a KEK it cannot unwrap, or a
configured key that was rejected) has no master key, so it fell through
to the STS key kept on the filer while the other gateways signed with
the KEK. Leave STS off on such a gateway instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 23:37:07 -08:00
81f673a8d9 master: start a margin past the file ids handed out without a record (#13366)
* master: start a margin past the file ids handed out without a record

A master records how far it hands file ids out, and the one that takes over
starts from the record. A master from before the record existed leaves none:
the first master that has it, taking over from one that does not, counts on
from the largest id written and hands out again the ids that had not landed.
That is every cluster on the day it is upgraded.

The largest needle id a volume server reports shows it. Under masters that
record, every id in use is below the recorded ceiling; one at or past it, or
any at all with no ceiling recorded, was handed out without a record, and so
may others above it. The sequence then goes on a margin of 2^24 past it.

Three masters of the previous version, the two followers restarted with this
one, then the leader killed while ids are assigned: 510 of 1228 ids were
handed out twice, and none of 1252 with the margin. Three masters of this
version alone never take it: the ranges stay a step apart.

* master: margin a late server's ids past only other masters' ceilings

A volume server that first reports after the master that took over has
handed out ids holds none of them, yet its ids can sit under the ceiling
this master recorded since and so miss the margin, though they were handed
out without a record. Compare a server's first report to this master
against the ceilings other masters recorded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* master: give up its own file id ceiling when the leader changes

A master that leads again, having stayed up, counted on from where it
stopped under the ceiling it had recorded. A master that records nothing may
have led in between, as one of the previous version can during a rolling
upgrade, going on from the servers' reports below that ceiling: the ids it
handed out that had not landed were handed out again. The margin does not
catch it, as the reports stay under the ceiling and the servers are known.

On a leader change a master now gives up its own ceiling and moves its
sequence to the highest one recorded, so its next assignment records a new
ceiling past all of them. goraft calls the leader change listener from its
loop, so this takes no lock a raft command is held under.

* master: drop a file id drawn before a leader change gave its ceiling up

nextFileId read its own ceiling before the draw and checked that copy
after it. A leader change that gave the ceiling up between the two left
the stale copy passing, so an id drawn below the old ceiling could be
handed out after a master in between had handed it out too. Read the
own ceiling again after the draw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* master: pin leading again to the ceiling recorded before

The test checked the id against a bound far below the recorded ceiling,
so a drop that moved the sequence only a little would still pass.
Check the id and the new ceiling against the ceiling recorded before
the leader changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* master: count a server's first report after a leader change as its first

The servers that reported to a master were kept for the life of the
process. When the master led again after one that records nothing, a
server it knew from before was compared against the ceiling it had just
recorded, which may already be past the ids the master in between handed
out, so a late report took no margin. Forget the reporters on a leader
change, so their next report is compared against the other masters'
ceilings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 23:35:06 -08:00
Ping Qiu bc2291c64b Merge pull request #13358 from seaweedfs/import/seaweed-block-v1.1.0
Import seaweed-block v1.1.0 with history into seaweed-block/
2026-12-03 23:34:15 -08:00
Chris LuandClaude Opus 5.5 b0d12a71af volume: keep the heartbeat moving while a compaction commit holds a volume (#13365)
* volume: report the commit-start status while a compaction commit holds the volume

CommitCompact holds dataFileAccessLock across makeupDiff and the reload,
which on a large volume takes longer than the master's heartbeat
timeout. The heartbeat reads every volume of the server through
collectStatus, so it waited out the commit and the master unregistered
the whole server.

The commit now pins the status it starts from, and status reads answer
with it until the commit is done, instead of queueing behind its
exclusive lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* volume(rs): report the commit-start status while a compaction commit holds the volume

The Rust commit closes the needle map and .dat and reloads the compacted
files under the io write lock. The heartbeat read each volume's counts
through that lock, so it waited out the reload, and between the close and
the reload it reported the volume as empty.

Mirror the Go change: the commit pins the status it starts from, and
collect_status answers with it until the commit is done. The heartbeat
reads all of a volume's counts through one collect_status call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* volume: report the compaction revision with the commit-start status

The commit reloads the superblock before it lets status reads see the
live volume again, so a heartbeat in between paired the new compaction
revision with the pinned counts, and the changed hash sent that mixed
report. The revision is now part of the status the commit pins, in Go
and in Rust.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* volume: size auto-sized disks from the commit-start footprint

MaybeAdjustVolumeMax runs just before every heartbeat and, for a disk
without a fixed -max, reads each writable volume's .dat and .idx sizes
through the data lock, so it still waited out a compaction commit.
UnUsedSpace now reads the footprint the commit pinned while one holds
the volume, in Go and in Rust.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* volume(rs): recheck expiry from the commit-start status

The heartbeat's expiry recheck runs under the store write lock and read
the .dat size through the io lock, so a TTL volume that came due while a
compaction commit reloaded it held the heartbeat until the reload ended.
It now reads the size from collect_status, and delete_volume keeps
refusing the committing volume until a later pulse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* volume: refuse to delete a committing volume without waiting for it

Destroy takes the data locks a compaction commit holds across its
reload, and the heartbeat deletes expired TTL volumes under the
location's volumes lock, so a volume that came due mid-commit stalled
the heartbeat. deleteVolumeById now refuses a compacting volume up
front, as the Rust volume server's delete_volume does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* volume: claim the volume before Destroy takes its data locks

deleteVolumeById checked the compaction flag and only then let Destroy
take the data locks, so a commit that claimed the volume in between
still made the delete wait out its reload under the volumes lock.
CommitCompact claims before it locks, so Destroy now does the same and
refuses a claimed volume without waiting; the separate check in
deleteVolumeById is no longer needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* volume(rs): refuse to destroy a volume whose sync lock is held

Every destroy runs under the store write guard, and the vacuum-commit
RPC takes the sync lock and waits out leased readers before it marks
the volume compacting, so an expiry deletion in that window passed the
compacting check and then stalled the heartbeat behind the commit.
destroy now try-locks the sync lock, as commit_compact does, and a
refused deletion keeps the volume mounted for a later pulse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* volume(rs): keep the CompactionClaim doc on CompactionClaim

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* volume(rs): report a volume a collection delete could not destroy

The collection delete logged a refused destroy, kept the volume mounted
and still answered success, so the caller never retried. Return the first
error after the loop, as the Go store does, while the other volumes of the
collection are still deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* volume(rs): claim a volume before the commit and destroy take its locks

destroy try-locked the sync lock so a delete under the store write guard
would not wait out a commit's reader drain, but every write holds that
lock across its fsync, so a volume or collection delete racing an upload
was refused. Claim the volume first, as Go's CommitCompact and Destroy
do: the commit RPC claims before it takes the sync lock and waits for
readers, and destroy claims, waits for the locks only behind writes, and
refuses a claimed volume without waiting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* volume: skip the missing-.dat check while a volume is compacting

A status read no longer waits out a commit, and on Windows the commit
removes the .dat before it renames the compacted one in, so a heartbeat
in that gap took the volume for one whose .dat was unlinked and left it
out of the report. The commit-start status already stands in for the
volume until the commit ends.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* volume(rs): skip the missing-.dat check while a volume is compacting

Mirrors the Go change: the heartbeat reads the commit-start status
without waiting for the commit, and a Windows commit removes the .dat
before it renames the compacted one in, so the check dropped the volume
from a heartbeat taken in that gap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* volume(rs): keep the new delete and heartbeat tests beside related ones

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* volume: report a compacting volume a collection delete left mounted

Destroy refuses a volume a commit has claimed, so the collection delete
no longer filters compacting volumes out silently; the refusal is
returned and the master keeps the collection to retry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* volume(rs): report a compacting volume a collection delete left mounted

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* volume: confirm a missing .dat under the compaction claim

The compaction flag was read before the stat, so a commit starting in
between could have its Windows swap taken for a phantom. Stat first and
recheck a missing .dat while holding the claim; a held claim defers the
verdict to a later heartbeat.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* volume(rs): confirm a missing .dat under the compaction claim

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* volume(rs): expect a collection delete to refuse an in-flight compaction

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 23:31:58 -08:00
Tiago PosseandClaude Opus 5.5 0660a27506 filer: give each read on a reader its own stream position (#13363)
Concurrent ReadAt calls on one ChunkReadAt (mount issues them) shared a
single stream slot, so one read could unpin the chunk another read had
moved the stream to: by leaving it for another chunk, or by finishing a
chunk that a later read had entered without a pin of its own. The chunk
was then dropped and the next read downloaded it again.

Each read now takes the reader's position, moves it on its own stream
and parks it back when it ends. When overlapping reads both stop inside
a chunk, the one that stopped further into the file keeps its pin and
the other releases it. A read that starts while another holds the
position starts in no chunk. With one read per stream, chunkStream no
longer needs a mutex or a conditional detach.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 23:30:23 -08:00
9c214d0ff5 kms: close replaced providers after a grace period (#13359)
* kms: close replaced providers after a grace period

A reload closed each provider it replaced or removed right away, while S3
requests that had fetched it just before could still be using it. Those
requests failed. A replaced or removed provider now stays open for a grace
period of a minute and is then closed once, however often it was retired.
The manager's Close closes the ones still waiting.

The global provider is now the manager's default one, looked up on each
use, so a reload can't leave it pointing at a closed instance. A provider
set with SetGlobalKMSProvider still takes its place until the next load,
which clears it. Passing nil hands it back to the manager's default, where
before it turned KMS off until the next load. While a retired provider is
global, its retirement is held with no timer, and it starts again once it
isn't. SetGlobalKMSProvider no longer closes the provider it replaces,
since the caller owns what it passes. A provider InitializeGlobalKMS
created belongs to the package, so it's closed once another global
provider replaces it. The manager's Close clears the global provider if
it's one the manager closes, so it isn't used closed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* kms: read the global override and the default provider under one lock

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* kms: check the replaced global instance is held before unsetting it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* kms/openbao: close the reload test's providers through the manager

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>
2026-12-03 23:14:53 -08:00
pingqiuandClaude Opus 5.5 66262d8e94 codespell: accept seaweed-block's protocol terms and identifiers
AAS (iSCSI ALUA Access State), Data-Out (dout), plus a few identifiers
and fixture literals in the imported module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 23:12:05 -08:00
pingqiuandClaude Opus 5.5 b20fcb92b0 seaweed-block: refuse a CSI replicationFactor beyond int32
Same change as the module's upstream commit b9ee7f1c (#1011), applied
under seaweed-block/: an oversized StorageClass replicationFactor is
refused as InvalidArgument instead of wrapping on conversion. Ships in
seaweed-block v1.1.1; a later sync carries the identical change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 22:46:34 -08:00
pingqiuandClaude Opus 5.5 87d52c6840 codespell: skip TLA+ specs and accept the NVMe term AER
The imported seaweed-block tree has TLA+ models (\notin is TLA+
syntax) and NVMe docs that use AER (Asynchronous Event Request).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 22:41:18 -08:00
pingqiuandClaude Opus 5.5 cd0f60a2f0 seaweed-block: bump google.golang.org/grpc to v1.83.2
Same go.mod/go.sum change as the module's own upstream commit 8051b18e,
applied under seaweed-block/. Clears the dependency review of the
imported v1.1.0 tree (grpc 1.80.0 advisories); a later sync of the
module carries the identical change, so it merges cleanly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 22:40:33 -08:00
github-actions[bot] dbf0f3bb35 docs: regenerate star history chart 2026-12-04 00:46:00 +00:00
Chris LuandClaude Opus 5.5 e9b51cb242 mount: stop the filer walk at a live filer's "not found" (#13357)
* mount: stop the filer walk at a live filer's "not found"

With several filers listed and some of them down, a lookup that the live
filer answered with "not found" went on to the dead filers. Their dial
error replaced the answer, so the walk retried it as a transient failure:
the mount failed to start when filer.conf did not exist, and looking up a
missing file or creating a new one failed with an I/O error after about
40 seconds. Stop at a missing entry the way a filer verdict already stops
the walk, and keep the walk on the filer that answered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* mount: test a live filer's "not found" next to dead filers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 11:13:59 -08:00
c46567084f sftp: read downloads as the file's logical content (#13355)
* sftp: read downloads as the file's logical content

Downloads read through filer.NewFileReader, which stops at the last stored
byte: holes between chunks, a tail no chunk stores and the zeros after
partial inline content came back missing, so sparse files downloaded short
or with later bytes shifted.

Read chunked files through filer.ChunkReadAt with one shared ReaderCache,
set up as WebDAV's: it serves FileSize bytes, zero-fills what no chunk
stores, resolves manifests, prefetches and re-looks-up moved volumes.
Closing a handle only releases its stream, as S3 does. Inline content is
read up to the file's size, then zeros. This replaces sftpd's own block
cache, whose LRU helper is now unused.

* sftp: read large downloads in sections, as the FUSE mount does

ChunkReadAt walks the file's chunk views from the start on every read, so
a sequential download of a file with many chunks costs time quadratic in
its chunk count. Read through filer.ChunkGroup instead, the reader of a
mount's file handle: it keeps chunks in 64 MiB sections, returns EOF at
the file size for any offset, and holds every open file's buffers to one
shared budget (the mount's default 256 MiB).

* sftp: cache remote-only content on open instead of refusing it

A file whose content only a remote store holds is copied into the cluster
with CacheRemoteObjectToLocalCluster when it is opened for reading, as a
mount's read and the filer's HTTP read do, and then read from the cached
chunks. It is still refused when the remote store cannot be read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Denis Maier <denis@dAir.lab>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 11:13:40 -08:00
9290e6d69e sftp: honor the CREATE, EXCL and APPEND open flags (#13354)
* sftp: honor the CREATE, EXCL and APPEND open flags

An upload open ignored three of its flags:

- Without CREATE, opening a missing file created it on close. It now fails
  with NO_SUCH_FILE, as OpenSSH's sftp-server and SFTPGo do.
- CREATE|EXCL on an existing file succeeded and overwrote it. The open now
  creates the empty file with an exclusive filer create, so it fails when
  the name is taken, also while another exclusive upload of it buffers.
- APPEND wrote at the client's offset, usually 0, over the start of the
  file. A write below the size the file had at open is now refused, as
  SFTPGo does. Writes keep their offsets rather than going to the current
  end, because pkg/sftp may run a client's pipelined writes in any order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* sftp: leave a file alone when an open of it changes nothing

An APPEND open whose writes were all refused still uploaded the copied
bytes on close, which rewrote the file and handed it to the session's
user. Any open that copied the existing file now uploads only once the
handle writes or sets attributes, not only read-write opens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Denis Maier <denis@dAir.lab>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
2026-12-03 11:12:02 -08:00
7c4b39bee1 s3api: list object metadata with ListObjectsV2 metadata=true (#13351)
* s3api: list object metadata with ListObjectsV2 metadata=true

A client that needs the type or user metadata of the objects it lists has
to HEAD each key. MinIO answers ListObjectsV2 with metadata=true by adding
each object's metadata to the page as <UserMetadata>, one element per
field, and its clients ask for it: minio-go ListObjectsOptions.WithMetadata,
minio-java ListObjectsArgs.includeUserMetadata, minio-py
list_objects(include_user_meta=True), and mc find --metadata.

With metadata=true each listed object carries the Content-Type and the
x-amz-meta-* fields GET and HEAD send for it, keyed as MinIO keys them
(content-type, X-Amz-Meta-Name). A symlink made through a mount lists with
inode/symlink and X-Amz-Meta-Seaweedfs-Symlink-Target, so links can be told
apart in a listing without a HEAD per key. As in MinIO, a key's metadata is
listed only for a caller allowed to read that key, through the per-key
check CopyObject uses for its source, so a List grant alone shows no more
than before and an anonymous caller gets none. Without the parameter, and
on ListObjects V1, nothing changes. HEAD and the listing share one
Content-Type rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: hide listed metadata a tag-conditioned policy denies

GET decides the bucket policy again on the object's entry, so a Deny on
s3:ExistingObjectTag refuses the read. The metadata=true listing only ran
the key check, which sees no tags, and listed the metadata of an object
GET refuses. Decide it on the listed entry too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: keep setResponseHeaders' doc comment on it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: list a versioned object's metadata from its version file

The pointer cached on a .versions folder keeps an object's size, mtime,
ETag, owner and storage class, but not its type, user metadata or tags.
A metadata=true listing built from it showed a content type guessed from
the name and no x-amz-meta-* fields, and decided tag-conditioned policies
without the version's tags. Such a listing now reads the current
version's file, as GET and HEAD do; other listings keep using the pointer.

Reading the file also needed its path fixed: the fallback looked for it
under "<key>/.versions/", while versions live in "<key>.versions/", so a
pointer without the cached fields dropped the object from a listing or
failed it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: fold latestVersionEntryFromDirectoryEntry into getLatestVersionEntryFromDirectoryEntry

Every caller passes useCached, so the flag goes on the existing name
rather than a second function beside it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: fail a listing on a version file that cannot be read

With metadata=true every versioned key reads its version file in the
walk's .versions branch, which skipped the key on any error. A failed
read then answered a page that silently lacked the key, and a client
paging on could step past it. Skip only a version file that is gone, as
settlePendingNull and the version resolution do, and fail the listing on
any other error so the client retries it. The fallback now wraps the
lookup error with %w, so a removed version file still reads as not found
there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: list the remaining version when the pointer names a removed file

A .versions pointer can name a version file that has since been removed,
as when a delete lands while a listing reads it; with metadata=true every
versioned key reads its file. GET rescans .versions/ and self-heals the
pointer, but the listing skipped the key, which left a null object listed
just before its .versions sibling as the key's current version even when
a newer version remains. The listing now recovers read-only by the
rescan it already uses for a missing pointer: it lists the version that
remains, or the null object when that is newer. When nothing current
remains, it retracts a null object listed just before the folder, as
settlePendingNull does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: fail a listing when the null object cannot be read

The listing's .versions rescan treated any failed read of the base-path
null object as its absence. When that read failed for a moment and the
scan found no versions, the walk retracted the null object it had just
listed and answered success, paging past a key that still exists. The
rescan now returns such a read error, which fails the listing as an
unreadable version file already does; only a genuine not-found counts
as no null object.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: keep a directory from standing in for the null object in a listing rescan

The listing's .versions rescan read the base path and took whatever it
found as the null object. When the base path is a bare directory that
holds child keys, a directory newer than the remaining version replaced
it, and the listing dropped the key although GET answers that version.
The rescan now admits the base entry only when isNullVersionObject
accepts it, as GET's recoverLatestVersionWithoutPointer does.

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>
2026-12-03 11:11:30 -08:00
Chris LuandClaude Opus 5.5 4a0bc7fe83 mount/page_writer: count only uploads that park after the test starts waiting (#13352)
An earlier test can leave an upload parked on its read that goes on only
after the next test has counted it. The count of parked uploads then never
grows by the ones the next test parks, and it fails after 5s. Track the
parked uploads by goroutine id and wait for new ones instead.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 11:09:48 -08:00
Chris LuandClaude Opus 5.5 874bc97814 s3api: answer 400, not 500, for list prefixes and markers that are not valid UTF-8 (#13350)
* s3api: refuse list prefixes and markers that are not valid UTF-8

A prefix, start-after, marker or continuation token holding bytes that are
not valid UTF-8 reached the filer's listing request, which cannot carry
them, and the failure answered 500 InternalError. ListObjects and
ListObjectsV2 now answer 400 InvalidArgument for such a prefix or marker,
and the "continuation token provided is incorrect" InvalidArgument for such
a token, before listing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: refuse version list prefixes and key markers that are not valid UTF-8

ListObjectVersions sent the prefix and key-marker to the filer as well, so
bytes that are not valid UTF-8 there also answered 500. They now answer
400 InvalidArgument.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: test listings with parameters that are not valid UTF-8

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 11:09:04 -08:00
Tiago PosseandClaude Opus 5.5 dc500b2cde kms/local: create on-demand keys only for new data keys (#13346)
With enableOnDemandCreate, every lookup of a missing key created it, so a
Decrypt or DescribeKey naming a key that didn't exist got a new key
instead of an error. Only GenerateDataKey creates keys now, since no other
request can succeed with a key that didn't exist before it. An alias gets
a key with a generated ID, as it would in AWS, instead of a key whose ID
is the alias, and a key ARN spelling an alias, which names no key,
creates none.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 11:08:15 -08:00
2c48e8a014 worker: dir_usage keeps the sizes of buckets and their large directories (#13345)
* shell: fs.du walks with a shared treewalk.Walker

The walker fs.du used moves to a new package, filer/treewalk, so that the
dir_usage job proposed in #13257 walks the same way. fs.du adds up what
its visitor is told; what it prints and how it fails stay the same. A page
now also carries the snapshot the filer listed it at, and when it was
listed.

treewalktest serves a tree from memory and logs an event for each change,
for the tests of walks and of what follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* filer/treewalk: Seed adds up a walk and the events logged while it runs

Seed walks a directory tree while it follows the metadata log below it,
and reconciles the two, so that the result is the tree as of one log
position:

- an event at or before the snapshot of the page that lists its name
  shows in that page, and so does an event in a directory not listed yet;
- an event after the page's snapshot replaces what the page counted for
  the name, since the page may or may not show it;
- once a page is older than a margin, a minute by default since a rename
  logs its events after the move, an event changes the entry from its old
  to its new entry.

A directory missing from its parent's page counts from its events if it
was created after that page's snapshot, and not at all otherwise. This is
how the mount's metadata cache builds a directory from a listing and the
events around it, with a replace per name in place of the cache's
overwrite, which a running total cannot do.

Follow reads the events of a range of the log. The lookup of where the
log starts moves here from filer_ttl as LogStartTsNs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* worker: dir_usage keeps the sizes of buckets and their large directories

A plugin worker job, off by default, that keeps what fs.du adds up of each
bucket and each top-level directory outside the buckets folder, and of
each directory in it holding at least 1% of its bytes, down to 10 levels.
Directories at one depth do not overlap, so a bucket has at most 1,000
such records, whatever the shape of its tree. They are one JSON file per
bucket under /etc/seaweedfs/dir_usage/<store signature>/.

The buckets without a record are seeded in one treewalk.Seed walk of the
buckets folder, and the top-level directories in one of /. After that,
each run replays the events since the last run, up to a minute before
now, applies each to the directories with a record above the entry,
writes the files that changed, and saves a cursor that meta_log_purge
keeps the log for. A record the log no longer reaches is seeded again,
and so is every record when no log is kept and the cursor is older than
the purge honors.

A tracked directory that moves keeps its record, which the events of the
entries it took along fill again. One deleted with totals left had
entries that went without events, as when a store drops a whole bucket,
and the rest comes off the directories above it. A bucket created since
the last run is seeded by the next.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* shell: fs.du -report prints what the dir_usage job keeps

fs.du -report [-depth=N] path prints the totals the dir_usage job keeps of
path and of the directories below it with a record, down to N levels, the
way fs.du prints a walk, and how old they are: as old as the job's cursor
for a record the last replay did not change. Nothing is walked. For / and
the buckets folder, the buckets and top-level directories add up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* treewalk, dir_usage: wait for the filer's own position, stop waits on cancel

A subscription with an end stops once it has read everything the filer has
logged, without waiting for the end to come. So the seed's catch-up now
waits until the filer's listing snapshot reaches the seed's end, and a
replay ends at the snapshot the filer gives when it starts, both on the
filer's clock rather than this process's.

- A walk waiting for its pages to free names stops when its context ends.
- A seed reports the listing that failed, not the cancellation it caused.
- A walk canceled while the last page's subdirectories start fails.
- LogStartTsNs passes over a day a purge that stopped midway left empty.
- A bucket dropped while the buckets folder is seeded gets no record; the
  next run seeds it if it is made again.
- Detection keys a store's job by its signature, so no two runs share a
  store whichever filer each starts from.
- The buckets folder is taken without a trailing slash.
- fs.du -report names the buckets and top-level directories it leaves out
  for want of a record, and no longer says why a directory has no total of
  its own.
- treewalktest.Filer replays a quiet drop with what was below it, and can
  refuse a listing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* treewalk: list a page again after a transient failure

A seed walks every bucket without a record in one walk, which on a large
store runs for hours. One page that failed because the filer restarted or a
connection dropped failed the whole walk, and the next run started it over.
A page that fails with a transient error is now asked for again, with
backoff, for up to a minute. Other failures still end the listing at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dir_usage: keep the other seeded records when one fails to save

A save that failed after a seed returned at once, so the records of the
batch not saved yet were lost, and the top-level directories were not
seeded at all when it was the buckets' batch that failed. The next run
walked them all again, which on a large store takes hours. A failed save
is now reported and the run goes on; the next run seeds only that root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* treewalk: measure how far the filer's clock runs ahead in a seed

A page's end is on this host's clock and the events it is compared to
are on the filer's, so a filer clock ahead by more than the margin
expired pages before the events they show arrived, and set the seed's
end before positions the filer had already logged. The seed now learns
a lower bound of the filer's lead from the page snapshots and the event
stamps, and adds it to page expiry and to the end.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* mini: expect the dir_usage handler among the default job types

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>
2026-12-03 11:05:56 -08:00
Chris LuandClaude Opus 5.5 18ba10b535 s3api: answer KeyTooLongError when the filer refuses an object's name (#13349)
* s3api: answer KeyTooLongError when the routed PUT's name is refused

The filer checks an entry's name length before its first mutation stores
anything, so a routed PUT refused with ENTRY_NAME_TOO_LONG on mutation 0
is a definite refusal, not an ambiguous outcome. Treating it as ambiguous
sent a zero-byte PUT, which has no chunks to verify, to 503.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: test a routed PUT refused for its name length

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: keep the filer's error code when a routed mkfile is refused

routedMkFile flattened the transaction's error into a string, so callers
could not tell a refused name from an internal failure, and a CopyObject to
a name the filer refuses answered 500. Wrap the code's sentinel, as
CreateEntry does, so the existing error mapping answers KeyTooLongError.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: test a routed mkfile keeps the filer's error code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: answer KeyTooLongError when a multipart completion's name is refused

Completing an upload whose last key segment the filer refuses answered
500 InternalError. The refused create stores nothing, so answer
KeyTooLongError as PutObject does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 11:00:33 -08:00
pingqiuandClaude Opus 5.5 7a51f796ab Import seaweed-block v1.1.0 with its history into seaweed-block/
The seaweed-block repository (v1.1.0, revision ff6b0b1b) is imported with its full history,
rewritten into the seaweed-block/ directory. It keeps its own go.mod and module path, so the
root module's builds do not include it. Development continues in the seaweed-block repository
until v1.1.1; the later sync merges the same rewritten history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 10:49:21 -08:00
4f6c138beb sftp: report file owners in stat and listings (#13340)
Stat, lstat and directory listings always showed uid 0 and gid 0,
although the filer stores the uploader's Uid and Gid. pkg/sftp only
sends the owner when the os.FileInfo implements its FileInfoUidGid
interface (Uid() and Gid()). EnhancedFileInfo exposed the owner through
an Owner() method and a custom Sys() struct instead, which pkg/sftp
never reads.

Implement Uid() and Gid() on EnhancedFileInfo and drop the unused
Owner(), Sys() and FileStat. Add a test that serves a session over
in-memory pipes and checks the owner returned by Stat and ReadDir.

Co-authored-by: Denis Maier <denis@dAir.lab>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 10:40:49 -08:00
Yip LeoandClaude Opus 5.5 71b1911e44 mount: answer statfs from the stats at hand, refresh them in the background (#13337)
StatFs asked the filer for Statistics whenever its stats were older than
20 s and waited for the answer, up to the 20 s filer RPC timeout, so a
slow filer or master held statfs for that long. A node agent that probes
mounts with a bounded statfs, as the CSI driver's health monitor does
with 5 s, took such a mount for hung and restarted it, on every node at
once when the filer was slow for all of them. Every concurrent statfs
also sent its own request while the stats were stale.

StatFs now answers from the stats it has and starts a refresh in the
background when they are older than 20 s, one at a time. Only the first
statfs waits, for the first refresh. A refresh the filer does not answer
keeps the last known stats, as before, and the next one starts 20 s after
it.

The stats are now read and written under a lock: the refresh and the
quota check write them while statfs and the quota check read them.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 10:39:23 -08:00
333c32d610 sftp: keep a folder a folder when its mode is changed (#13341)
chmod on a folder over SFTP failed with "existing entry is a directory".
SETSTAT copied the client's mode into the entry as-is. A client sends
only the permission bits, so the directory bit was dropped and the filer
refused an update that would turn the folder into a file. Files lost
their stored type bits the same way, just without an error.

Keep the stored type bits and take only the permission, setuid, setgid
and sticky bits from the client.

Co-authored-by: Denis Maier <denis@dAir.lab>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 10:38:33 -08:00
4cef7c1f41 sftp: refuse to read a folder instead of returning no data (#13339)
* sftp: refuse to read a folder instead of returning no data

Opening a folder for reading succeeded and every read returned EOF, so a
client that downloads without checking the type first saved an empty file.
readFile now refuses a directory, which reaches the client as
SSH_FX_FAILURE, as the read(2) of a directory does on OpenSSH's sftp-server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* sftp: refuse to read a symlink instead of returning no data

A symlink entry, as weed mount creates it, keeps its target in
SymlinkTarget and stores no content, and readFile does not follow it,
so a download of one also came back as an empty file. Refuse it with
OP_UNSUPPORTED.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Denis Maier <denis@dAir.lab>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
2026-12-03 10:37:50 -08:00
65d082e788 sftp: answer unsupported requests with OP_UNSUPPORTED (#13342)
* sftp: answer unsupported requests with OP_UNSUPPORTED

SYMLINK and the hardlink@openssh.com extension were answered with
SSH_FX_FAILURE ("unsupported: Symlink"). Clients such as OpenSSH sftp and
rclone use SSH_FX_OP_UNSUPPORTED to fall back; FAILURE reads as an attempt
that broke. Return sftp.ErrSSHFxOpUnsupported instead, before path
resolution, since a symlink's Filepath is the raw link target.

The version reply also used pkg/sftp's default extension list, which
advertises hardlink@openssh.com and statvfs@openssh.com. Weed implements
neither, so advertise only posix-rename@openssh.com.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* sftp: check the OP_UNSUPPORTED status a client receives for a symlink

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* sftp: answer READLINK with OP_UNSUPPORTED

Without a Readlink handler pkg/sftp sends READLINK to Filelist with
Method "Readlink", and listDir listed the path: a folder answered with
its first child's name as the link target, and a file or symlink with
NO_SUCH_FILE. Answer it, and any other method Filelist does not serve,
with OP_UNSUPPORTED like SYMLINK and hardlink.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Denis Maier <denis@dAir.lab>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
2026-12-03 10:36:56 -08:00
7c41ed0635 kms: swap a reload's providers in as a whole, after S3 parses its identities (#13344)
* kms: build every provider before a reload swaps them in

A reload replaced the providers one at a time, closing each old instance
as its replacement went in, and kept the providers and bucket mappings
the config no longer listed. Between closing the old default instance and
setting the new global provider, S3 could get the closed instance. A
reload now builds every provider first and swaps the whole set in at
once, along with the default, the bucket mappings and the global
provider. The default provider failing still fails the reload, and then
nothing changes. Any other provider that fails keeps its previous
instance. Providers the config no longer lists are dropped, and a bucket
mapped to one falls back to the default. A manager other than the global
one no longer sets the global provider. The manager no longer keeps the
provider configurations, which nothing read. Each load health-checks
every provider once, after the swap, for filer.toml as for the identities
file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: parse the identities before loading KMS

Loading the S3 config loaded KMS before parsing the identities, so a file
whose identities didn't parse still replaced the KMS providers. A file
without a kms block left the previous providers in place, and one with a
number out of float64 range, which protojson accepts, skipped KMS without
an error.

The identities are now parsed first, and a file that fails there changes
neither. A file without a kms block drops the providers, so a reload that
took the block out turns SSE-KMS off. A file encoding/json can't read
fails the KMS load with an error that doesn't quote it, as it could quote
key material. A KMS load that fails is logged as an error, not a warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* kms: skip a bucket mapping with an empty bucket name

SetBucketKMSProvider refused an empty bucket name, which the rebuilt
mappings no longer went through.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* kms: check a rejected load leaves the installed provider open

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>
2026-12-03 10:34:45 -08:00
Chris LuandClaude Opus 5.5 f1562aa130 filer: keep a child's chunks in a recursive delete when its rule retains them (#13338)
* filer: keep a child's chunks in a recursive delete when its rule retains them

A recursive delete batched each child file's chunks and checked only the
deleted directory's disableChunkDeletion, so a file under a more specific
rule lost chunks that deleting it alone keeps. Check the child's own rule,
the one that already decides its fsync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* filer: assert which chunk a recursive delete queues under a retaining child rule

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 10:34:03 -08:00
1858665311 util/http, operation, topology: give the DELETE helpers a deadline (#13333)
* util/http, operation, topology: give the DELETE helpers a deadline

Delete and DeleteProxied made their request without a context and read
the whole answer. Only the shared client's 30 s response header timeout
bounded them, and nothing bounded an answer whose body never ends.

- The cleanup after a failed chunk upload (deleteChunkFromHolders, used
  by PutObject and every chunked upload) asks the holder that just
  failed the write, often the one that stalls. A holder that did not
  answer held the upload for 30 s per holder and attempt, with the
  chunk's buffer. One that sent its headers and stalled held it for
  good, and the holders after it were never asked. Each delete is now
  bounded by cleanupDeleteTimeout (10 s), as the copy path's cleanup is
  by copyCleanupTimeout (#13297). A delete that runs out is logged and
  leaves the needle, as a failed delete did before.
- A delete forwarded to a replica that does not answer held the
  primary's DELETE for 30 s, while a forwarded write fails at
  replicaRequestTimeout. The delete forward now has the same bound, as
  the Rust volume server's replica_request already gives deletes. Its
  timeout is counted as a timeout, through replicaDeadlineError, which
  the write forward uses as well.

Delete and DeleteProxied take a context. benchmark and the unmaintained
repeated_vacuum pass context.Background().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* topology: let a replica's failure leave the other replica deletes running

DistributedOperation cancels its context when the first replica fails, and
the delete deadline was derived from it, so a sibling's failure could cut
the deletes to the other replicas short. The old context-free Delete kept
them going, and they must: the needle is gone on this server already, so
a replica that is not asked keeps its copy. Each delete now takes its
deadline from context.Background().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* topology: read the replica delete bound once, before the fan-out

A replica delete that outlives ReplicatedDelete read the package bound
again after its answer, racing a later caller that changes it.

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>
2026-12-03 10:33:02 -08:00
370fd46ed9 filer/elastic: report a failed read as an error, not as a missing entry (#13334)
* filer/elastic: report a failed read as an error, not as a missing entry

FindEntry returned filer_pb.ErrNotFound for any error from Elasticsearch
other than not-found, so a lookup that timed out or met an unavailable
cluster answered that an existing entry was gone. It now returns the
error, as #13287 and #13289 made the TiKV, MongoDB, ArangoDB and RocksDB
stores do.

KvGet reported a value it could not decode as missing. It now returns the
decode error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* filer/elastic: keep a top-level directory whose lookup failed

DeleteEntry looked up a top-level entry to decide whether to drop its
index, and treated a failed lookup like a file: it deleted the entry and
left the directory's index behind. Return the lookup error instead, so the
delete fails and a retry drops the index.

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>
2026-12-03 10:32:34 -08:00
5dafe56a63 mount: let SEEK_DATA and SEEK_HOLE see data that is not in the chunks (#13335)
* mount: let SEEK_DATA and SEEK_HOLE see data that is not in the chunks

Lseek searched only the file's uploaded chunks. Writes not uploaded yet,
inline content and the data of a remote file that is not cached are not
in them, so for such a file SEEK_DATA answered ENXIO and SEEK_HOLE found
a hole at the offset. A program that copies by data ranges, such as
qemu-img, takes the data for a hole and writes zeros in its place.

A file whose data is not all in its chunks is now answered as one data
range without holes, as lseek(2) allows: SEEK_DATA returns the offset and
SEEK_HOLE the end of the file. The upload pipeline attaches a chunk
before it counts the upload as done, and writes hold the handle lock
that lseek shares, so a file with no pending upload has all its written
data in its chunks.

Lseek also read the file size without the entry lock, while upload
workers append chunks under it. It now holds the lock for that read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* mount: answer lseek from the chunks of a cached remote file

A remote file keeps its RemoteEntry once cached, so checking only for
RemoteEntry reported every such file as one data range. Use
IsInRemoteOnly, as Read does, so the holes of a cached file are found.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* mount: trim the lseek 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>
2026-12-03 10:31:58 -08:00
Yip LeoandClaude Opus 5.5 34d36e599a mount: drop a directory's listing when the cache refuses an entry update (#13336)
* mount: drop a directory's listing when the cache refuses an entry update

UpdateEntry and UpdateEntryChecked returned the store's error and left
the entry in the local store as it was. The mount uses them to refresh
the other names of a hard-linked file after a link or an unlink
(syncHardLinkSiblings), which only logged the error at V(4). With a full
cache disk the siblings kept their old link count and ctime until their
directory was read again.

A refused update now drops the listing of the entry's directory, as
dropListingsOf does for an event the store cannot take (#13141), so the
next lookup there goes to the filer. The listing is dropped after the
cache lock is released, as dropListingsOf does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* mount: shut the meta caches of the refused update test down

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 10:30:23 -08:00
5e4b2fc42f docker: one FIPS mode for the Go processes and the Rust binaries (#13296)
* docker: one FIPS mode for the Go processes and the Rust binaries

In the image, Go processes ran with fips140=on by default (#7590) while the
Rust binaries, which take their mode from fips.mode alone, ran with
unrestricted TLS; and WEED_FIPS_MODE=off or strict made every Go process
refuse to start, since the entrypoint's fips140=on did not match.

The entrypoint now states the image's mode once, as
WEED_FIPS_MODE_DEFAULT=on, and gives Go processes the fips140 GODEBUG that
matches WEED_FIPS_MODE, else that default. The Rust binaries use the
default when neither WEED_FIPS_MODE nor fips.mode sets a mode; Go processes
check their GODEBUG against it and refuse to start on a mismatch, naming
WEED_FIPS_MODE as the way to pick another mode. Setting
WEED_FIPS_MODE_DEFAULT empty leaves every process in its own default, as
outside the image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docker: take the image's FIPS mode from a fips140 the caller sets

GODEBUG=fips140=off, the entrypoint's advice since #7590, made every Go
process exit once the Rust binaries joined the image's mode. The entrypoint
now maps the caller's fips140 to WEED_FIPS_MODE_DEFAULT, so Go and Rust run
in that mode and the old advice keeps working.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docker: say fips.mode alone cannot change the image's FIPS mode

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docker: read an empty fips140 as off and debug as on, as Go does

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docker: warn when GODEBUG fips140 picks the image's FIPS mode

The entrypoint keeps translating a caller's fips140 into the mode for the
Rust binaries, so existing docker run setups keep starting, but logs that
WEED_FIPS_MODE is the setting that also covers launches without the
entrypoint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docker: set the FIPS mode after dropping privileges

Running as root, the entrypoint re-runs itself through su-exec, and the
second pass took the fips140 the first pass had exported for the caller's
own, warning on default starts and prepending fips140 twice.

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>
2026-12-03 10:29:05 -08:00
D.Maier 8afef5166b sftp: serve reads on read-write opens instead of writing zeros (#13343) 2026-12-03 07:59:06 -08:00
0daa7558e2 filer: propagate HBase and remote child deletion errors (#13328)
* test/s3: FsMkdir no longer fails on its own in the rclone fstests

expected_failures.txt listed the test itself because DeleteBucket answered
BucketNotEmpty at the end of the run. Since #13311 a null delete marker can
be deleted, the bucket ends up empty, and the check has failed on master and
on every pull request the workflow runs for:

  TestIntegration/FsMkdir: now fails only through its subtests, remove it
  from expected_failures.txt

* filer/hbase: propagate errors when deleting directory children

* filer: reclaim HBase chunks after each confirmed row deletion

* filer: return a child's remote delete error from a recursive delete

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* filer: drop the per-row folder delete store capability

Keep the HBase scan and row-delete errors reaching the caller without a
new FilerStore capability. A store that fails partway through
DeleteFolderChildren leaves already-removed rows' chunks to volume.fsck,
as every non-transactional store already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 01:15:42 -08:00
f4290b5ec2 kms/local: resolve key and alias ARNs (#13331)
* kms/local: resolve key and alias ARNs

AWS KMS takes a key's or an alias's ARN wherever it takes a key ID or an
alias, and the local provider hands out ARNs in DescribeKey, but it looked
them up as plain names, so an ARN named no key. A local ARN now resolves to
the key or alias it names, in requests, in the keys list's key_id and
aliases, and in CreateKey's aliases. An ARN with an empty key ID names no
key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* kms/local: register a key created by ARN under its key ID

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* kms/local: refuse a key ARN listed as an alias

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* kms/local: refuse a key ID that is an ARN of an ARN

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* kms/local: resolve a key ARN only to the key with that ID

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* kms/local: create an on-demand key under the ID its ARN names

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* kms/local: decrypt keeps the key ARN a ciphertext was wrapped under

A key configured by its ARN had that ARN as its ID before key ARNs
resolved, and S3 stored it with each object and compares it with the
ID Decrypt returns.

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>
2026-12-03 01:12:44 -08:00
63e15ce1ea kms: take the default provider from the config being loaded (#13332)
* kms: take the default provider from the config being loaded

S3 wraps and unwraps data keys with the default provider alone. Without
default_provider, the loader made the first provider the manager listed
the global one, and the manager still holds the providers earlier loads
listed, so a reload could leave S3 on a provider the config dropped. The
manager's own default, which buckets without a mapping use, was left
unset. The default is now the first provider by name in the config being
loaded, for both. A default_provider that isn't listed under providers
fails the load before any provider changes, where before it could name a
provider left over from an earlier load. With more than one provider and
no default_provider the load logs a warning, as adding a provider whose
name sorts first would switch S3 to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* kms: load the default provider first and fail the load if it can't be loaded

A load whose default provider failed replaced and closed the other providers first, so S3
could be left on a closed instance of one of them as the global provider.

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>
2026-12-03 00:48:29 -08:00
Chris LuandClaude Opus 5.5 a7c1cc32ec s3api: fail closed when the directory marker lock check cannot read the marker (#13326)
* s3api: refuse a directory marker PUT when the existing marker cannot be read

Only a missing marker skips the Object Lock check. Any other lookup
error now fails the request instead of letting mkdir replace a marker
that may be under retention or legal hold.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: create the Extended map before applying upload ACL metadata

A directory extracted from a zip without an owner header reached
applyPutObjectACL with a nil Extended map and panicked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: refuse extracting over a marker that cannot be read

The zip extract mkdir path had the same fail-open lookup as the
directory marker PUT; a failed read now reports InternalError for the
member.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 23:51:58 -08:00
Chris LuandClaude Opus 5.5 d6d5e99f9b s3api: limit service account keys to their stored actions (#13325)
* s3api: limit service account keys to their stored actions

A service account created with an action subset authenticated as its
parent and was authorized with the parent's full permissions. Map each
restricted service account key to a copy of the parent that carries the
subset as a boundary, and check it in the S3, bucket listing and IAM
authorization paths. An empty action list still inherits the parent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: drop restricted service account keys with their removed parent

RemoveIdentity only dropped keys that mapped to the parent itself, so a
restricted service account key, which maps to its own bounded copy, kept
authenticating after the parent was deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* sts: keep restricted service account keys out of their parent's roles

A named role is admitted by its trust policy alone, so a service account
key limited to Read could assume any role trusting its parent and use the
role's permissions. Require the key's action subset to allow
sts:AssumeRole.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: let a service account's scoped upload listing grant pass its boundary

The upload and part listing routes are authorized as Read, and the
legacy path falls back to the listing grant. The boundary check now does
the same, so a service account limited to ListBucketMultipartUploads can
still list uploads without being allowed object reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* sts: refuse self sessions for restricted service account keys

AssumeRole without a RoleArn and GetFederationToken issue sessions that
carry the caller's own policies, which for a service account are its
parent's. A restricted key would shed its action subset that way, so
refuse both for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* sts: give the restricted service account role test its own role

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: check a restricted key's parent grants apart from its boundary

The boundary is checked against the request first, so the legacy action
check only has to cover the parent's grants. Checking the boundary there
again without the request denied a Read parent's upload listing to a key
limited to ListBucketMultipartUploads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 23:50:44 -08:00
Chris LuandClaude Opus 5.5 515b905011 s3notification: lose the test lock on the fetch of the records' partition (#13324)
TestALeadThatLostItsLockDoesNotSend dropped the forwarder lock on the
first fetch of any partition, then waited for a fetch of partition 0.
When another partition's goroutine fetched first, the lead stopped before
partition 0 was fetched and the wait timed out (seen on the 32-bit job).
The hook now gets the request and drops the lock on partition 0's fetch.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 23:47:50 -08:00
1606fe4f39 operation: resend an upload that hits a broken pipe on a stale connection (#13322)
* operation: resend an upload that hits a broken pipe on a stale connection

A pooled connection the server has closed fails an upload in one of three
ways, depending on when the close reaches the client. Two of them, a reset
and a closed connection, already get the request resent once with its body
rewound. A broken pipe did not.

A volume server closes a connection idle for 30 seconds and the client keeps
idle ones for 90, so a request that reuses a connection as it turns 30 seconds
old races with the close. The forward of a write to a replica makes a single
attempt: there the write failed with a 500, and the needle already stored on
the primary stayed on that one replica.

* seaweed-volume: resend a replica forward that hits a reset on a stale connection

The Rust replica forward made one attempt, so a pooled connection the peer
closed at its idle timeout failed the write with a broken pipe or a reset,
as the Go forward did before. Resend it once on a new connection, as Go's
upload_content does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 23:47:12 -08:00
Chris LuandClaude Opus 5.5 2f300c2969 s3api: keep the in-flight upload counters 64-bit aligned on 32-bit (#13321)
The recursiveListDeclined sync.Map placed ahead of inFlightDataSize and
inFlightUploads moved them off 8-byte alignment on 386, so the first
throttled upload panicked with "unaligned 64-bit atomic operation".
atomic.Int64 is aligned wherever it sits in the struct.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 23:46:20 -08:00
006885232e master: start file ids past the ones a previous master may have handed out (#13320)
* master: start file ids past the ones a previous master may have handed out

The file id sequence lives in memory. A master that starts, or takes over
as leader, continues it from what the volume servers report: the largest
needle id each of them holds. That is the largest id written, not the
largest one handed out, so the ids of uploads that had not landed when the
previous master was lost are handed out a second time.

Two uploads then hold one needle id in one volume with different cookies.
The one that lands second is refused, and deleting its file id, which goes
by needle id, removes the needle of the other: a file the filer had
answered 201 for lost its chunk on every replica that way.

A volume server's first report to a master now sets the sequence past its
largest needle id by a margin instead of right after it. Later reports
count as before, and a server that holds nothing adds no margin.

* master: shorten the unwritten file id margin comments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* master: record the file ids handed out through raft

Starting a margin past a volume server's first report does not hold for
two masters lost in a row: with nothing written in between, the second one
gets the same report and hands out the same id.

The master now records through raft how far it may hand file ids out
before it does (MaxVolumeIdCommand.FileIdCeiling, a step of 2^20 ids at a
time), and every master moves its sequence past what another one recorded,
from the log or from a snapshot. An id goes out only when it was drawn
under a ceiling this master recorded itself: recording one applies what
the masters before recorded first, so an id drawn after that is past all
of theirs, and one drawn before it is dropped.

A master that does not know the field ignores it. Snowflake ids are made
from the clock and are left alone.

* master: leave room for a file id draw larger than the ceiling step

A draw of more ids than fileIdCeilingStep never fit under the ceiling
recorded after it, so the assignment kept recording ceilings through raft.
The record now covers the dropped draw and the next one, and a count past
2^32 is refused before the additions can wrap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* master: tell a recorded file id ceiling apart from another master's

A master that took over could propose the same ceiling the one before it
recorded and it had not applied yet. Applying that entry then looked like
applying its own, so its sequence stayed below ids the other master had
handed out. Each record now carries an id of the master process, and only
an entry with that id and value leaves the sequence where it is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* master: charge assigned bytes only once the file id is recorded

An assignment that failed to record its file ids kept the bytes charged to
the volume, which could mark a volume near its limit full for an upload
that never came.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* master: move the sequence before publishing a file id ceiling

An assignment that loaded a ceiling another master recorded, before the
sequence had moved past it, could draw an id below it when this master had
proposed the same value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* master: test that a failed file id record charges the volume nothing

The order c40e01786 set. Before it, an assignment that could not record its
file ids left the volume charged for them: 1 MB for an id never handed out.

* sequence: stop the memory sequencer at the largest file id instead of wrapping

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* master: refuse a file id draw whose ceiling would wrap past the largest id

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 23:45:31 -08:00
217795e34c Continue prefix listings on unordered filer stores (#13330)
* filer: continue prefix listings on unordered stores

* test/s3: FsMkdir no longer fails on its own in the rclone fstests

expected_failures.txt listed the test itself because DeleteBucket answered
BucketNotEmpty at the end of the run. Since #13311 a null delete marker can
be deleted, the bucket ends up empty, and the check has failed on master and
on every pull request the workflow runs for:

  TestIntegration/FsMkdir: now fails only through its subtests, remove it
  from expected_failures.txt

(cherry picked from commit b248167800)

* filer: read unordered stores in full pages when filtering a prefix

An unordered store can have to be read to its end for a prefix, and
reading it in pages of the caller's limit (max-keys + 2 for S3) turned
one listing into a store query per few entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 23:31:01 -08:00
MapleWhiteZZZandMapleWhiteZZZ 390c5acc00 test/s3: FsMkdir no longer fails on its own in the rclone fstests (#13323)
expected_failures.txt listed the test itself because DeleteBucket answered
BucketNotEmpty at the end of the run. Since #13311 a null delete marker can
be deleted, the bucket ends up empty, and the check has failed on master and
on every pull request the workflow runs for:

  TestIntegration/FsMkdir: now fails only through its subtests, remove it
  from expected_failures.txt

Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
2026-12-02 23:29:28 -08:00
pingqiu-cpu cfd39b0b26 docs: v1.1 known limitation, list pages left after a volume delete (#977)
Interim merge note (spec trace workflow startup_failure since 22:45Z): docs-only change to the v1.1 release notes on release-1.1 (known limitation 7). go test (linux) and process-level tests (real binaries) passed on a07cebc3; spec-trace-check.sh and public-text-check.sh run locally with the base branch's scripts against this head and body (base release-1.1 at 4187ddaf): both pass. Docs review ACCEPT on a07cebc3 (accuracy and public text: no findings).
seaweed-block/v1.1.0
2026-12-02 21:39:25 -08:00
pingqiu-cpu 4187ddaffd docs: v1.1 known limitations (#973)
Interim merge note (spec trace workflow startup_failure since 22:45Z): docs-only change to the v1.1 release notes on release-1.1. go test (linux) and process-level tests (real binaries) passed on bc83e995; spec-trace-check.sh and public-text-check.sh run locally with the base branch's scripts against this head and body (base release-1.1 at a6304c21): both pass. Docs review ACCEPT on bc83e995 (accuracy and public text: no findings).
2026-12-02 20:05:19 -08:00