R-25 (controller half): drive init mounts the filesystem UUID the agent verified
agentapi FormatResult / FormatStatusResult gain fs_uuid (agent R-25 half). runStorageInit mounts it — from the synchronous answer or the polled status — instead of re-resolving the UUID from the /dev path, so a node that moved between format and mount cannot redirect the mount. An agent that sends no field keeps the old resolve, logged as a WARN each time (the window is open then). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
@@ -150,7 +150,18 @@ func (s *Server) runStorageInit(ctx context.Context, agent diskAgent, device, fs
|
||||
// 2. Resolve the NEW fs UUID. A freshly-formatted RAW device isn't in /disks (not enrolled yet), so
|
||||
// resolve via the raw-device scan too (Impl-2b) — the device now appears there with its new durable_id.
|
||||
setP(storageInitPhaseMounting)
|
||||
uuid := resolveEnrollUUID(ctx, agent, device)
|
||||
// R-25: mount the filesystem the AGENT says it made — it sends fs_uuid only while the format's
|
||||
// durable id still names the formatted device, so a /dev node that moved between the format and
|
||||
// the mount cannot redirect the mount. The path-based resolve stays as the fallback for an agent
|
||||
// that sends no field (older than the R-25 agent half); that fallback re-opens the narrow window,
|
||||
// so it is logged loudly every time it is taken. Pinned by TestR25_InitMountsTheAgentsFSUUID.
|
||||
uuid := fr.FSUUID
|
||||
if uuid == "" {
|
||||
uuid = resolveEnrollUUID(ctx, agent, device)
|
||||
s.logger.Printf("[WARN] [web] enroll %s: the agent sent no fs_uuid with the format (an agent older than the R-25 half, or it could not verify the device still matches) — resolved the UUID from the device path instead (%q); the /dev re-enumeration window is OPEN for this enroll", device, uuid)
|
||||
} else {
|
||||
s.logger.Printf("[INFO] [web] enroll %s: mounting the agent-verified new filesystem %s", device, uuid)
|
||||
}
|
||||
if uuid == "" {
|
||||
return storageInitResult{}, util.MsgError("err.web.formazas_kesz_de_az_uj_fajlrendszer")
|
||||
}
|
||||
@@ -238,7 +249,7 @@ func (s *Server) awaitAgentFormat(ctx context.Context, agent diskAgent, device s
|
||||
consecutiveErrs = 0
|
||||
switch st.Phase {
|
||||
case "done": // the agent's format-job terminal phases (internal/localapi/formatjob.go)
|
||||
return agentapi.FormatResult{Device: device, Formatted: true}, nil
|
||||
return agentapi.FormatResult{Device: device, Formatted: true, FSUUID: st.FSUUID}, nil
|
||||
case "failed":
|
||||
return agentapi.FormatResult{}, util.MsgError("err.web.formazas_sikertelen_2", st.Error)
|
||||
case "idle":
|
||||
|
||||
Reference in New Issue
Block a user