block layer: a read or a writeback that fails is refused, not taken as blank or dropped (#187)

A disk header that cannot be read refuses the attach (BLK_EIO, with a
message naming the disk by size); it was taken as blank and offered for
a format. A data read that fails is refused, not cached as zeros. An
eviction whose writeback fails keeps the slot and refuses the new one;
the changes were lost. test_host_blocks, a device whose reads can fail:
7 of 65 failed against the old code, 65 pass (63 at 32 bits). The
test's own errors (a detached device not reopened; two devices declared
out of the later checks' scope) corrected. ident_attach_fail on amd64:
the attach refused; its two failures left are #179's. The five write
results still thrown away are reported, not changed. Gates pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
Claude
2026-11-21 00:37:33 +00:00
parent 20918f9f09
commit 63e9966abc
9 changed files with 1949 additions and 10 deletions
@@ -0,0 +1,187 @@
[=3h[=3h[=3hBdsDxe: loading Boot0001 "UEFI QEMU DVD-ROM QM00005 " from PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x2,0xFFFF,0x0)
BdsDxe: starting Boot0001 "UEFI QEMU DVD-ROM QM00005 " from PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x2,0xFFFF,0x0)
[=3hStarKernel UEFI Loader
Loading kernel from ESP...
[CKPT 001] Entered efi_main - ConOut live
RAW SERIAL UP
[CKPT 002] Serial (COM1) initialized
Monolithic build - kernel linked directly
Collecting boot information...
CmdLine: parsed OK
[CKPT 004] Command line parsed
[CKPT 005] Kernel stack allocation decided
[CKPT 006] Boot info collected (ACPI table located)
GOP: linear framebuffer found
[CKPT 007] GOP: linear framebuffer found
[CKPT 008] About to enter ExitBootServices retry loop
EBS...
EBS OK
Calling kernel_main (monolithic)...
_____ _ _ __ _
/ ____| | | |/ / | |
| (___ | |_ __ _ _ __| ' / ___ _ __ _ __ ___| |
\___ \| __/ _` | '__| < / _ \ '__| '_ \ / _ \ |
____) | || (_| | | | . \ __/ | | | | | __/ |
|_____/ \__\__,_|_| |_|\_\___|_| |_| |_|\___|_|
LithosAnanke v4.0.0-alpha.5 amd64
Architecture: amd64
Build: Nov 20 2026 22:57:30
UEFI BootServices: EXITED
Console: serial line is a 16550 at port 0x00000000000003f8 (COM1, probed)
=== StarKernel Boot Information ===
Memory map entries: 128
Total memory: 1023 MB
Usable memory: 964 MB
===================================
PMM initialized.
PMM statistics:
Total pages: 248378
Free pages : 246851
Used pages : 1527
Total MB : 970
Free MB : 964
Used MB : 5
VMM initialized (mapped RAM, CR3 switched)
VMM initialized (mapped RAM, CR3 switched)
VMM self-test: mapped OK at 0xffff800000000000
VMM self-test complete.
IDT installed.
APIC: init...
APIC: IA32_APIC_BASE MSR=0x00000000fee00900
APIC: stale-ISR drain: 0 EOI(s) issued
APIC: initialized (xAPIC MMIO, TPR=0, SIVR=0x1FF, EOI-clear)
APIC: init done
I/O APIC: init...
I/O APIC: base=0xfec00000, gsi_base=0, overrides=5
override: source=00 gsi=2 flags=0x0000
override: source=05 gsi=5 flags=0x000d
override: source=09 gsi=9 flags=0x000d
override: source=0a gsi=10 flags=0x000d
override: source=0b gsi=11 flags=0x000d
i8042: keyboard ACKed enable-scanning
i8042: IRQ1 enabled in controller config byte
I/O APIC: keyboard IRQ1 routed (masked)
Timer: init...
Timer: init start
Timer: PM_TMR_BLK discovered from FADT at port 1544
Timer: VM mode detected (hypervisor present).
Timer: HPET calibration disabled (VM-exit MMIO would poison timing).
Timer: WARNING: invariant TSC not present under hypervisor.
Timer: continuing in RELATIVE mode (no determinism guarantees).
Timer: RDTSCP not present; using RDTSC (less serialized).
Timer: CPUID frequency unavailable; trying PM Timer...
Timer: trust=1 (0=NONE,1=REL,2=ABS), TSC=2091557639 Hz
Timer: init done
Kernel heap initialized.
Heap statistics:
Total bytes: 536870872
Free bytes: 536870872
Used bytes: 0
Peak bytes: 0
Heap base addr: 24641536
Heap end addr: 561512448
Heartbeat: init...
APIC Timer: calibrating...
APIC Timer: apic_hz=1008194418, tick_hz=100, initial_count=10081944
APIC Timer: configured (masked, ready to start)
Heartbeat: init done
Kernel initialization complete.
Boot successful!
Boot disk: not a StarshipOS stick
System: StarForth v4 (this build's default)
Stadium: 83886 cells (5242 KB), 50 VM slots
Switch-signal: 50 slots
Kernel-Hermes: 50 channel slots
Kernel-Hermes: 50 pending-queue slots
StarForth v4: Hera, born in the kernel's fabric
V4: capsule v4:sys:map-64.f18 signature: missing (unsigned)
PARITY:V4_F18 name=v4:sys:map-64.f18 capsule_hash=0x81bda2bfcf496f6a
V4: capsule v4:sys:core.f18 signature: missing (unsigned)
PARITY:V4_F18 name=v4:sys:core.f18 capsule_hash=0x0f415502fccc3fba
V4: capsule v4:sys:input.f18 signature: missing (unsigned)
PARITY:V4_F18 name=v4:sys:input.f18 capsule_hash=0x0f13c3f9d5fd07fc
V4: capsule v4:sys:dict.f18 signature: missing (unsigned)
PARITY:V4_F18 name=v4:sys:dict.f18 capsule_hash=0xe3453808afd5a0af
V4: capsule v4:sys:codegen.f18 signature: missing (unsigned)
PARITY:V4_F18 name=v4:sys:codegen.f18 capsule_hash=0x36d2ae84d2911b90
V4: capsule v4:sys:compile.f18 signature: missing (unsigned)
PARITY:V4_F18 name=v4:sys:compile.f18 capsule_hash=0xbef95acf00cb404a
V4: capsule v4:sys:quit.f18 signature: missing (unsigned)
PARITY:V4_F18 name=v4:sys:quit.f18 capsule_hash=0x7fa7a7668b6bf1ed
V4: capsule v4:sys:forth.f18 signature: missing (unsigned)
PARITY:V4_F18 name=v4:sys:forth.f18 capsule_hash=0xc4c0ad315c95eda4
V4: capsule v4:sys:numout.f18 signature: missing (unsigned)
PARITY:V4_F18 name=v4:sys:numout.f18 capsule_hash=0xca0fb0f9c1589e20
V4: capsule v4:sys:words.f18 signature: missing (unsigned)
PARITY:V4_F18 name=v4:sys:words.f18 capsule_hash=0x2f4e5f7f3e7f736f
V4: capsule v4:sys:system.f18 signature: missing (unsigned)
PARITY:V4_F18 name=v4:sys:system.f18 capsule_hash=0xfe257eb084c43a5d
V4: capsule v4:sys:qmath.f18 signature: missing (unsigned)
PARITY:V4_F18 name=v4:sys:qmath.f18 capsule_hash=0xa93783c2c8f9b7db
V4: capsule v4:sys:blocks.f18 signature: missing (unsigned)
PARITY:V4_F18 name=v4:sys:blocks.f18 capsule_hash=0x09d361dbe6174236
V4: capsule v4:sys:log.f18 signature: missing (unsigned)
PARITY:V4_F18 name=v4:sys:log.f18 capsule_hash=0x544cd004233dff62
V4: capsule v4:sys:acl.f18 signature: missing (unsigned)
PARITY:V4_F18 name=v4:sys:acl.f18 capsule_hash=0x5ceb5b43b0c5fbb1
V4: capsule v4:sys:end.f18 signature: missing (unsigned)
PARITY:V4_F18 name=v4:sys:end.f18 capsule_hash=0x22eea18b132f8faf
PARITY:V4_ROM words=2383 rom_hash=0xd858ef412d684f92 instructions=63864013
V4: capsule v4:forth79.4th signature: missing (unsigned)
PARITY:V4_CAPSULE name=v4:forth79.4th capsule_id=0x4609d6ef54166ef8 capsule_hash=0x4609d6ef54166ef8 dict_hash=0xbfcb975ac5a745f2
V4: capsule v4:starshipos.4th signature: missing (unsigned)
PARITY:V4_CAPSULE name=v4:starshipos.4th capsule_id=0x1734a8f4fe7483a5 capsule_hash=0x1734a8f4fe7483a5 dict_hash=0x75401e63fcca3f0d
V4: capsule v4:centre.4th signature: missing (unsigned)
PARITY:V4_CAPSULE name=v4:centre.4th capsule_id=0x53b1e3df644e8e25 capsule_hash=0x53b1e3df644e8e25 dict_hash=0xc22f69bd157a4a70
V4: capsule v4:hera.4th signature: missing (unsigned)
PARITY:V4_CAPSULE name=v4:hera.4th capsule_id=0x78730b1d6effe892 capsule_hash=0x78730b1d6effe892 dict_hash=0x17a3406cec07df1e
V4: capsule v4:physics.4th signature: missing (unsigned)
PARITY:V4_CAPSULE name=v4:physics.4th capsule_id=0xb26da18d35ce5a84 capsule_hash=0xb26da18d35ce5a84 dict_hash=0x7c80c30f0ef456c6
PARITY:V4_POST tests=992 pass=992 fail=0
PARITY:V4_SYSTEM word_count=407 dict_hash=0x7c5a2f0c02145e63
V4: capsule v4:init.4th signature: missing (unsigned)
V4: capsule v4:ACL.4th signature: missing (unsigned)
INFO: ACL: active
PARITY:V4_CAPSULE name=v4:init.4th capsule_id=0x13fe8932fa4d2934 capsule_hash=0x13fe8932fa4d2934 dict_hash=0x1a816036149f1574
PARITY:OK
POST: PASSED
PCI: init...
PCI: ECAM mapped (amd64)
virtio-rng: no device on PCI bus 0
rng: backend = rdrand
entropy: ready
virtio-input: no device on PCI bus 0
Starting heartbeat...
APIC Timer: started (LVT=0x00020020 ICR=10081944)
I/O APIC: keyboard IRQ1 unmasked
Heartbeat running.
Stadium opcodes: 31 resident, hottest opcode 8
Stadium words: promotions=271 evictions=0
Stadium conservation: resident_sum=43680 reservoir=21856 sum=65536 (Q48_ONE=65536)
Stadium conservation: CONSERVED
Stadium quota grant self-test: OK
Hera reservoir=21856
test-vm reservoir=65536
Heartbeat: 3 ticks, trust=0x00010000, variance=0x00000000
blkio_usb: MSC device ready
Artemis: the stick's partition attached
[HADES][WARN ] [KRELTSC: 0] blk: a disk of 512000 KiB: its header could not be read -- not
xhci: USB MSC block-subsystem attach failed
blkio_usb: MSC device ready
Artemis: the stick's partition attached
[Hera] Zuse: genesis minted onto attached thumbdrive
[zuse@Hera] ok> 
+9
View File
@@ -0,0 +1,9 @@
make: Entering directory '/home/user/LithosAnanke/v4'
cd /home/user/LithosAnanke/v4/build/v3o && cc -std=gnu99 -Wall -O2 -g -I/home/user/LithosAnanke/v3/include -I/home/user/LithosAnanke/kernel/include -c /home/user/LithosAnanke/v3/src/block_subsystem.c /home/user/LithosAnanke/v3/src/blkio_ram.c /home/user/LithosAnanke/v3/src/blkio_file.c /home/user/LithosAnanke/v3/src/log.c /home/user/LithosAnanke/v3/src/platform/platform_init.c /home/user/LithosAnanke/v3/src/platform/linux/time.c
ld -r /home/user/LithosAnanke/v4/build/v3o/*.o -o /home/user/LithosAnanke/v4/build/v3blocks.o
cc -std=c99 -Wall -Wextra -Wpedantic -Werror -O2 -g -I/home/user/LithosAnanke/v4/include -isystem /home/user/LithosAnanke/v3/include -isystem /home/user/LithosAnanke/kernel/include -DV4_CELL_BITS=32 -DV4_NODE_WORDS=32768 -DV4_DATA_RING=1022 -DV4_RET_RING=31 -DV4_ROM_WORDS=4096 -DV4_CAPSULE_DIR='"/home/user/LithosAnanke/v4/capsule"' -DV4_SYS_DIR='"/home/user/LithosAnanke/capsules/v4/sys"' -DV4_ROM_LINKED -DV4_ROM_SYM='"/home/user/LithosAnanke/v4/build/rom-32.sym"' -DV4_MESH_ROM_SYM='"/home/user/LithosAnanke/v4/build/mesh-rom-32.sym"' /home/user/LithosAnanke/v4/tests/test_host_blocks.c /home/user/LithosAnanke/v4/src/artifact.c /home/user/LithosAnanke/v4/src/asm.c /home/user/LithosAnanke/v4/src/capsule.c /home/user/LithosAnanke/v4/src/effect.c /home/user/LithosAnanke/v4/src/exec.c /home/user/LithosAnanke/v4/src/fabric.c /home/user/LithosAnanke/v4/src/guard.c /home/user/LithosAnanke/v4/src/heat.c /home/user/LithosAnanke/v4/src/image.c /home/user/LithosAnanke/v4/src/iword.c /home/user/LithosAnanke/v4/src/manage.c /home/user/LithosAnanke/v4/src/message.c /home/user/LithosAnanke/v4/src/node.c /home/user/LithosAnanke/v4/src/place.c /home/user/LithosAnanke/v4/src/stack.c /home/user/LithosAnanke/v4/src/testcode.c /home/user/LithosAnanke/v4/src/text.c /home/user/LithosAnanke/v4/src/umul.c /home/user/LithosAnanke/v4/src/wire.c /home/user/LithosAnanke/v4/system/blocks.c /home/user/LithosAnanke/v4/system/post.c /home/user/LithosAnanke/v4/system/post_cases.c /home/user/LithosAnanke/kernel/src/capsule/capsule_blocks.c /home/user/LithosAnanke/v4/build/v3blocks.o /home/user/LithosAnanke/v4/build/rom-32.c /home/user/LithosAnanke/v4/build/mesh-rom-32.c -o /home/user/LithosAnanke/v4/build/32-test_host_blocks.c
[V4_CELL_BITS=32 run-32-test_host_blocks.c]
v4 block request tests: V4_CELL_BITS=32, V4_NODE_WORDS=32768
63 checks, 0 failures
make: Leaving directory '/home/user/LithosAnanke/v4'
exit 0
+5
View File
@@ -0,0 +1,5 @@
cc -std=c99 -Wall -Wextra -Wpedantic -Werror -O2 -g -I/home/user/LithosAnanke/v4/include -isystem /home/user/LithosAnanke/v3/include -isystem /home/user/LithosAnanke/kernel/include -DV4_CELL_BITS=64 -DV4_NODE_WORDS=32768 -DV4_DATA_RING=1022 -DV4_RET_RING=31 -DV4_ROM_WORDS=4096 -DV4_CAPSULE_DIR='"/home/user/LithosAnanke/v4/capsule"' -DV4_SYS_DIR='"/home/user/LithosAnanke/capsules/v4/sys"' -DV4_ROM_LINKED -DV4_ROM_SYM='"/home/user/LithosAnanke/v4/build/rom-64.sym"' -DV4_MESH_ROM_SYM='"/home/user/LithosAnanke/v4/build/mesh-rom-64.sym"' /home/user/LithosAnanke/v4/tests/test_host_blocks.c /home/user/LithosAnanke/v4/src/artifact.c /home/user/LithosAnanke/v4/src/asm.c /home/user/LithosAnanke/v4/src/capsule.c /home/user/LithosAnanke/v4/src/effect.c /home/user/LithosAnanke/v4/src/exec.c /home/user/LithosAnanke/v4/src/fabric.c /home/user/LithosAnanke/v4/src/guard.c /home/user/LithosAnanke/v4/src/heat.c /home/user/LithosAnanke/v4/src/image.c /home/user/LithosAnanke/v4/src/iword.c /home/user/LithosAnanke/v4/src/manage.c /home/user/LithosAnanke/v4/src/message.c /home/user/LithosAnanke/v4/src/node.c /home/user/LithosAnanke/v4/src/place.c /home/user/LithosAnanke/v4/src/stack.c /home/user/LithosAnanke/v4/src/testcode.c /home/user/LithosAnanke/v4/src/text.c /home/user/LithosAnanke/v4/src/umul.c /home/user/LithosAnanke/v4/src/wire.c /home/user/LithosAnanke/v4/system/blocks.c /home/user/LithosAnanke/v4/system/post.c /home/user/LithosAnanke/v4/system/post_cases.c /home/user/LithosAnanke/kernel/src/capsule/capsule_blocks.c /home/user/LithosAnanke/v4/build/v3blocks.o /home/user/LithosAnanke/v4/build/rom-64.c /home/user/LithosAnanke/v4/build/mesh-rom-64.c -o /home/user/LithosAnanke/v4/build/64-test_host_blocks.c
[V4_CELL_BITS=64 run-64-test_host_blocks.c]
v4 block request tests: V4_CELL_BITS=64, V4_NODE_WORDS=32768
65 checks, 0 failures
exit 0
Binary file not shown.
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,33 @@
LOG: logs/20261120-225815/amd64/qemu-amd64-20261120-225815.log
PASS: POST: PASSED
[23:03:03.694] INFO: blk: disk 'StarForth Volume' v2 LBN 2048..777305 (775258 user blocks); devblocks=264704 bam=6144 base=6146 total=775290 free=775258 fence=128
[23:03:03.785] INFO: blk: disk 'StarForth Volume' v2 LBN 2048..777305 (775258 user blocks); devblocks=264704 bam=6144 base=6146 total=775290 free=775258 fence=128
PASS: no ok> for 20 s with no drive
FAIL: Zuse: the stick's identity partition failed -- not used
--- serial log, after /Artemis|Zuse|xhci/, line 186 (logs/20261120-225815/amd64/qemu-amd64-20261120-225815.log):
186 | Artemis: the stick's partition attached
187 | \x1b[33m[HADES][WARN ] \x1b[0m[KRELTSC: 0] blk: a disk of 512000 KiB: its header could not be read -- not
188 | xhci: USB MSC block-subsystem attach failed
---
--- the CPUs, 1 of 3: RIP=000000003d2d4105 RFL=00000287 [--S--PC] CPL=0 II=0 A20=1 SMM=0 HLT=1
the code at the PC: 000000003d2d4105: 0x0f2e66c3 0x0000841f 0xf3000000 0xfafa1e0f 000000003d2d4115: 0xfffffeb8 0x0f64e6ff 0xfa00401f 0x66fcebf4
--- the CPUs, 2 of 3: RIP=000000003d2d4105 RFL=00000283 [--S---C] CPL=0 II=0 A20=1 SMM=0 HLT=1
the code at the PC: 000000003d2d4105: 0x0f2e66c3 0x0000841f 0xf3000000 0xfafa1e0f 000000003d2d4115: 0xfffffeb8 0x0f64e6ff 0xfa00401f 0x66fcebf4
--- the CPUs, 3 of 3: RIP=000000003d2d4105 RFL=00000283 [--S---C] CPL=0 II=0 A20=1 SMM=0 HLT=1
the code at the PC: 000000003d2d4105: 0x0f2e66c3 0x0000841f 0xf3000000 0xfafa1e0f 000000003d2d4115: 0xfffffeb8 0x0f64e6ff 0xfa00401f 0x66fcebf4
FAIL: Artemis: the stick's partition let go -- both or neither
--- serial log, after /Artemis|Zuse|xhci/, line 186 (logs/20261120-225815/amd64/qemu-amd64-20261120-225815.log):
186 | Artemis: the stick's partition attached
187 | \x1b[33m[HADES][WARN ] \x1b[0m[KRELTSC: 0] blk: a disk of 512000 KiB: its header could not be read -- not
188 | xhci: USB MSC block-subsystem attach failed
---
--- the CPUs, 1 of 3: RIP=000000003d2d4105 RFL=00000297 [--S-APC] CPL=0 II=0 A20=1 SMM=0 HLT=1
the code at the PC: 000000003d2d4105: 0x0f2e66c3 0x0000841f 0xf3000000 0xfafa1e0f 000000003d2d4115: 0xfffffeb8 0x0f64e6ff 0xfa00401f 0x66fcebf4
--- the CPUs, 2 of 3: RIP=000000003d2d4105 RFL=00000287 [--S--PC] CPL=0 II=0 A20=1 SMM=0 HLT=1
the code at the PC: 000000003d2d4105: 0x0f2e66c3 0x0000841f 0xf3000000 0xfafa1e0f 000000003d2d4115: 0xfffffeb8 0x0f64e6ff 0xfa00401f 0x66fcebf4
--- the CPUs, 3 of 3: RIP=000000003d2d4105 RFL=00000283 [--S---C] CPL=0 II=0 A20=1 SMM=0 HLT=1
the code at the PC: 000000003d2d4105: 0x0f2e66c3 0x0000841f 0xf3000000 0xfafa1e0f 000000003d2d4115: 0xfffffeb8 0x0f64e6ff 0xfa00401f 0x66fcebf4
PASS: no ok> for 20 s with the faulty stick
PASS: the same stick, without the fault: genesis
PASS: [zuse@Hera] ok>
RESULT: FAIL