mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
5115cfc55442ef186ed99b1ffb9aa889d2c86bdf
Per T2 assignment §4.3 ckpt 9/10 allowlist: "Multi-PDU R2T /
large write support" — port smallest required R2T path, keep
writes routed through frontend.Backend.Write.
Why now, ahead of actual iscsiadm failure on m01: the R2T path
is mechanical and well-understood. Writes > FirstBurstLength
(default 64 KiB) are the common large-write case iscsiadm will
drive. Porting now removes an m01 blocker without expanding
scope beyond the allowlist. Stop-rule audit below confirms no
overreach.
core/frontend/iscsi/session.go
handleSCSICmd now handles three write shapes:
- No write (FlagW off or EDTL=0): metadata / read path
unchanged; dataOut = req.DataSegment (typically empty).
- Immediate-only write (EDTL <= len(immediate data)): fast
path, no R2T.
- Solicited write (EDTL > len(immediate)): target emits ONE
R2T covering the remainder; collects Data-Out PDU(s)
with strict DataSN + BufferOffset ordering; dispatches
the assembled payload as ONE Backend.Write call.
New collectWriteData() enforces V2's correctness invariants:
- DataSN sequential (no out-of-order)
- BufferOffset matches cumulative received
- Data-Out TTT matches R2T TTT (or 0xFFFFFFFF unsolicited
is rejected since we negotiate InitialR2T=Yes)
- F-bit only valid when received == EDTL
- Overflow past EDTL rejected with clear error
Stop-rule observance (§4.3): stale-lineage semantics UNCHANGED.
A stale backend's write error surfaces AFTER R2T assembly
completes, as CHECK CONDITION — never as silent ACK because
the R2T sequence ran cleanly. This is pinned by
TestT2Route_ISCSI_LargeWrite_OnStaleBackend_RejectsAfterR2T.
T2 scope: single R2T for all remaining bytes (no MaxBurst
chunking). V2 supports multi-R2T per MaxBurstLength — we'll
port that ONLY if iscsiadm on m01 actually exposes the need.
core/frontend/iscsi/client_support_test.go
scsiCmdFull() is the new extended form: EDTL = len(immediate)
+ len(solicited). When the target emits R2T, the client feeds
the solicited bytes via one Data-Out PDU matching the R2T's
offset/length. Simpler legacy scsiCmd() is now a thin wrapper
that passes nil for solicited (preserves ckpt 4 call sites).
core/frontend/iscsi/t2_large_write_test.go (NEW, sw regression)
3 tests:
- TestT2Route_ISCSI_LargeWrite_R2TPath_Component:
16-block (8 KiB) write with only 4 blocks (2 KiB) immediate.
Target emits R2T; client feeds the other 12 blocks via
Data-Out. Asserts: exactly 1 Backend.Write, offset 0,
bytes exactly match a deterministic (i % 251) payload.
READ(10) round-trip verifies data landed at correct LBA.
- TestT2Route_ISCSI_LargeWrite_OnStaleBackend_RejectsAfterR2T:
stale backend + large write. R2T sequence still runs
(protocol correctness) but SCSI-Response is CHECK
CONDITION. Pins the stop-rule: R2T completion is NOT
commit authorization.
- TestT2Route_ISCSI_ImmediateOnlyWrite_StillWorks:
regression guard — 1-block immediate-only writes bypass
R2T as before. WriteCount=1, status Good.
Tests green (no regressions):
core/frontend/iscsi: 68 tests (was 65; +3 ckpt 10)
All other packages: unchanged.
Stop-rule audit (§4.3):
- Inside allowlist: multi-PDU R2T for writes ✓
- Did NOT port: V2 dataio.go multi-PDU Data-In splitting
(read-side chunking is separate from R2T; not an allowlist
item; not needed until an OS initiator exposes it)
- Did NOT weaken stale W/R semantics
- Did NOT introduce V2 authority / storage / WAL / retry paths
- Did NOT introduce MaxBurst chunking (smallest-required)
Sign-off tier: T2A-iSCSI-provisional unchanged. Ckpt 10 is
preparatory; product-ready promotion still gated on L2-OS
critical cells (i2/i3) on m01.
Languages
Go
84.5%
Rust
7.9%
Shell
2.7%
templ
1.6%
Java
1%
Other
2%