The lock directory and its parent are chmod'ed only when this call's own
Mkdir created them, so an existing or concurrently created directory keeps
its mode; an existing lock path that is not a directory refuses (Lstat), as
the constructor did before. The invariant row links the mode tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A missing /run/sw-block is created 0755 and the locks directory 0700, with
the modes set explicitly (the umask cannot narrow them); existing
directories are left alone. The cure line also names the parent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The lock directory is created (0700) when missing; only a directory or
lock file that cannot be created or opened refuses, with the cure
(install the tmpfiles.d entry, or chown the directory and its lock files
to the unit's user).
- The lock file is opened read-only (an existing file first, created 0644
only when missing), so a lock file another user created stays lockable;
it is never unlinked, and the next owner locks the same file.
- A stale-root startup end carries its cure into the final exit line:
exiting status=78 reason=superseded cure="...".
- Tests: a cut's remote_lsn is locally durable at its HEAD CAS, and the
root's crash image at the CAS reattaches and serves; the rolled-back copy
makes no claim or PUT, admits no I/O, keeps its data and durable LSN; an
exact copy at HEAD attaches; a read-only lock file is taken.
- Invariants: INV-WS-ONE-PROCESS-PER-HOST-001 and its M4 edge; the
rollback row names its test file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
V1-SPEC r2.45.
(1) The provider takes an exclusive, non-blocking lock on
/run/sw-block/locks/<volume id>.lock before the volume's store opens and
releases it after the store closes (HostVolumeLock, set by blockvolume). A
missing directory refuses the provider with the cure; the tmpfiles.d
entry ships in deploy/systemd and both units may write it under
ProtectSystem=strict. --volume-lock-dir-test-only (hidden, refused under
systemd, warned at start) is for plain subprocess tests and harnesses.
(2) An existing root whose HEAD names this holder attaches only if its
local durable LSN reaches HEAD's remote_lsn; otherwise the existing
stale-root refusal, no retry (78 superseded), with the cure.
(3) docs/releases/one-process-per-volume.md: the lifecycle do-not list.
No HEAD change, no format bump, no new persisted file, no new exit reason.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The stop test now observes the worker's return on its own channel with
bounded joins on both paths (a re-check that ignores the stop fails in 12 s);
agent-workspace-design.md's supervisor diagram adds Serving -> Exit78 on a
runtime HEAD fence (head_fenced), independent of the lease.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
V1-SPEC r2.39: StorageBackend.AdmitsIO is the I/O gate itself (the backend
admits I/O AND the guarded projection names this lineage as the healthy
primary). /status FrontendPrimaryReady and NotReadyReason read it through
the provider (lease_not_held stays first; an unopened volume fails closed).
A workspace chunk primary's frontends start once AdmitsIO passes after the
backend first admitted I/O (firstAdmitted: a bounded 50 ms re-check until
first served, workspace primaries only; the backend has no projection-change
signal). Non-chunk volumes and supporting replicas start after open as
before (the #410 design condition, V1-SPEC r2.39), now pinned by a test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
INV-FE-PRIMARY-READY-OPERATIONAL-001 keeps the readiness and listen
property; the fence-to-exit bound is its own row, INV-FE-FENCE-EXIT-001,
stated as what is guaranteed: the fence's detection time (a HEAD fence:
50 ms) plus the existing 5 s cleanup bound from the decision. 307 rows,
221 ACTIVE.
Provider Close joins each layer's fence watcher through p.inflight
(counted under p.mu while not closed). C.W lists the two new waits.
The runtime-fence watcher test owns its worker: cleanup registered before
the start, the return joined with a bound on both paths.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A chunk layer that fences after startup (HEAD has another publication
owner) while the lease is still valid now latches the backend not
operational with that evidence, and the process owner chooses the
no-restart exit 78 head_fenced through processExit.choose. I/O is refused
from the fence itself.
The first-grant log line is written only for a reply that grants: a first
reply that revokes fences the guard and logs no grant.
The frontend-gate tests own their workers: cleanup is registered before
each worker starts and every receive is bounded.
docs/design/invariants.md: INV-WS-SERVE-LEASE-HELD-001 (V1-SPEC r2.37);
INV-FE-PRIMARY-READY-OPERATIONAL-001 statement within 300 characters, with
the runtime fence enforcement and tests; M1 diagram and table carry the
lease-held order and the runtime fence exit; C.W names the runVolume
receive of the stop waiter's result. 306 rows, 220 ACTIVE.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A workspace primary whose lease guard is missing or holds no granted lease
now reports NotReadyReason=lease_not_held first (the guard decides, through
the new WorkspaceLeaseGuard.Held, the lease term permits already used). The
guard logs its first grant once, as "re-granted after N refused renewal(s)"
when renewals were refused first (a restart before the forced-move barrier),
with the request-start time in unix_ms.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A restarted old holder (G-O2 r8) started its NVMe target unconditionally
at startup and reported FrontendPrimaryReady=true from the authority view
alone, before and after its chunk-layer claim was refused ("fenced, not
serving"). The admit gate refused every command with Namespace Not Ready,
but that status is retried on the same path and then fails to the guest,
and the path advertised ANA optimized, so a listening, ready-looking but
fenced target is not safe.
- status: FrontendPrimaryReady is false while the volume's local durable
backend admits no I/O (attach pending, fenced, detached), with the
backend's evidence in the new NotReadyReason; Healthy stays the authority
view.
- blockvolume: the iSCSI, NVMe and ublk targets start only once the backend
first admits I/O (awaitBackendAdmitsIO, 10 ms); signals and the workspace
lease guard now start before that wait, and a stop requested during it
skips the frontends and goes straight to shutdown.
INV-FE-PRIMARY-READY-OPERATIONAL-001 (304 rows, 218 ACTIVE); M1 Recovering
-> Serving names the guard.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Design review of #429 (V1-SPEC r2.40, INV-AUTH-HOLDER-IDENTITY-001, TERM-HOLDER-001):
- PublishedLine.Owner is the single owner decision (move-named server; move-named but
unknown; not from a move), called by Host.workspaceLineOwner and expectOwnerForLine.
- A move-minted line whose owner is unknown binds its replica to no server: no health,
endpoints or refresh from anyone (control: the placement server's fresh report changes
nothing). Only a line no move minted keeps the accepted topology.
- var _ lineOwnerReader = (*Publisher)(nil): dropping the method is a build error.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>