Blame SOURCES/0655-automount-handle-state-changes-of-the-corresponding-.patch

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