anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

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

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