| Commit message (Collapse) | Author | Age |
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
registry from a mounted session
$NINE_MOUNT was the mountpoint either way: under --mntgen the registry,
each session at $NINE_MOUNT/<service>/<name>; under --unix the session
itself. A program working out its own session's directory (pardes's
$PARDES_MOUNT for its panes) could not tell which without statting the
mount. NINE_MNTGEN=1 now says so; an inherited one is dropped, so a 9ns
nested in a registry's program is not taken for one.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
mount
9ns served one FUSE request at a time per 9P server, so a read the server
parks (pardes's log, a pane's event) held up every other operation on the
mount: with 'cat log' parked, 'cat status' took 3.5-4.5 s instead of ~1 ms.
nine.zig: the session is shared by threads and multiplexes by tag the way
Plan 9's mount driver does (devmnt.c mountio/mountmux/mntgate/
mntflushalloc). Each thread calls through its own nine.Caller (reply buffer,
wake-up eventfd, interrupt source, ename). A call writes its T-message under
wlock; the first waiter with nobody reading takes the reading baton, reads
for everyone and hands each R-message to the caller its tag names, then
passes the baton on. Tflush is per tag: a reply that beats the Rflush is
honoured, the flushed tag is not reused before the Rflush, the baton is let
go before the flush is written. With every tag taken a call waits for one
(starved list) instead of failing.
bridge.zig: one thread (the loop) still owns the inode/handle/qid tables and
serves everything that touches them. READ and WRITE are resolved to their
fid on the loop and handed to transfer workers (up to 31 per bridge,
started on demand), which make the 9P calls on their own Caller and reply
themselves. FUSE_INTERRUPT for a worker's request: still queued -> EINTR on
the spot; in flight -> its unique down the worker's pipe -> Tflush of exactly
that tag. Fids are clunked only on RELEASE. mntgen mounts get the same pool
(their dispatcher routes interrupts to it); the mount interrupt pipe moved
into Bridge. main.zig attaches through a Caller.
Tests: two multiplexing tests in nine.zig (a parked read holds up only its
caller and its interrupt flushes exactly its tag; with every tag parked a
call waits for a tag), and a serve()-level test driving a fake /dev/fuse (a
parked READ holds up neither READs nor GETATTR; INTERRUPT -> one Tflush for
the parked tag -> EINTR; RELEASE). Also de-flaked the pre-existing
'short read' test (it raced its own server reply under load).
Measured (own 9ns mount on the live pardes socket, read-only): with log
parked, cat status 4498 ms before, 7 ms after.
Tag window: client.zig gains ClientWith(n) (Client = ClientWith(16) as
before; request/result types hoisted so all instantiations share them).
9ns uses ClientWith(32): 32 is fs.zig's default slot_capacity, so one 9ns
mount can never have more parked on a cloud9 fs server than it parks, and
never meets its "Resource temporarily unavailable" refusal. fs.zig is
unchanged (its default is also the ESP32 board's, held to 24 KiB by its
budget tests). Full window: the loop keeps its tag (metadata unaffected);
the 32nd READ/WRITE waits in the pool queue (blocks, interruptible, never
EAGAIN/EIO).
More tests (bridge.zig, serve() over a fake /dev/fuse): one open is one fid
(two opens of an inode read through distinct fids, concurrently, one of
them parked); FLUSH on a handle with a parked read clunks nothing and the
read later completes on that fid; only RELEASE clunks; a flushed READ whose
reply beats the Rflush returns the data, not EINTR.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
cloud9.post: servers post their socket under a name in
$XDG_RUNTIME_DIR/9p (post/unpost, posted, dial, Watch) and
serve.Runner.listenPosted posts a server by name, unposting on stop.
Names are budget-checked against the 108-byte socket path; a claim
binds+listens at a private temp path and takes the name with atomic
renames under flock (RENAME_NOREPLACE for free names, RENAME_EXCHANGE
grab-verify-commit for stale ones): the registry path is never unlinked
by a claim, live names refuse with AlreadyPosted, foreign files with
NotSocket, and unpost removes only the caller's inode-matched entry.
Watch surfaces inotify overflow and a replaced registry dir.
9ns --mntgen [--mount DIR] -- PROGRAM: one FUSE mount at /mnt/9p whose
synthetic root lists the posted registry (no connection made); a walk
into an unmounted name dials it and runs the existing bridge dispatch
in a per-server worker thread, routed by mount index in the node id's
top bits (ordinals never reused, cap 4096); a dead server answers EIO
on its subtree and is re-dialed on the next walk. The dial watches
stop_fd through Tversion (connectWatched). All existing 9ns forms are
unchanged.
9proc's unix listener no longer blind-unlinks its path: a foreign
non-socket is refused (Occupied), a live server is refused
(AlreadyListening), only a refused socket is cleared, and stop()
unlinks only the listener's own inode-matched socket.
Hardened by adversarial review (GLM 5.3 x2 + DeepSeek V4.1 Flash, all
high-thinking): double-bind races on one name (0 in 180k rounds),
foreign-file TOCTOU deletions (0 in 4M flips), a 255-byte-name listing
panic, inotify queue overflow silently dropped, listenPosted silently
overwriting, dial-time Tversion hangs wedging the dispatcher, --debug
silently ignored in mntgen, and xattr/statx probes answering EPERM on
the synthetic root (broke `ls -l /mnt/9p`).
Tests: root 80/80, 9ns 47/47, 9proc 60/60, integration 88/88 +
mntgen 37/37, adversarial 213/0, freestanding riscv32 gate green.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
as Tflush
- --name NAME (default derived from the transport: socket basename, tcp-IP-PORT,
spawned command, fdN) mounts at /mnt/9p/<name>; --mount still overrides.
ensureMountpoint walks down and creates missing components, shadowing the
deepest unwritable ancestor. NINE_MOUNT is the only exported variable.
- The inode number reported to the kernel is the 9P qid.path for every node,
root included; a server handing qid.path 1 to a file (Pardes /self) no
longer collides with the root.
- FUSE_INTERRUPT for the request in flight becomes Tflush; a blocked read
returns EINTR when the server answers the flush, chunked transfers return
short counts, other requests arriving meanwhile are stashed and served
next. Servers ignoring Tflush still block until they answer.
- 9ns-test now covers nine/bridge/fuse; new adv_bridge_interrupt suite (28);
9ns-itest grows to 88 checks.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
|
|
Directories, binaries, build options (-D9ns, -D9proc), step names, module
name (9proc), thread and fs names, env var NINEPLAYER_MOUNT -> NINE_MOUNT,
docs and test scripts. Browser assets move to web/static.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
|