chiark / gitweb /
mount: rework mount state engine
authorLennart Poettering <lennart@poettering.net>
Mon, 25 Sep 2017 17:13:37 +0000 (19:13 +0200)
committerSven Eden <yamakuzure@gmx.net>
Mon, 25 Sep 2017 17:13:37 +0000 (19:13 +0200)
This changes the mount unit state engine in the following ways:

1. The MOUNT_MOUNTING_SIGTERM and MOUNT_MOUNTING_SIGKILL are removed.
   They have been pretty much equivalent to MOUNT_UNMOUNTING_SIGTERM and
   MOUNT_UNMOUNTING_SIGKILL in what they do, and the outcome has been
   the same as well: the unit is stopped. Hence, let's simplify things a
   bit, and merge them. Note that we keep
   MOUNT_REMOUNTING_{SIGTERM|SIGKILL} however, as those states have a
   different outcome: the unit remains started.

2. mount_enter_signal() will now honour the SendSIGKILL= option of the
   mount unit if it was set. This was previously done already when we
   entered the signal states through a timeout, and was simply missing
   here.

3. A new helper function mount_enter_dead_or_mounted() is added that
   places the mount unit in either MOUNT_DEAD or MOUNT_MOUNTED,
   depending on what the kernel thinks about the mount's state. This
   function is called at various places now, wherever we finished an
   operation, and want to make sure our own state reflects again what
   the kernel thinks. Previously we had very similar code in a number of
   places and in other places didn't recheck the kernel state. Let's do
   that with the same logic and function at all relevant places now.

4. Rework mount_stop(): never forget about running control processes.
   Instead: when we have a start (i.e. a /bin/mount) process running,
   and are asked to stop, then enter the kill states for it, so that it
   gets cleaned up. This fixes #6048. Moreover, when we have a reload
   process running convert the possible states into the relevant
   unmounting states, so that we can properly execute the requested
   operation.

Fixes #6048

src/basic/unit-name.c
src/basic/unit-name.h

index 5d0069c931d2e7943f8e206d4d6571b1fe1fe37f..e64fe7007910572050152808493fc1d706a54908 100644 (file)
@@ -902,8 +902,6 @@ static const char* const mount_state_table[_MOUNT_STATE_MAX] = {
         [MOUNT_MOUNTED] = "mounted",
         [MOUNT_REMOUNTING] = "remounting",
         [MOUNT_UNMOUNTING] = "unmounting",
-        [MOUNT_MOUNTING_SIGTERM] = "mounting-sigterm",
-        [MOUNT_MOUNTING_SIGKILL] = "mounting-sigkill",
         [MOUNT_REMOUNTING_SIGTERM] = "remounting-sigterm",
         [MOUNT_REMOUNTING_SIGKILL] = "remounting-sigkill",
         [MOUNT_UNMOUNTING_SIGTERM] = "unmounting-sigterm",
index 67cd64785c0b06b035dc961e6dc4cdceb18b588e..cfe21474a44eb6fbd4bbe4fd1226b26d4107405d 100644 (file)
@@ -90,8 +90,6 @@ typedef enum MountState {
         MOUNT_MOUNTED,
         MOUNT_REMOUNTING,
         MOUNT_UNMOUNTING,
-        MOUNT_MOUNTING_SIGTERM,
-        MOUNT_MOUNTING_SIGKILL,
         MOUNT_REMOUNTING_SIGTERM,
         MOUNT_REMOUNTING_SIGKILL,
         MOUNT_UNMOUNTING_SIGTERM,