diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-29 14:27:42 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-29 14:27:42 -0300 |
| commit | 46c3c5db5a9a32ec6c43ad23ba041126ead5bd07 (patch) | |
| tree | c498cd865ee0bc15df4d32ef35e5bad4009a8a8f /src | |
| parent | e9328a417ef82d72a73f5e3e7d182591616137de (diff) | |
| download | pardes-46c3c5db5a9a32ec6c43ad23ba041126ead5bd07.tar.gz pardes-46c3c5db5a9a32ec6c43ad23ba041126ead5bd07.zip | |
9p_io.zig: the /os table is not swept while a request is out in a syscall, which made a walk of a directory just made answer ENOENT
The tty frame's tick sweeps the table with the turn, but the turn comes
back to the editor after a step of its own with a 9P request still out
in a stat: the entry that request's walk had just made, which no fid
named yet, was freed under it, and the next element looked up nothing.
That was fs.py's one-in-a-few `/os` listing failure; walks of a fresh
directory against file churn in the session's directory failed 144 in
2799, and none in 4440 after.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src')
| -rw-r--r-- | src/9p_io.zig | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/9p_io.zig b/src/9p_io.zig index 5f22b326..9bcb2827 100644 --- a/src/9p_io.zig +++ b/src/9p_io.zig @@ -724,6 +724,12 @@ pub const Listener = struct { /// and only between the editor's steps: a step out in a syscall may be /// reading one of these entries. fn collectOs(l: *Listener) void { + // A request out in a host syscall may be using an entry's path, or + // made one that no fid names yet (a walk's next element): swept at + // the next quiet instead. Taken back after a step of its own, the + // editor's frame (tty pollFrame) came here with one out, and a walk + // of a directory just made was answered ENOENT. + if (pardes.turn.out != 0) return; const core = l.core; var i: usize = 0; while (i < core.fs.os_paths.items.len) { @@ -1760,6 +1766,15 @@ test "a listening editor posts itself into the 9P registry and unposts on stop" const n = libc.readlink(entry, &link, link.len); try testing.expect(n > 0); try testing.expectEqualStrings(sock, link[0..@intCast(n)]); + // A host path no fid names is swept, but never while a request is + // out in a syscall: it may be that request's, mid-walk. + try p.fs.os_paths.append(gpa, .{ .node = @import("fs.zig").os_node | 1, .path = try gpa.dupe(u8, "/tmp") }); + pardes.turn.out = 1; + l.collectOs(); + pardes.turn.out = 0; + try testing.expectEqual(@as(usize, 1), p.fs.os_paths.items.len); + l.collectOs(); + try testing.expectEqual(@as(usize, 0), p.fs.os_paths.items.len); } // Stopping takes the name back out, so the next editor of that name // is not refused by its own corpse; the lock goes with the socket. |
