forked from pool/util-linux
47 lines
1.4 KiB
Diff
47 lines
1.4 KiB
Diff
|
Subject: umount: avoid calling readlink on mountpoints.
|
||
|
References: bnc#794529
|
||
|
|
||
|
We normally want to canonicalize a path given to umount
|
||
|
in case it contains symlinks. This ensure the right entry
|
||
|
is removed from /etc/mtab.
|
||
|
However if the mountpoint is for a non-responsive NFS server,
|
||
|
that readlink could hang (*will* have if mounted with -o noac).
|
||
|
|
||
|
In the normal case where no symlinks are used we don't need the
|
||
|
readlink() and we can easily detect this by checking if the
|
||
|
mount table contains the given name.
|
||
|
If it does, use the name as-is.
|
||
|
If it doesn't, then call canonicalize()
|
||
|
|
||
|
---
|
||
|
mount/umount.c | 10 ++++++++++
|
||
|
1 file changed, 10 insertions(+)
|
||
|
|
||
|
Index: util-linux-2.19.1/mount/umount.c
|
||
|
===================================================================
|
||
|
--- util-linux-2.19.1.orig/mount-deprecated/umount.c
|
||
|
+++ util-linux-2.19.1/mount-deprecated/umount.c
|
||
|
@@ -588,12 +588,22 @@ umount_file (char *arg) {
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
+ /* If the name given is listed in the mount table, don't
|
||
|
+ * bother with canonicalize() - it can block an a non-responsive
|
||
|
+ * NFS server.
|
||
|
+ */
|
||
|
+ file = arg;
|
||
|
+ mc = getmntdirbackward(arg, NULL);
|
||
|
+ if (!mc && !nocanonicalize)
|
||
|
file = canonicalize(arg); /* mtab paths are canonicalized */
|
||
|
+ else
|
||
|
+ file = strdup(arg);
|
||
|
|
||
|
try_loopdev:
|
||
|
if (verbose > 1)
|
||
|
printf(_("Trying to unmount %s\n"), file);
|
||
|
|
||
|
+ if (!mc)
|
||
|
mc = getmntdirbackward(file, NULL);
|
||
|
if (!mc) {
|
||
|
mc = getmntdevbackward(file, NULL);
|