mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
28e9636edb7323ff7fa0e266f02193344bc22fb5
Checkpoint 6 mirrors iSCSI checkpoints 1+2 for the NVMe/TCP
protocol. L1/L2 for NVMe come in later checkpoints.
cmd/blockvolume/main.go
Small follow-up on T2A-iSCSI-provisional sign-off note:
emit a stderr line "iscsi enabled: t1-readiness auto-enabled"
when --iscsi-listen implicitly flips the readiness bridge on.
Keeps operators from misreading the auto-enable as silent.
core/frontend/nvme/errors.go (NEW)
NVMe status vocabulary for T2:
SCT types (Generic, CommandSpecific, MediaDataInteg, PathRelated,
VendorSpecific)
Generic SCs: Success, InvalidOpcode, InvalidField, InternalError,
LBAOutOfRange, CapacityExceeded, NamespaceNotReady.
PathRelated SCs: ANA PersistLoss / Inaccessible / Transition.
StatusError type carrying (SCT, SC, Reason) with Error() and
EncodeStatusField() that packs SCT/SC into the 16-bit CQE
status field (SC<<1 | SCT<<9 per NVMe base spec §4.6.1).
Canonical constructors:
NewStaleLineage() -> SCT=3 (PathRelated) + SC=0x03 (ANA Transition)
— semantic match for authority-move
transition; Linux nvme driver treats this
as a path-retry condition.
NewBackendClosed() -> SCT=3 + SC=0x02 (ANA Inaccessible)
— distinct from stale-lineage so logs
disambiguate the two fail modes.
NewInvalidField(sc, reason) -> SCT=0 + caller SC.
Symmetric with iscsi/errors.go's ALUA 0x04/0x0A vs 0x04/0x00
distinction (see earlier checkpoint 2 note).
core/frontend/nvme/io.go (NEW)
IOHandler dispatches NVMe IO Read/Write/Flush to a
frontend.Backend. Opcode set intentionally minimal for L0 scope;
Identify / SetFeatures / fabric admin land with capsule framing
in a later checkpoint.
IOCommand is the normalized form (Opcode, NSID, SLBA, NLB, Data).
IOResult.AsError() returns nil on Success or a *StatusError.
mapBackendError: ErrStalePrimary -> ANA Transition;
ErrBackendClosed -> ANA Inaccessible;
other -> Internal Error (fail-closed).
LBA-range + NSID + short-data validation BEFORE backend call
(fail closed). NLB=0 is invalid in our one-based form (zero-based
on wire, one-based in IOCommand for readability).
core/frontend/nvme/io_test.go (QA-owned, test-spec §4 n1..n4)
T2.L0.n1 CommandReadWrite_UsesFrontendBackend: Read + Write
route through RecordingBackend, single invocation, exact
offset + data.
T2.L0.n2 StaleWrite_ReturnsProtocolFailure: non-Success,
SCT=3 SC=3 (ANA Transition).
T2.L0.n3 StaleRead_ReturnsProtocolFailure: non-Success,
zero data bytes (MUST NOT leak stale bytes), ANA Transition.
T2.L0.n4 InvalidInput_FailsClosed: table-driven — LBA past
end, LBA overflow, short data, NLB=0, unknown NSID. Each
fails at handler, backend never invoked.
Plus sw-added regressions:
BackendClosed_DistinctFromStale pins the ANA Transition vs
ANA Inaccessible distinction.
UnknownOpcode_ReturnsInvalidOpcode (fail-closed on 0x7f).
Flush_SuccessInT2Scope (no-op).
IOResult.AsError_NilOnSuccess + SupportsErrorsAs.
core/frontend/nvme/boundary_guard_test.go (QA-owned, test-spec n5+n6)
T2.L0.n5 + n6 AST guard: full-parse + alias-resolution (same
shape as iSCSI's boundary guard). Extends PCDD-STUFFING-001
coverage to core/frontend/nvme. No core/authority, no
core/adapter, no authority-minting composite literal, no
dot-import bypass.
Tests green (no regressions):
core/frontend/nvme: 17 tests (errors 7 + boundary 1 + io 9)
core/frontend/iscsi: unchanged (31)
All other packages: unchanged.
Sign-off tier: T2B-NVMe checkpoint 6 (L0 foundation). L1 + L2
arrive in checkpoints 7-8; T2B-NVMe-provisional pending L2-harness
(checkpoint 8).
Languages
Go
84.5%
Rust
7.9%
Shell
2.7%
templ
1.6%
Java
1%
Other
2%