summaryrefslogtreecommitdiff
path: root/src/manager.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-07-13 19:01:20 +0200
committerLennart Poettering <lennart@poettering.net>2010-07-13 19:01:20 +0200
commit9f611ad82e1eb1a9885f07ac95c244b25a7fbac7 (patch)
treee0826c50fcb39a85fecb575d13bc5f64a9f6caf8 /src/manager.c
parent4c633005eacdf964d22107f453ba804868f33a25 (diff)
unit: disable retroactive starting/stopping of units when deserializing
Diffstat (limited to 'src/manager.c')
-rw-r--r--src/manager.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/manager.c b/src/manager.c
index 9667e299f3..cdcd6935cd 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -544,6 +544,12 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
manager_build_unit_path_cache(m);
+ /* If we will deserialize make sure that during enumeration
+ * this is already known, so we increase the counter here
+ * already */
+ if (serialization)
+ m->n_deserializing ++;
+
/* First, enumerate what we can from all config files */
r = manager_enumerate(m);
@@ -556,6 +562,11 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
if ((q = manager_coldplug(m)) < 0)
r = q;
+ if (serialization) {
+ assert(m->n_deserializing > 0);
+ m->n_deserializing --;
+ }
+
/* Now that the initial devices are available, let's see if we
* can write the utmp file */
manager_write_utmp_reboot(m);
@@ -2334,7 +2345,7 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
log_debug("Deserializing state...");
- m->deserializing = true;
+ m->n_deserializing ++;
for (;;) {
Unit *u;
@@ -2366,7 +2377,8 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
r = 0;
finish:
- m->deserializing = false;
+ assert(m->n_deserializing > 0);
+ m->n_deserializing --;
return r;
}
@@ -2402,6 +2414,8 @@ int manager_reload(Manager *m) {
if ((q = lookup_paths_init(&m->lookup_paths, m->running_as)) < 0)
r = q;
+ m->n_deserializing ++;
+
/* First, enumerate what we can from all config files */
if ((q = manager_enumerate(m)) < 0)
r = q;
@@ -2417,6 +2431,9 @@ int manager_reload(Manager *m) {
if ((q = manager_coldplug(m)) < 0)
r = q;
+ assert(m->n_deserializing > 0);
+ m->n_deserializing ++;
+
finish:
if (f)
fclose(f);