summaryrefslogtreecommitdiffstats
path: root/libmount/src/context_umount.c
Commit message (Collapse)AuthorAgeFilesLines
* umount: read mountinfo if --detach-loop givenRobert Schiele2014-09-221-1/+3
| | | | | | | | | | Don't use the optimization not to read mountinfo from commit 6a52473ecd877227f6f7da2b95da0b51593ffec1 if --detach-loop was given since we need the name of the loop device in that case and with the optimization this is not present and thus the detach operation obviously fails. Signed-off-by: Robert Schiele <rschiele@gmail.com>
* libmount: use -t for type.subtype in helpers APIKarel Zak2014-08-211-2/+4
| | | | | References: https://github.com/karelzak/util-linux/issues/116 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't touch mtab when mount -n specifiedKarel Zak2014-06-171-4/+4
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1109367 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: use new debug functionsKarel Zak2014-03-211-39/+37Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: don't use mountinfo if possibleKarel Zak2014-03-031-2/+83
| | | | | | | | | | | | | | | | | | | | | | | | The umount(8) always parses /proc/self/mountinfo to get fstype and to merge kernel mount options with userspace mount options from /run/mount/utab. This behavior is overkill in many cases and it's pretty expensive as kernel has to always compose *whole* mountinfo. This performance disadvantage is visible for crazy use-cases with huge number of mountpoints and frequently called umount(8). It seems that we can bypass /proc/self/mountinfo by statfs() to get filesystem type (statfs.f_type magic) and analyze /run/mount/utab before we parse mountinfo. This optimization is not used when: * umount(8) executed by non-root (as user= in utab is expected) * umount --lazy / --force (target is probably unreachable NFS, then use statfs() is pretty bad idea) * target is not a directory (e.g. umount /dev/sda1) * there is (deprecated) writeable mtab Reported-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: small cleanup in umount codeKarel Zak2013-09-271-2/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: free username after checkDave Reisner2013-09-201-0/+2
| | | | | | | | | | | | | | | Leak reported by valgrind: ==14226== 7 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==14226== at 0x4C2757B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==14226== by 0x5534839: strdup (in /usr/lib/libc-2.18.so) ==14226== by 0x4E53FE0: mnt_get_username (utils.c:560) ==14226== by 0x4E456A5: mnt_context_prepare_umount (context_umount.c:413) ==14226== by 0x4E464F7: mnt_context_umount (context_umount.c:851) ==14226== by 0x403476: umount_one (umount.c:299) ==14226== by 0x402B34: main (umount.c:629) Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* libmount: be robust when work with loopdev backing file pathsKarel Zak2013-08-051-5/+5
| | | | | | | | It's usually unnecessary as we compare devno and ino, but let's use absolute paths for situations when it's necessary to compare paths as strings. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: canonicalize for conversion from loopdev backing fileKarel Zak2013-08-051-1/+6
| | | | | | | | | | | | # mount foo.img /mnt # umount foo.img umount: foo.img: not mounted The loopdev code (and sysfs backing_file) uses absolute paths, but libmount does not canonicalize the path before lookup for the backing file. References: https://bugzilla.redhat.com/show_bug.cgi?id=950497 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix typosOndrej Oprala2013-08-051-16/+16
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* libmount: be robust for empty target/source stringsKarel Zak2013-06-171-2/+11
| | | | | | | | | | * lib/canonicalize.c: don't interpret empty strings as relative paths * libmount: more robust libmnt_table find function and debug messages References: https://bugzilla.novell.com/show_bug.cgi?id=825150 Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't ignore root fs on umount -aKarel Zak2013-05-141-4/+1Star
| | | | | | | | | | The release v2.22 (the new umount) introduces a regression when root fs is excluded from umount --all. There is not reason for this exception. The libmount should be smart enough to disable mtab update after rootfs umount. Reported-by: Bruce Dubbs <bruce.dubbs@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount, col: remove redundant null checks [smatch scan]Sami Kerola2013-04-091-4/+2Star
| | | | | | | | libmount/src/context_umount.c:174 mnt_context_find_umount_fs() info: redundant null check on loopdev calling free() libmount/src/context_umount.c:179 mnt_context_find_umount_fs() info: redundant null check on loopdev calling free() text-utils/col.c:406 flush_lines() info: redundant null check on l->l_line calling free() Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libmount: umount crashes when trying to umount a non-mountpointKarel Zak2013-03-251-2/+2
| | | | | Reported-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: export umount mountpoint look up codeKarel Zak2013-02-261-25/+57
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't try to play with loopdevs if umount argument is really ↵Karel Zak2012-11-151-3/+6
| | | | | | mountpoint Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't use umount optimization for -l or -fKarel Zak2012-10-151-1/+3
| | | | | | | | | | 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: fix umount file.imgKarel Zak2012-10-051-6/+10
| | | | | | | | The umount optimization (commit 9cc03553f7b8494c7193024eec6e13b903eb2eec) has to be disabled if the umount argument is not a directory. Reported-by: Milan Broz <mbroz@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: typo fixesGilles Espinasse2012-10-021-2/+2
| | | | Signed-off-by: Gilles Espinasse <g.esp@free.fr>
* libmount: optimize mtab and utab parsing in umountKarel Zak2012-09-251-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | create 8000 NFS mountpoints: #!/bin/bash mount=/tmp/mount if [ ! -d $mount ]; then mkdir -p $mount fi for dir in {1..8000}; do if [ ! -d $mount/$dir ]; then mkdir -p $mount/$dir fi echo mount $dir mount -t nfs 127.0.0.1:/ $mount/$dir done old version: time ./umount /tmp/mount/2255 real 0m1.254s user 0m1.002s sys 0m0.238s new version: time ./umount /tmp/mount/2244 real 0m0.332s user 0m0.111s sys 0m0.218s Reported-by: chenditang <chendt.fnst@cn.fujitsu.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: user-mounted loopback fs cannot be unmounted by userKarel Zak2012-09-211-1/+1
| | | | | Addresses: https://bugs.archlinux.org/task/31624 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: detach loopdev on umount if loop option in mtabKarel Zak2012-09-181-0/+4
| | | | | | | | | | | | | [chroot-i486] root:/$ mount --version mount from util-linux 2.22 (libmount 2.22.0: debug) [chroot-i486] root:/$ losetup -a [chroot-i486] root:/$ mount -oloop /tmp/foo_fs /tmp/bar_dir [chroot-i486] root:/$ umount /tmp/foo_fs [chroot-i486] root:/$ losetup -a /dev/loop0: [2051]:387175 (/tmp/foo_fs) Reported-by: g.esp@free.fr Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: allow to disable swap between source and targetKarel Zak2012-07-171-1/+1
| | | | | | | | | | | | | | | | | | | | | In some cases (for example if only one mount argument is given) may be mount request ambivalent: # mount /foo and fstab: /dev/sda5 /foo rw 0 0 /foo /bar bind 0 0 The libmount allows to swap between source and target (if source is not LABEL or UUID) by default. The new function mnt_context_disable_swapmatch() allows to disable this feature. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't canonicalize targetKarel Zak2012-05-171-2/+0Star
| | | | | | | | | | | | | | Note that mountpoint (target_ paths in /proc/mounts and /proc/self/mountinfo are always canonicalized by kernel. * for umount we don't have to canonicalize target by default if the mountpoint is found in /proc/self/mountinfo * in mnt_table_find_target() is unnecessary to canonicalize target paths if the table of the filesystems is read from /proc/self/mountinfo Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=820707 Signed-off-by: Karel Zak <kzak@redhat.com>
* Fix typos found by misspellingsBernhard Voelker2012-04-231-2/+2
| | | | | | | | | | | | | | | The tool misspellings (https://github.com/lyda/misspell-check) detected several typos. Command used: $ git ls-files | grep -v ^po/ | misspellings -f - * isosize: Fix typo in usage string. * configure.ac: Fix typo in help string of --enable-most-builds option. * fdisk: Fix typo in man page. * libblkid, blkid, mount: Likewise. * Fix various typos in docs and in source code comments. Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
* libmount: cleanup flags usageKarel Zak2012-03-071-20/+22
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cleanup docsKarel Zak2012-02-221-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: remove dead assigmentKarel Zak2012-02-021-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix checked-return [coverity scan]Karel Zak2012-01-301-1/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cleanup post-umount operationsKarel Zak2012-01-161-32/+30Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix MS_BIND|MS_REC usage, improve some bitwise operationsKarel Zak2012-01-161-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: support umount /path/file.imgKarel Zak2012-01-121-13/+42
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: consolidate MNT_FS_* codeKarel Zak2012-01-021-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add mnt_context_umount_next()Karel Zak2011-12-011-20/+117
| | | | | | This is "umount -a" backend. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix trivial typos in debugging outputPetr Uzel2011-11-091-1/+1
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* libmount: unable to umount nfs shares using the force optionKarel Zak2011-10-171-1/+1
| | | | | | Reported-by: Federico Simoncelli <fsimonce@redhat.com> Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=745746 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add function to parse offsets/sizesKarel Zak2011-09-291-11/+5Star
|
* grammar fixesDavidlohr Bueso2011-08-151-2/+2
| | | | | | Correct grammar from "cannot found" to "cannot find". Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* libmount: remove unnecessary includes, mask API as stableKarel Zak2011-07-251-9/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cleanup docsKarel Zak2011-07-231-0/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: minor fixesKarel Zak2011-06-271-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: use top-level directory for libmount rather than shlibs/mountKarel Zak2011-06-091-0/+739
Signed-off-by: Karel Zak <kzak@redhat.com>