mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
33821f7a9f3e1795809af4341a237da447d379c2
Architect residual-risk note (round-9 review): iSCSI Target
opened the frontend.Backend at accept time, before login. Any
connection — including Discovery — blocked on Provider.Open's
ErrNotReady wait, so `iscsiadm -m discovery` against a
not-yet-Healthy volume would hang instead of returning
SendTargets. Called out as a future m01 compat risk, not a
reject, but small enough to close now.
Fix:
- Target.handleConn no longer opens the backend. It hands
Provider + VolumeID + HandlerConfig to newSession and
lets the session decide.
- Session.serve does login FIRST. After login:
Discovery session → skip backend open entirely;
serve Text/Logout/NOP-Out only.
Normal session → call Provider.Open; a failure (e.g.
ErrNotReady) closes the session
cleanly after login rather than
blocking at accept.
- Target shutdown watcher now cancels the session ctx in
addition to closing the conn — required so a Provider.Open
that only wakes on ctx.Done can unblock during
Target.Close (avoids shutdown deadlock in the
never-ready regression test).
core/frontend/iscsi/session.go
Session now carries provider + volumeID + hcfg + backend.
serve(): loginPhase → (SessionType==Normal ? Provider.Open
+ build SCSIHandler : skip) → fullFeatureLoop. close()
also closes the opened backend.
core/frontend/iscsi/target.go
handleConn hands provider/volumeID/hcfg to newSession;
shutdown watcher cancels ctx so blocked Open unblocks.
core/frontend/iscsi/discovery_without_backend_test.go (NEW)
Two regression tests:
- TestT2Route_ISCSI_DiscoveryDoesNotDependOnBackendReady:
target bound to a neverReadyProvider (Open blocks
forever until ctx done); Discovery session completes
login + SendTargets + assertion within 5s. Asserts
Provider.Open was called ZERO times during Discovery.
- TestT2Route_ISCSI_NormalSessionClosesWhenProviderNotReady:
Normal-session login completes within 2s even though
Open blocks indefinitely — proves login isn't gated
on backend readiness.
Tests green (no regressions):
core/frontend/iscsi: 56 tests (was 54; +2 residual-risk regs)
All other packages: unchanged.
Stop-rule audit: fix is mechanism-level, stays inside the ckpt 9
allowlist (no new auth / digest / storage / authority paths).
Signs-off tier unchanged (T2A-iSCSI-provisional).
Languages
Go
84.6%
Rust
7.8%
Shell
2.7%
templ
1.6%
Java
1%
Other
2%