1
0
forked from pool/util-linux
util-linux/umount-avoid-readlink.patch
Marcus Meissner 1806747cca Accepting request 226509 from home:sbrabec:branches:Base:System
- Merge fixes and features from SLE11 (bnc#831868):
  * Detect squashfs version <= 3 as squashfs3 and version >= 4 as
    squashfs. (mszeredi@suse.cz,
    util-linux-ng-2.16-squashfs3-detect.patch, bnc#666893)
  * add sfdisk-warn-about-2TB-limit.patch (puzel@novell.com,
    bnc#495657)
  * Document barrier option in mount.8 (jack@suse.cz,
    hvogel@suse.de,
    util-linux-ng-2.19.1-barrier_documentation.patch, bnc#489740)
  * lscpu: improve hypervisor detection (puzel@novell.com,
    fate#310255)
    - util-linux-lscpu-improve-hypervisor-detection.patch
  * umount: avoid calling readlink on mountpoints if not necessary
    - add: umount-avoid-readlink.patch (puzel@suse.com, bnc#794529)
  * fix file conflict between util-linux and s390-32
    (puzel@suse.com, bnc#805684)
  * util-linux-update-default-commit-interval.patch:
    mount(8): update default commit interval (puzel@suse.com,
    bnc#809480)
  * Obsolete no more packaged uuid-runtime.
- Add uname26 (util-linux-setarch-uname26.patch, FATE#313476).

OBS-URL: https://build.opensuse.org/request/show/226509
OBS-URL: https://build.opensuse.org/package/show/Base:System/util-linux?expand=0&rev=227
2014-03-20 08:19:43 +00:00

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);