]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: don't use umount optimization for -l or -f
authorKarel Zak <kzak@redhat.com>
Mon, 15 Oct 2012 09:10:50 +0000 (11:10 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 15 Oct 2012 09:10:50 +0000 (11:10 +0200)
The options -l (lazy) and -f (force) means that the mountpoint may be
unreadable (for example because NFS server is unreadable). So we
should not try to be smart in this case and we should try to minimize
number of situations when stat() or readlink() is used for the
mountpoint.

Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/context_umount.c

index ce095bff1732e6a00da2bc6b4ead5c8974e101f8..2c2e64c614cdd2765a0f1c9b78dd271bbd1f8755 100644 (file)
@@ -83,7 +83,9 @@ static int lookup_umount_fs(struct libmnt_context *cxt)
         * where LABEL, UUID or symlinks are to canonicalized. It means that
         * it's usable only for canonicalized stuff (e.g. kernel mountinfo).
         */
-       if (!cxt->mtab_writable && *tgt == '/') {
+       if (!cxt->mtab_writable && *tgt == '/' &&
+           !mnt_context_is_force(cxt) && !mnt_context_is_lazy(cxt)) {
+
                struct stat st;
 
                if (stat(tgt, &st) == 0 && S_ISDIR(st.st_mode)) {