satellite: retry drbdadm secondary after mkfs on transient EBUSY#493
Open
IvanHunters wants to merge 1 commit into
Open
satellite: retry drbdadm secondary after mkfs on transient EBUSY#493IvanHunters wants to merge 1 commit into
IvanHunters wants to merge 1 commit into
Conversation
When LINSTOR promotes a DRBD device to Primary for mkfs and then demotes it back to Secondary, a block-device probe running concurrently (Talos machined/block-controller, udev, multipathd) may hold the device fd open long enough for drbdadm secondary to receive EBUSY: StorageException: Failed to become secondary again after creating filesystem drbdsetup secondary <res>: State change failed: (-12) Device is held open by someone The satellite never reports the final UpToDate event to the controller, so the controller view stays in SyncTarget/Inconsistent/DELETING permanently even though the DRBD kernel state is Established/UpToDate. This silently blocks cleanup of Released PVs and accumulates with every PVC creation. Fix: introduce secondaryAfterMkfs() — a wrapper around the secondary command that retries up to 7 times with exponential backoff (250 ms to 2 s) when the error is specifically Device is held open by someone. Any other failure still fails fast. DrbdPrimary.close() is updated to call this wrapper instead of secondary() so the retry applies only to the post-mkfs demotion, leaving all other secondary() callers unchanged. Probes release the fd within milliseconds in practice; the ~10 s retry window covers the worst-case timing. Fixes: LINBIT#268 Signed-off-by: ohotnikov.ivan <ohotnikov.ivan@e-queo.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On systems with active block-device probing (Talos machined/block-controller,
udev, multipathd) the kernel uevent for a freshly-promoted DRBD device causes
an external probe to
open()the device for superblock inspection. Ifdrbdadm secondaryfires while the probe still holds the fd, DRBD returns:The satellite never reports the final
UpToDateevent to the controller, sothe controller view stays stuck in
SyncTarget/Inconsistent/DELETINGpermanently —even though the DRBD kernel state on the satellite is
Established/UpToDate. Thissilently blocks cleanup of Released PVs and accumulates with every PVC creation.
Reproduced in production on Talos 1.10 / LINSTOR 1.33.2: 4 occurrences in 24 hours
across 3 nodes for different PVCs.
Fixes #268.
Fix
Introduce
secondaryAfterMkfs()inDrbdAdm— a wrapper that delegates to theexisting
execAdmCommandinfrastructure with an exponential-backoff retry executor:executeWithRetryOnDeviceHeldOpenretries only when stderr containsDevice is held open by someone; any other failure still throws immediately,preserving the existing contract
DrbdPrimary.close()(the post-mkfs demotion path) calls the new wrapper;all other
secondary()callers are untouchedProbes release the fd within milliseconds in practice; the ~10 s window covers
worst-case timing.