summaryrefslogtreecommitdiff
path: root/src/core/mount.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-11-11 02:31:29 +0100
committerTom Gundersen <teg@jklm.no>2015-11-11 02:31:29 +0100
commit7042fc14ff2bd30648aea6602c95d3cf6946e7be (patch)
tree9990f79bfe80bb0b9c8c6da94f62d66d5c7da97e /src/core/mount.c
parent620b7793fcbb23f6d27d42b0374d3dddb256aa40 (diff)
parentbe6d467c1f9219b2016d556a0a369828d463ca27 (diff)
Merge pull request #1837 from poettering/grabbag2
variety of fixes
Diffstat (limited to 'src/core/mount.c')
-rw-r--r--src/core/mount.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/core/mount.c b/src/core/mount.c
index 950d5d76d5..d3766ba934 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1596,7 +1596,7 @@ static int mount_get_timeout(Unit *u, uint64_t *timeout) {
return 1;
}
-static int mount_enumerate(Manager *m) {
+static void mount_enumerate(Manager *m) {
int r;
assert(m);
@@ -1608,29 +1608,40 @@ static int mount_enumerate(Manager *m) {
m->mount_monitor = mnt_new_monitor();
if (!m->mount_monitor) {
- r = -ENOMEM;
+ log_oom();
goto fail;
}
r = mnt_monitor_enable_kernel(m->mount_monitor, 1);
- if (r < 0)
+ if (r < 0) {
+ log_error_errno(r, "Failed to enable watching of kernel mount events: %m");
goto fail;
+ }
+
r = mnt_monitor_enable_userspace(m->mount_monitor, 1, NULL);
- if (r < 0)
+ if (r < 0) {
+ log_error_errno(r, "Failed to enable watching of userspace mount events: %m");
goto fail;
+ }
/* mnt_unref_monitor() will close the fd */
fd = r = mnt_monitor_get_fd(m->mount_monitor);
- if (r < 0)
+ if (r < 0) {
+ log_error_errno(r, "Failed to acquire watch file descriptor: %m");
goto fail;
+ }
r = sd_event_add_io(m->event, &m->mount_event_source, fd, EPOLLIN, mount_dispatch_io, m);
- if (r < 0)
+ if (r < 0) {
+ log_error_errno(r, "Failed to watch mount file descriptor: %m");
goto fail;
+ }
r = sd_event_source_set_priority(m->mount_event_source, -10);
- if (r < 0)
+ if (r < 0) {
+ log_error_errno(r, "Failed to adjust mount watch priority: %m");
goto fail;
+ }
(void) sd_event_source_set_description(m->mount_event_source, "mount-monitor-dispatch");
}
@@ -1639,11 +1650,10 @@ static int mount_enumerate(Manager *m) {
if (r < 0)
goto fail;
- return 0;
+ return;
fail:
mount_shutdown(m);
- return r;
}
static int mount_dispatch_io(sd_event_source *source, int fd, uint32_t revents, void *userdata) {