From: Karel Zak Date: Mon, 15 Oct 2012 09:10:50 +0000 (+0200) Subject: libmount: don't use umount optimization for -l or -f X-Git-Tag: v2.23-rc1~642 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6d5d2b5fd342308bb2db6b82d89ac22ef7374184;p=thirdparty%2Futil-linux.git libmount: don't use umount optimization for -l or -f 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 --- diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c index ce095bff17..2c2e64c614 100644 --- a/libmount/src/context_umount.c +++ b/libmount/src/context_umount.c @@ -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)) {