Files
Auke Kok 4a8d2211fe Drain fences before starting client recovery
A newly elected leader fences the previous quorum leader as it's removed
from the quorum, and the same rid is also a mounted client that the new
server will scan and prepare for recovery. If that fence is still pending
when the 30s recovery timeout fires, the rid is fenced a second time and
the two fence requests collide on the rid-named sysfs dir.

Close the window at its source: reclaim the pending fences and wait for
them to fully drain before scanning the mounted client btree for
recovery. Reclaim removes a fenced rid from that btree, so once the fence
list is empty the previous leader is no longer a recovery candidate and
the recovery timeout can't fence it again.

Add scoutfs_fence_drained() as a non-blocking predicate in the fence
layer: it reports an empty pending list and surfaces any errored fence.
The server owns the wait in wait_for_fence_drain(), blocking on
server->waitq so it wakes promptly when the server stops.
queue_reclaim_work() moves ahead of start_recovery() so reclaim runs
during the drain.

Draining is only an optimization, since the existing fence dedup already
makes a double fence non-fatal. The backstop timeout is therefore best
effort: on a large system a single reclaim can legitimately run longer
than the timeout, and aborting a healthy reclaim would recreate the
recovery-failure loop we're avoiding. On timeout the server warns and
starts recovery anyway, letting reclaim finish in the background and dedup
absorb any double-submit. Startup is only aborted if a fence errored (the
node couldn't be fenced, so recovery isn't safe) or the server is already
stopping.

Signed-off-by: Auke Kok <auke.kok@versity.com>
2026-06-15 22:23:25 -07:00
..
2024-06-28 15:09:05 -07:00
2025-10-24 14:24:00 -04:00
2022-10-14 14:03:35 -07:00
2024-06-28 15:09:05 -07:00
2024-06-28 14:53:49 -07:00
2020-08-26 14:39:12 -07:00
2022-12-12 14:59:22 -08:00
2024-01-25 11:30:17 -08:00
2025-10-24 14:21:06 -04:00
2026-05-19 19:18:53 -07:00
2026-03-13 15:44:18 -07:00
2023-06-14 14:12:10 -07:00
2021-08-24 09:11:40 -07:00
2021-08-24 09:11:40 -07:00
2020-10-29 14:15:33 -07:00
2024-06-28 14:53:49 -07:00
2025-10-29 10:12:52 -07:00
2024-10-03 12:41:05 -07:00
2024-06-28 15:09:05 -07:00
2024-06-28 15:09:05 -07:00
2019-08-20 15:52:13 -07:00
2025-11-13 12:43:31 -08:00
2026-04-15 17:02:40 -07:00
2022-03-11 15:28:58 -08:00
2019-05-21 11:33:26 -07:00
2019-05-21 11:33:26 -07:00
2026-02-26 14:02:42 -05:00
2022-12-12 14:59:22 -08:00
2024-06-28 15:09:05 -07:00
2020-10-29 14:15:33 -07:00
2020-10-29 14:15:33 -07:00
2020-11-30 13:35:44 -08:00
2019-04-12 10:54:07 -07:00
2024-10-03 12:41:05 -07:00
2026-04-10 13:50:21 -07:00
2026-04-10 13:50:21 -07:00
2021-07-07 14:13:14 -07:00
2024-10-03 12:41:05 -07:00
2018-07-27 09:50:21 -07:00
2024-06-28 15:09:05 -07:00
2024-06-28 15:09:05 -07:00