Skip to content

fix(satellite): refresh MetadataCreated with the resource's own name - #290

Merged
Aleksei Sviridkin (lexfrei) merged 4 commits into
mainfrom
fix/startup-dump-md-name
Nov 23, 2026
Merged

Aleksei Sviridkin (lexfrei) merged 4 commits into
mainfrom
fix/startup-dump-md-name

Conversation

@kvaps

Copy link
Copy Markdown
Member

What this fixes

The startup backfill that stamps the MetadataCreated Condition never stamped anything. It passed the Resource CR name, <rd>.<node>, to drbdadm dump-md, and drbdadm only knows the resource under the name the .res file gives it, the definition's key. Every probe failed with '<rd>.<node>' not defined in your config (for this host), logged as dump-md probe failed (best-effort) once per replica on every satellite start, and a replica missing the Condition kept missing it.

On the cluster where it was seen, a cluster adopted from LINSTOR, every DRBD replica already carries the Condition, stamped by the apply pass. The replicas without it are all storage-only ones, which have no DRBD metadata and need no Condition, and they were the source of the 16 to 20 failed probes per node on each start. There the change ends that noise. On a cluster where an apply pass failed to stamp the Condition, the backfill now does what it was meant to do.

Changes

  • The backfill probes the DRBD resource name the apply chain renders (naming.Key of the definition name, the same name the dispatcher puts in the desired resource), so the .res file is found and a replica with metadata is stamped MetadataFound.
  • It probes each volume (<rd>/<vol>) from the definition's volume list and stamps only when every volume has metadata. This is what ensureMetadata already does: a resource-wide dump-md stops at the first volume, so an attached volume 0 would vouch for an empty volume 1. LINSTOR also checks metadata per volume (DrbdLayer.hasMetaData).
  • Diskless replicas and definitions without a DRBD layer are skipped. They have no lower disk or no .res to probe, and with the right name they would otherwise log a failed probe on every start in place of the old one. An empty layer stack counts as the default DRBD-over-storage stack, as it does everywhere else in the satellite (rdNeedsDRBD): the controller leaves the stack unset when the group names none, which is the case for a definition adopted from LINSTOR in the default group.
  • The backfill and the resource reconciler now share a per-resource lock. The reconciler holds it for each apply pass, and the backfill probes and stamps under it. Until now the backfill never reached drbdmeta, so it could not race the reconciler; with the right name it can.

Why the lock

HasMD reads a lower disk it cannot open exclusively as one carrying metadata, because that is what an attached disk looks like. If the backfill misread a fresh disk that way and stamped it, firstActivation would turn false and create-md would never run for that replica. Two drbdadm dump-md calls on one resource cannot cause that: drbdmeta takes its per-minor lock before it opens the disk (dt_lock_drbd in main, ahead of the command's open), so the second waits up to a second or exits with lock on ... currently held by pid, which HasMD reports as an unrecognised failure and the caller retries. Other openers in the apply pass run outside that lock, though, such as the minor-less drbdmeta - calls and the storage layer's own tools. Proving each of them harmless is more fragile than not probing during an apply pass at all, which is also how LINSTOR behaves: its device manager never probes a resource while adjusting it.

The cost is that the startup backfill waits for an apply pass in progress on the same resource, and an apply pass waits for the backfill's few dump-md calls on it. Different resources do not wait for each other.

Behaviour notes

  • Replicas whose Condition is already True are not touched, as before. An adopted replica stamped CreateMdSucceeded before fix(satellite): reconcile a new resource within seconds on a busy node #277 keeps that Reason; the backfill only fills in a missing Condition.
  • The backfill reads the Conditions once, from its List at start. If an apply pass stamps CreateMdSucceeded between that List and the backfill reaching the replica, the backfill restamps it as MetadataFound. The Condition stays True and nothing reads the Reason, so only the audit trail changes.
  • A probe that reports an unclean activity log, or any failure it does not recognise, still leaves the Condition unstamped and logs it, now with the volume target as a field. The reconciler owns that case.
  • A definition whose empty stack is still waiting for the controller to pin its group's stack is probed with the default stack. If the group's stack has no DRBD layer, there is no .res yet and the probe logs a failure on that start; the replica is not stamped.

Interactions

Testing

  • make lint-config && make lint: 0 issues.
  • go test ./... with envtest assets: green, including the pkg/naming provenance guard.
  • New unit tests for the backfill against a fake drbdadm that answers like the real one:
    • the probe targets <rd>/<vol> for a plain and a hashed definition name, and the Condition reads MetadataFound (fails on the previous code, which probes <rd>.<node> and stamps nothing);
    • a replica whose volume 1 has no metadata stays unstamped even when the resource-wide probe succeeds (fails with a resource-wide probe);
    • diskless and storage-only replicas are not probed (fails on the previous code);
    • a definition with an empty layer stack is probed on every volume and stamped (fails when an empty stack is read as "no DRBD").
  • New lock tests, each checked to fail with its lock call removed:
    • every backfill dump-md runs while the resource's lock is held;
    • runApply holds the resource's lock while the apply pass creates the volume;
    • the backfill built by the manager shares the reconciler's lock set;
    • a nil lock set locks nothing.

Not tested

  • Not run on a live cluster. The failure, and which replicas lack the Condition, come from satellite logs and Resource and ResourceDefinition objects on the cluster where it was seen.
  • The drbdmeta lock ordering was read from the drbd-utils v9.29.0 source, not exercised against real disks.
  • The e2e suites were not run; none of them covers the startup backfill.

The startup backfill passed the Resource CR name, `<rd>.<node>`, to
`drbdadm dump-md`. The .res file defines the resource under the
definition's key, so drbdadm answered "not defined in your config" for
every replica and none was ever stamped: on an adopted cluster each
satellite start logged one failed probe per replica missing the
Condition, and those replicas kept no Condition at all.

Probe the name the apply chain renders, per volume as ensureMetadata
does, since a resource-wide dump-md answers for the first volume only
and an attached volume 0 would vouch for an empty volume 1. Diskless
replicas and definitions without a DRBD layer have nothing to probe
and are skipped instead of logging the same failure on every start.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
An empty layer stack means the default DRBD-over-storage stack: the
controller leaves it unset when the resource group names none, which
is the case for a definition adopted from LINSTOR in the default
group, and the apply chain renders a .res for it. The backfill read
an empty stack as "no DRBD" and skipped those replicas silently, so
their missing MetadataCreated Condition stayed missing. Use the same
check the resource reconciler uses.

The probe-failure log line also names the volume it probed.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The startup backfill now reaches drbdmeta, and HasMD reads a lower
disk it cannot open exclusively as one carrying metadata. Two drbdadm
probes of one resource are already kept apart by drbdmeta's per-minor
lock, which it takes before opening the disk. Lockless openers in the
apply pass are not, so a probe running beside a pass that is about to
create the metadata could stamp an empty volume, and that stamp turns
create-md off for the replica for good.

The reconciler now holds a per-resource lock for each apply pass, and
the backfill probes and stamps under the same lock. LINSTOR never
probes a resource while its device manager is adjusting it either.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 42db1147-f243-4cc6-a177-72deb95c05ba
Commits

Reviewing files that changed from the base of the PR and between a5810ee and 3d63773.

Files selected for processing: 7

  • pkg/satellite/controllers/config.go
  • pkg/satellite/controllers/manager.go
  • pkg/satellite/controllers/metadata_created_backfill.go
  • pkg/satellite/controllers/metadata_created_backfill_test.go
  • pkg/satellite/controllers/resource.go
  • pkg/satellite/controllers/resource_locks.go
  • pkg/satellite/controllers/resource_locks_internal_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The probe name now matches what the dispatcher renders, both sides lock the same key, and the per-volume probe matches LINSTOR's per-volume hasMetaData check. LGTM.

@kvaps
Andrei Kvapil (kvaps) changed the base branch from fix/satellite-new-resource-latency to main November 23, 2026 12:03

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same head as my earlier approval, which the retarget to main dismissed. The probe name matches what the dispatcher renders, both sides lock the same key, and the per-volume probe matches LINSTOR's per-volume hasMetaData check. It merges cleanly onto current main, and the reconciler setup main moved into setupReconcilers still shares the one ApplyLocks. LGTM.

Signed-off-by: Aleksei Sviridkin <f@lex.la>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Same patch as my approval at ab54040, merged with current main for a fresh CI run before merging.

@lexfrei
Aleksei Sviridkin (lexfrei) merged commit c18e3d8 into main Nov 23, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants