X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fautomount.c;h=e685c96a76ab7206b9407484d9a92bc89c652169;hp=934aa5f35d78dc83716a56433d0ff3d4e8e28838;hb=b9975629f03a43d4c6b14fdb42eb8dd5a30af28f;hpb=73c33e7f225f81e6066386fba997e8ea2ba361b3 diff --git a/src/automount.c b/src/automount.c index 934aa5f35..e685c96a7 100644 --- a/src/automount.c +++ b/src/automount.c @@ -146,6 +146,23 @@ static int automount_add_mount_links(Automount *a) { return 0; } +static int automount_add_default_dependencies(Automount *a) { + int r; + + assert(a); + + if (a->meta.manager->running_as == MANAGER_SYSTEM) { + + if ((r = unit_add_dependency_by_name(UNIT(a), UNIT_AFTER, SPECIAL_SYSINIT_TARGET, NULL, true)) < 0) + return r; + + if ((r = unit_add_two_dependencies_by_name(UNIT(a), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0) + return r; + } + + return 0; +} + static int automount_verify(Automount *a) { bool b; char *e; @@ -201,9 +218,8 @@ static int automount_load(Unit *u) { if ((r = unit_add_dependency(u, UNIT_BEFORE, UNIT(a->mount), true)) < 0) return r; - if (a->meta.default_dependencies && - a->meta.manager->running_as == MANAGER_SYSTEM) - if ((r = unit_add_two_dependencies_by_name(UNIT(a), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0) + if (a->meta.default_dependencies) + if ((r = automount_add_default_dependencies(a)) < 0) return r; } @@ -552,6 +568,13 @@ static void automount_enter_runnning(Automount *a) { dbus_error_init(&error); + /* We don't take mount requests anymore if we are supposed to + * shut down anyway */ + if (a->meta.job && a->meta.job->type == JOB_STOP) { + automount_send_ready(a, -EHOSTDOWN); + return; + } + mkdir_p(a->where, a->directory_mode); /* Before we do anything, let's see if somebody is playing games with us? */