diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-10-27 09:56:08 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-10-30 13:10:42 +0100 |
commit | acd156d197cd9593a0e27b185d1fa4fff2ad98a1 (patch) | |
tree | b8bfaf40f8b8f295b297436671b788639eb57639 | |
parent | bfeb927a55450be0a528d04051751478bc02572e (diff) | |
download | systemd-acd156d197cd9593a0e27b185d1fa4fff2ad98a1.tar.gz |
automount: make user unmounting for automount units more debuggable
Let's add an explicit log message plus an error state for automount
units, if users explicitly unmounted our autofs mount.
Prompted by: #17448
-rw-r--r-- | src/core/automount.c | 7 | ||||
-rw-r--r-- | src/core/automount.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/core/automount.c b/src/core/automount.c index 16b9104171..df32b8e6fb 100644 --- a/src/core/automount.c +++ b/src/core/automount.c @@ -971,6 +971,12 @@ static int automount_dispatch_io(sd_event_source *s, int fd, uint32_t events, vo assert(a); assert(fd == a->pipe_fd); + if (events & (EPOLLHUP|EPOLLERR)) { + log_unit_error(UNIT(a), "Got hangup/error on autofs pipe from kernel. Likely our automount point has been unmounted by someone or something else?"); + automount_enter_dead(a, AUTOMOUNT_FAILURE_UNMOUNTED); + return 0; + } + if (events != EPOLLIN) { log_unit_error(UNIT(a), "Got invalid poll event %"PRIu32" on pipe (fd=%d)", events, fd); goto fail; @@ -1070,6 +1076,7 @@ static const char* const automount_result_table[_AUTOMOUNT_RESULT_MAX] = { [AUTOMOUNT_FAILURE_RESOURCES] = "resources", [AUTOMOUNT_FAILURE_START_LIMIT_HIT] = "start-limit-hit", [AUTOMOUNT_FAILURE_MOUNT_START_LIMIT_HIT] = "mount-start-limit-hit", + [AUTOMOUNT_FAILURE_UNMOUNTED] = "unmounted", }; DEFINE_STRING_TABLE_LOOKUP(automount_result, AutomountResult); diff --git a/src/core/automount.h b/src/core/automount.h index 21dd1c0774..7a1234b88c 100644 --- a/src/core/automount.h +++ b/src/core/automount.h @@ -8,6 +8,7 @@ typedef struct Automount Automount; typedef enum AutomountResult { AUTOMOUNT_SUCCESS, AUTOMOUNT_FAILURE_RESOURCES, + AUTOMOUNT_FAILURE_UNMOUNTED, AUTOMOUNT_FAILURE_START_LIMIT_HIT, AUTOMOUNT_FAILURE_MOUNT_START_LIMIT_HIT, _AUTOMOUNT_RESULT_MAX, |