]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mount: make sure got into MOUNT_DEAD state after a successful umount (#3444)
authormichaelolbrich <m.olbrich@pengutronix.de>
Mon, 6 Jun 2016 19:59:51 +0000 (21:59 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 6 Jun 2016 19:59:51 +0000 (21:59 +0200)
Without this code the following can happen:
1. Open a file to keep a mount busy
2. Try to stop the corresponding mount unit with systemctl
   -> umount fails and the failure is remembered in mount->result
3. Close the file and umount the filesystem manually
   -> mount_dispatch_io() calls "mount_enter_dead(mount, MOUNT_SUCCESS)"
   -> Old error in mount->result is reused and the mount unit enters a
      failed state

Clear the old error result when 'mountinfo' reports a successful umount to
fix this.

src/core/mount.c

index 665a60bb550ddab8ff70600ebbbabb9ab1ab812e..8290ac859dc0a3fbc24f371a6fc722bf766d9573 100644 (file)
@@ -1706,6 +1706,7 @@ static int mount_dispatch_io(sd_event_source *source, int fd, uint32_t revents,
                                 /* This has just been unmounted by
                                  * somebody else, follow the state
                                  * change. */
+                                mount->result = MOUNT_SUCCESS;
                                 mount_enter_dead(mount, MOUNT_SUCCESS);
                                 break;