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);