|
|
a9339c |
From b4f506932592b991363b8be11e40b62f861bd032 Mon Sep 17 00:00:00 2001
|
|
|
e79001 |
From: Michael Olbrich <m.olbrich@pengutronix.de>
|
|
|
e79001 |
Date: Fri, 24 Jul 2015 22:25:28 +0200
|
|
|
e79001 |
Subject: [PATCH] automount: handle state changes of the corresponding mount
|
|
|
e79001 |
unit correctly
|
|
|
e79001 |
|
|
|
e79001 |
The expire timeout must be started/stopped if the corresponding mount unit
|
|
|
e79001 |
changes its state, e.g. it is started via local-fs.target or stopped by a
|
|
|
e79001 |
manual umount.
|
|
|
e79001 |
|
|
|
e79001 |
(cherry picked from commit 3dbadf9ef96e76f1bc472660ba5435dc0fa27a66)
|
|
|
e79001 |
|
|
|
e79001 |
Resolves: #1596241
|
|
|
e79001 |
---
|
|
|
e79001 |
src/core/automount.c | 9 +++++----
|
|
|
e79001 |
1 file changed, 5 insertions(+), 4 deletions(-)
|
|
|
e79001 |
|
|
|
e79001 |
diff --git a/src/core/automount.c b/src/core/automount.c
|
|
|
a9339c |
index 08519e49c..f57782b9b 100644
|
|
|
e79001 |
--- a/src/core/automount.c
|
|
|
e79001 |
+++ b/src/core/automount.c
|
|
|
e79001 |
@@ -499,6 +499,7 @@ static int automount_send_ready(Automount *a, Set *tokens, int status) {
|
|
|
e79001 |
|
|
|
e79001 |
int automount_update_mount(Automount *a, MountState old_state, MountState state) {
|
|
|
e79001 |
_cleanup_close_ int ioctl_fd = -1;
|
|
|
e79001 |
+ int r;
|
|
|
e79001 |
|
|
|
e79001 |
assert(a);
|
|
|
e79001 |
|
|
|
e79001 |
@@ -506,6 +507,9 @@ int automount_update_mount(Automount *a, MountState old_state, MountState state)
|
|
|
e79001 |
case MOUNT_MOUNTED:
|
|
|
e79001 |
case MOUNT_REMOUNTING:
|
|
|
e79001 |
automount_send_ready(a, a->tokens, 0);
|
|
|
e79001 |
+ r = automount_start_expire(a);
|
|
|
e79001 |
+ if (r < 0)
|
|
|
e79001 |
+ log_unit_warning_errno(UNIT(a)->id, r, "Failed to start expiration timer, ignoring: %m");
|
|
|
e79001 |
break;
|
|
|
e79001 |
case MOUNT_DEAD:
|
|
|
e79001 |
case MOUNT_UNMOUNTING:
|
|
|
e79001 |
@@ -518,6 +522,7 @@ int automount_update_mount(Automount *a, MountState old_state, MountState state)
|
|
|
e79001 |
case MOUNT_FAILED:
|
|
|
e79001 |
if (old_state != state)
|
|
|
e79001 |
automount_send_ready(a, a->tokens, -ENODEV);
|
|
|
e79001 |
+ (void) sd_event_source_set_enabled(a->expire_event_source, SD_EVENT_OFF);
|
|
|
e79001 |
break;
|
|
|
e79001 |
default:
|
|
|
e79001 |
break;
|
|
|
e79001 |
@@ -768,10 +773,6 @@ static void automount_enter_running(Automount *a) {
|
|
|
e79001 |
goto fail;
|
|
|
e79001 |
}
|
|
|
e79001 |
|
|
|
e79001 |
- r = automount_start_expire(a);
|
|
|
e79001 |
- if (r < 0)
|
|
|
e79001 |
- log_unit_warning_errno(UNIT(a)->id, r, "Failed to start expiration timer, ignoring: %m");
|
|
|
e79001 |
-
|
|
|
e79001 |
automount_set_state(a, AUTOMOUNT_RUNNING);
|
|
|
e79001 |
return;
|
|
|
e79001 |
|