summaryrefslogtreecommitdiffstats
path: root/libmount/src/context_umount.c
diff options
context:
space:
mode:
authorKarel Zak2012-10-15 11:10:50 +0200
committerKarel Zak2012-10-15 11:10:50 +0200
commit6d5d2b5fd342308bb2db6b82d89ac22ef7374184 (patch)
treee72ea3f3e517133b91185909ee017c479f7703f7 /libmount/src/context_umount.c
parentbuild-sys: clean update-potfiles script (diff)
downloadkernel-qcow2-util-linux-6d5d2b5fd342308bb2db6b82d89ac22ef7374184.tar.gz
kernel-qcow2-util-linux-6d5d2b5fd342308bb2db6b82d89ac22ef7374184.tar.xz
kernel-qcow2-util-linux-6d5d2b5fd342308bb2db6b82d89ac22ef7374184.zip
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 <kzak@redhat.com>
Diffstat (limited to 'libmount/src/context_umount.c')
-rw-r--r--libmount/src/context_umount.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c
index ce095bff1..2c2e64c61 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)) {