Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
karelzak committed Oct 15, 2012
1 parent 71b161e commit 6d5d2b5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libmount/src/context_umount.c
Expand Up @@ -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)) {
Expand Down

0 comments on commit 6d5d2b5

Please sign in to comment.