From 4558062cadfbe20bbfaf87f476f45cf46acd9d51 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 11 Sep 2026 01:36:07 +0000 Subject: [PATCH] core/automount: log when pending requests cannot be released When an automount goes away, answering the requests the kernel already queued is the only thing that unblocks the processes waiting on them, and nothing retries it later. If the `EHOSTDOWN` calls fail, it leaves the requesting processes hung with no trace in the journal. Log the failures to make this easier to debug. Also move that teardown into a helper function, the next commit needs it as well. Signed-off-by: Martin Pitt --- src/core/automount.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/core/automount.c b/src/core/automount.c index 29543590e4..f82c8d0a40 100644 --- a/src/core/automount.c +++ b/src/core/automount.c @@ -59,6 +59,23 @@ static void automount_init(Unit *u) { UNIT(a)->ignore_on_isolate = true; } +/* Nothing else can answer the requests the kernel already queued for us, and it keeps their processes + * blocked until we do. Make a failure to do so at least visible. The status is what the mount requests get: + * an expire request can only ever fail. */ +static void automount_release_requests(Automount *a, int status) { + int r; + + assert(a); + + r = automount_send_ready(a, a->tokens, status); + if (r < 0) + log_unit_warning_errno(UNIT(a), r, "Failed to release pending automount requests, ignoring: %m"); + + r = automount_send_ready(a, a->expire_tokens, -EHOSTDOWN); + if (r < 0) + log_unit_warning_errno(UNIT(a), r, "Failed to release pending automount expire requests, ignoring: %m"); +} + static void unmount_autofs(Automount *a) { int r; @@ -73,8 +90,7 @@ static void unmount_autofs(Automount *a) { /* If we reload/reexecute things we keep the mount point around */ if (!IN_SET(UNIT(a)->manager->objective, MANAGER_RELOAD, MANAGER_REEXECUTE)) { - automount_send_ready(a, a->tokens, -EHOSTDOWN); - automount_send_ready(a, a->expire_tokens, -EHOSTDOWN); + automount_release_requests(a, -EHOSTDOWN); if (a->where) { r = repeat_unmount(a->where, MNT_DETACH|UMOUNT_NOFOLLOW);