teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame 0074-core-mount-pass-c-flag-to-bin-umount-6093.patch

Zbigniew Jędrzejewski-Szmek d743bb
From e0a8e194a2e3ca0a405dadfcbc9b5347e46fe8c0 Mon Sep 17 00:00:00 2001
Zbigniew Jędrzejewski-Szmek d743bb
From: NeilBrown <neil@brown.name>
Zbigniew Jędrzejewski-Szmek d743bb
Date: Wed, 7 Jun 2017 22:28:23 +1000
Zbigniew Jędrzejewski-Szmek d743bb
Subject: [PATCH] core/mount: pass "-c" flag to /bin/umount (#6093)
Zbigniew Jędrzejewski-Szmek d743bb
Zbigniew Jędrzejewski-Szmek d743bb
"-c", which is short for "--no-canonicalize", tells /bin/umount
Zbigniew Jędrzejewski-Szmek d743bb
that the path name is canonical (no .. or symlinks etc).
Zbigniew Jędrzejewski-Szmek d743bb
Zbigniew Jędrzejewski-Szmek d743bb
systemd always uses a canonical name, so this flag is appropriate
Zbigniew Jędrzejewski-Szmek d743bb
for systemd to use.
Zbigniew Jędrzejewski-Szmek d743bb
Knowing that the path is canonical allows umount to avoid
Zbigniew Jędrzejewski-Szmek d743bb
some calls to lstat() on the path.
Zbigniew Jędrzejewski-Szmek d743bb
Zbigniew Jędrzejewski-Szmek d743bb
From v2.30 "-c" goes further and causes umount to avoid all
Zbigniew Jędrzejewski-Szmek d743bb
attempts to 'lstat()' (or similar) the path.  This is important
Zbigniew Jędrzejewski-Szmek d743bb
when automatically unmounting a filesystem, as lstat() can
Zbigniew Jędrzejewski-Szmek d743bb
hang indefinitely in some cases such as when an NFS server
Zbigniew Jędrzejewski-Szmek d743bb
is not accessible.
Zbigniew Jędrzejewski-Szmek d743bb
Zbigniew Jędrzejewski-Szmek d743bb
"-c" has been supported since util-linux 2.17 which is before the
Zbigniew Jędrzejewski-Szmek d743bb
earliest version supported by systemd.
Zbigniew Jędrzejewski-Szmek d743bb
So "-c" is safe to use now, and once util-linux v2.30 is in use,
Zbigniew Jędrzejewski-Szmek d743bb
it will allow mounts from non-responsive NFS servers to be
Zbigniew Jędrzejewski-Szmek d743bb
unmounted.
Zbigniew Jędrzejewski-Szmek d743bb
(cherry picked from commit 83897d5470190a9818df50026cf38cd97114f77d)
Zbigniew Jędrzejewski-Szmek d743bb
---
Zbigniew Jędrzejewski-Szmek d743bb
 src/core/mount.c | 2 +-
Zbigniew Jędrzejewski-Szmek d743bb
 1 file changed, 1 insertion(+), 1 deletion(-)
Zbigniew Jędrzejewski-Szmek d743bb
Zbigniew Jędrzejewski-Szmek d743bb
diff --git a/src/core/mount.c b/src/core/mount.c
Zbigniew Jędrzejewski-Szmek d743bb
index ca0c4b0d5e..214364d87d 100644
Zbigniew Jędrzejewski-Szmek d743bb
--- a/src/core/mount.c
Zbigniew Jędrzejewski-Szmek d743bb
+++ b/src/core/mount.c
Zbigniew Jędrzejewski-Szmek d743bb
@@ -886,7 +886,7 @@ static void mount_enter_unmounting(Mount *m) {
Zbigniew Jędrzejewski-Szmek d743bb
         m->control_command_id = MOUNT_EXEC_UNMOUNT;
Zbigniew Jędrzejewski-Szmek d743bb
         m->control_command = m->exec_command + MOUNT_EXEC_UNMOUNT;
Zbigniew Jędrzejewski-Szmek d743bb
 
Zbigniew Jędrzejewski-Szmek d743bb
-        r = exec_command_set(m->control_command, UMOUNT_PATH, m->where, NULL);
Zbigniew Jędrzejewski-Szmek d743bb
+        r = exec_command_set(m->control_command, UMOUNT_PATH, m->where, "-c", NULL);
Zbigniew Jędrzejewski-Szmek d743bb
         if (r >= 0 && m->lazy_unmount)
Zbigniew Jędrzejewski-Szmek d743bb
                 r = exec_command_append(m->control_command, "-l", NULL);
Zbigniew Jędrzejewski-Szmek d743bb
         if (r >= 0 && m->force_unmount)