]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/mount: pass "-c" flag to /bin/umount (#6093)
authorNeilBrown <neil@brown.name>
Wed, 7 Jun 2017 12:28:23 +0000 (22:28 +1000)
committerLennart Poettering <lennart@poettering.net>
Wed, 7 Jun 2017 12:28:23 +0000 (15:28 +0300)
"-c", which is short for "--no-canonicalize", tells /bin/umount
that the path name is canonical (no .. or symlinks etc).

systemd always uses a canonical name, so this flag is appropriate
for systemd to use.
Knowing that the path is canonical allows umount to avoid
some calls to lstat() on the path.

From v2.30 "-c" goes further and causes umount to avoid all
attempts to 'lstat()' (or similar) the path.  This is important
when automatically unmounting a filesystem, as lstat() can
hang indefinitely in some cases such as when an NFS server
is not accessible.

"-c" has been supported since util-linux 2.17 which is before the
earliest version supported by systemd.
So "-c" is safe to use now, and once util-linux v2.30 is in use,
it will allow mounts from non-responsive NFS servers to be
unmounted.

src/core/mount.c

index ca0c4b0d5eed59bfc75ec966d55fc1160bf13d3d..214364d87d2565aba498c9aaecf3ccfaeaf22066 100644 (file)
@@ -886,7 +886,7 @@ static void mount_enter_unmounting(Mount *m) {
         m->control_command_id = MOUNT_EXEC_UNMOUNT;
         m->control_command = m->exec_command + MOUNT_EXEC_UNMOUNT;
 
-        r = exec_command_set(m->control_command, UMOUNT_PATH, m->where, NULL);
+        r = exec_command_set(m->control_command, UMOUNT_PATH, m->where, "-c", NULL);
         if (r >= 0 && m->lazy_unmount)
                 r = exec_command_append(m->control_command, "-l", NULL);
         if (r >= 0 && m->force_unmount)