summaryrefslogtreecommitdiff
path: root/mount.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-11 00:22:36 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-11 00:22:36 +0200
commit5e94833f4193890f27b30591965970627d645247 (patch)
tree9dd036abaa509fe854cc70b65acf0baeace63dc7 /mount.c
parent601f6a1e820462b1df6ff632d112bef241d556b1 (diff)
service,mount,socket: explicitly unwatch control pids
Diffstat (limited to 'mount.c')
-rw-r--r--mount.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/mount.c b/mount.c
index d52c11d3ca..5a386a6116 100644
--- a/mount.c
+++ b/mount.c
@@ -65,6 +65,16 @@ static const char* const state_string_table[_MOUNT_STATE_MAX] = {
[MOUNT_MAINTAINANCE] = "maintainance"
};
+static void service_unwatch_control_pid(Mount *m) {
+ assert(m);
+
+ if (m->control_pid <= 0)
+ return;
+
+ unit_unwatch_pid(UNIT(m), m->control_pid);
+ m->control_pid = 0;
+}
+
static void mount_parameters_done(MountParameters *p) {
assert(p);
@@ -91,10 +101,7 @@ static void mount_done(Unit *u) {
exec_command_done_array(m->exec_command, _MOUNT_EXEC_COMMAND_MAX);
m->control_command = NULL;
- if (m->control_pid > 0) {
- unit_unwatch_pid(u, m->control_pid);
- m->control_pid = 0;
- }
+ service_unwatch_control_pid(m);
unit_unwatch_timer(u, &m->timer_watch);
}
@@ -322,12 +329,7 @@ static void mount_set_state(Mount *m, MountState state) {
state != MOUNT_REMOUNTING_SIGTERM &&
state != MOUNT_REMOUNTING_SIGKILL) {
unit_unwatch_timer(UNIT(m), &m->timer_watch);
-
- if (m->control_pid > 0) {
- unit_unwatch_pid(UNIT(m), m->control_pid);
- m->control_pid = 0;
- }
-
+ service_unwatch_control_pid(m);
m->control_command = NULL;
}
@@ -505,6 +507,8 @@ static void mount_enter_unmounting(Mount *m, bool success) {
NULL)) < 0)
goto fail;
+ service_unwatch_control_pid(m);
+
if ((r = mount_spawn(m, c, &m->control_pid)) < 0)
goto fail;
@@ -549,6 +553,8 @@ static void mount_enter_mounting(Mount *m, bool success) {
if (r < 0)
goto fail;
+ service_unwatch_control_pid(m);
+
if ((r = mount_spawn(m, c, &m->control_pid)) < 0)
goto fail;
@@ -620,6 +626,8 @@ static void mount_enter_remounting(Mount *m, bool success) {
goto fail;
}
+ service_unwatch_control_pid(m);
+
if ((r = mount_spawn(m, c, &m->control_pid)) < 0)
goto fail;