summaryrefslogtreecommitdiffstats
path: root/mount/umount.c
Commit message (Collapse)AuthorAgeFilesLines
* mount: verify writing to streams was successfulSami Kerola2012-04-041-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mount: (old) check for LD_FLAGS_AUTOCLEAR more carefullyKarel Zak2012-04-021-10/+12
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=803799 Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: respect fs search pathMike Frysinger2012-02-241-3/+10
| | | | | | | This brings search path support to umount to match existing behavior in fsck and mount. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* umount: add warningKarel Zak2011-09-301-3/+3
| | | | | | | It's better to inform users about reason why their request does not makes sense :-) Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: use new lib/loopdev.c codeKarel Zak2011-09-301-16/+13Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: use %m in format string instead of %s and strerror(errno)Petr Uzel2011-09-271-6/+4Star
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* mount: use common libsDavidlohr Bueso2011-09-271-0/+1
| | | | | | | Get rid of the local xmalloc.[c/h] files by using the global xalloc and strutils libraries. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* mount: fix compiler warnings [-Wsign-compare -Wunused-parameter]Karel Zak2011-08-011-11/+11
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: do not hang with disconnected NFS mountsPetr Uzel2011-06-291-20/+22
| | | | | | | | | | | | | | Since util-linux commit f4612577c942a3683b97632ad0b49671897c2070, umount stat(2)s its argument to check whether it can be associated with some loop device. This could hang with broken NFS mounts. Fix by first checking mtab if umount's argument is mounted and only if we fail, check if there is a loop device associated. http://marc.info/?l=util-linux-ng&m=130924963804836&w=2 Reported-by: Konstantin Khlebnikov <khlebnikov@openvz.org> Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* mount: use lock from mnt_update_table()Karel Zak2011-04-131-6/+3Star
| | | | | | The mnt_update_table() is able to create a mtab lock now. Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: block signals when umounting and updating mtab (CVE-2011-1676, ↵Karel Zak2011-04-131-0/+5
| | | | | | | | | | CVE-2011-1677) http://thread.gmane.org/gmane.comp.security.oss.general/4374 Based on CVE-2011-1089. Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: support non-canonical devnames in mtabKarel Zak2011-04-111-1/+4
| | | | | Addresses: https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/755193 Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: use helper= for all UIDsKarel Zak2011-04-011-7/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: add phelper=Karel Zak2011-03-301-16/+32
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: use UMOUNT_NOFOLLOW for non-root usersKarel Zak2011-03-291-11/+87
| | | | | | The UMOUNT_NOFOLLOW umount2() flag is supported since kernel 2.6.34. Signed-off-by: Karel Zak <kzak@redhat.com>
* Revert "umount: call /sbin/umount.<uhelper> for root user too"Karel Zak2011-03-151-16/+17
| | | | This reverts commit c56226697342ddd663492f77768e7a7cb8e579a1.
* umount: call /sbin/umount.<uhelper> for root user tooKarel Zak2011-03-151-17/+16Star
| | | | | | | | | | | | | | | | | Originally the "uhelper=" was ignored for root, now the umount command calls /sbin/umount.<uhelper> always. This change is necessary for things like pam_mount where a device has to be uninitialized by uhelper rather than directly umounted by umount(2). Note that all uhelpers has to be linked with libmount or execute umount -fake -i /mountpoint to remove mountpoint entry from /etc/mtab or /dev/.mount/utab. Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: segfaults with inconsistent entry in /etc/fstabKarel Zak2011-03-041-1/+1
| | | | | | Addresses: https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/726283 Reported-by: Greg Brockman <gdb@gregbrockman.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: allow unmounting loopdev specified by associated filePetr Uzel2011-02-211-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Make it possible to unmount a filesystem on a loop device if it is specified by associated backing file. It does not attempt to unmount anything if there are more than one loop device associated with the given file. Umount looks for associated loopdevice(s) only if umount is called with the regular file as an argument. Before: mount -o loop -t ext2 img mnt umount -v img > Could not find /home/puzel/upstream/util-linux/img in mtab > umount: img: not mounted After: mount -o loop -t ext2 img mnt umount -v img > img is associated with /dev/loop0, trying to unmount it > /dev/loop0 has been unmounted [kzak@redhat.com: - fix memory leak in lomount.c] Addresses: https://bugzilla.novell.com/show_bug.cgi?id=666161 Signed-off-by: Petr Uzel <petr.uzel@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: fix parsing offset= followed by more optionsPetr Uzel2011-01-311-23/+4Star
| | | | | | | | | | | | | | | | mount does not parse parse offset= option if it is followed by other options. In umount, the parsing is done with the get_value() function. This patch moves get_value to fstab.c (with new name get_option_value()) and fixes mount to use the function. [kzak@redhat.com: - rename to get_option_value() - use fstab.c rather than sundries.c] Novell bugzilla: #666150 Reported-by: Ludwig Nussel <ludwig.nussel@suse.de> Signed-off-by: Petr Uzel <petr.uzel@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cleanup API, remove typedefKarel Zak2011-01-221-3/+3
| | | | | | | | - replace mnt_ with libmnt_ prefix for types (the old prefix was too generic) - remove typedef, use struct everywhere - use shorter functions names (s/userspace/user/; s/mountflags/mflags/) Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: call is_loop_autoclear() for all loopdevsKarel Zak2011-01-171-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: add HAVE_LIBMOUNT_MOUNT codeKarel Zak2011-01-031-0/+12
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: add mnt_init_debug()Karel Zak2011-01-031-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [strutils] general purpose string handling functionsDavidlohr Bueso2010-11-231-1/+1
| | | | | | | | | | | | | This patch replaces a few functions used throughout the source: * Renames getnum (from schedutils) to strtol_or_err * Moves strtosize (from lib/strtosize.c) * Moves xstrncpy (from include/xstrncpy.h) * Adds strnlen, strnchr and strndup if not available (remove it from libmount utils) A few Makefile.am files were modified to compile accordingly along with trivial renaming in schedutils source code. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* umount: umount -r segfaultKarel Zak2010-10-251-5/+10
| | | | | | | | | | | | | | | | | | | | umount(8) segfaults when update incomplete mtab file after remount to read-only (-r). For example autofs does not store info about mountpoint to /etc/mtab file. # mount /dev/sda1 /mnt/test # sed -i -e 's:/dev/sda1 .*::g' /etc/mtab # cd /mnt/test # umount -r /mnt/test umount: /mnt/test busy - remounted read-only Segmentation fault The command "umount -r" should not care about /etc/mtab if the related mtab entry does not exist. Reported-by: Paul Crawford <psc@sat.dundee.ac.uk> Addresses: https://bugs.launchpad.net/bugs/579858 Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: use strtosize() for offset=Karel Zak2010-10-071-3/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: handle filesystems with subtypeMiklos Szeredi2010-08-271-2/+15
| | | | | | | | | | | | | | | | | Linux can handle filesystem types with "MAINTYPE.SUBTYPE" format, where the main type determines the actual filesystem driver while the subtype can be interpreted by the filesystem itself. When searching for mount helpers mount(8) and umount(8) should also interpret such types, falling back to (u)mount.MAINTYPE if (u)mount.MAINTYPE.SUBTYPE doesn't exist. This patch implements this, passing the type with "-t TYPE" to the mount program in this case. Reported-by: Josef Bacik <josef@redhat.com> Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=625064 Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
* textual: fix typos, and rephrase some things for clarityBenno Schulenberg2010-06-141-5/+5
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* umount: do not sync() as the kernel does it by itselfPetr Uzel2010-05-281-1/+0Star
| | | | | | | | | | | | | | | | | | | | | | On Fri, May 21, 2010 at 08:00:09AM -0400, Christoph Hellwig wrote: > On Fri, May 21, 2010 at 01:55:17PM +0200, Petr Uzel wrote: > > SUSE-based distributions have the following patch for some time. More > > info here: https://bugzilla.novell.com/show_bug.cgi?id=447036 > > > > From the Novell bugzilla: > > <quote> > > > I cannot see any justification for that sync call at all so I'd > > > probably just remove it. Your > > > patch is possibly safer so maybe it should be used as is. > > </quote> > > > > So, does anybody know why/if the sync() is actually needed? > > It's not needed. The kernel performs a sync by itself. Thanks, Christoph. Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* umount: add --fake option to umount(8)Miklos Szeredi2010-03-111-2/+13
| | | | | | | | | | | | | | Add --fake option to umount(8), which omits calling the actual umount syscall (and the loop device deletion) but modifies /etc/mtab. This is similar to the -f or --fake option to mount(8). This would allow some simplifications in fuse by allowing it to call the umount syscall and letting umount(8) just update mtab. [kzak@redhat.com: - initialize 'res' variable in umount_one() ] Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: add --no-canonicalizeKarel Zak2009-12-171-2/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include: clean up _PATH_DEV_* macrosKarel Zak2009-06-301-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: allow loop suid umountKay Sievers2009-06-301-4/+44
| | | | | | Addresses-Suse-Bug: #461732 Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: clean up help outputKarel Zak2009-06-261-3/+3
| | | | | Addresses-Debian-Bug: #320500 Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: move realpath.c code to lib/Karel Zak2009-02-111-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: non-setuid (POSIX file capabilities) supportKarel Zak2009-02-041-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | The mount command does not work properly if you replace suid with POSIX file capabilities. We still need to check for non-root mounts and the command has to work in very restricted mode for non-root users. This patch allows you to remove suid bit from mount and umount. Note that you need a system with filesystem capability support, e.g. Fedora 10). # ls -l /bin/mount -rwxr-xr-x 1 root root 65192 2008-11-09 22:59 /bin/mount # getcap /bin/mount /bin/mount = cap_dac_override,cap_sys_admin+ep [kzak@redhat.com: all the above comments] Don't bypass security checks when [u]mount uses POSIX file capabilities rather than setuid root to permit non-root mounts. Signed-off-by: Geoff Johnstone <geoff.johnstone@googlemail.com>
* umount: cleanup gefs_by_specdir()Karel Zak2009-01-071-2/+2
| | | | | | | | | | fix: - don't call canonicalize_spec() for LABELs/UUIDs - simplify the code - rename to getfs_by_devdir(), because we use it only for device names and not for SPECes (see umount.c). Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: no checking mount point removalSigned-off-by: Guan Xin2008-09-291-25/+4Star
| | | | | | | | | | | No longer checks if mount point has been renamed or removed. Linux reports EBUSY for these actions, so this check is redundant. [kzak@redhat.com: - remove the check rather than "#if 0" - remove unnecessary mnt_err2 stuff] Signed-off-by: Guan Xin <guanx.bac@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: check for overlaid mountsGuan Xin2008-09-291-1/+20
| | | | | | | | | | Linux cannot umount a device whose mount point is hidden by subsequent mount(s). i.e. We must umount the devices associated to a mount point in the reverse order of when they were mounted. If umount was called violating this rule, report error and exit. Signed-off-by: Guan Xin <guanx.bac@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: improve "-d" option for autoclear loopsKarel Zak2008-07-021-2/+10
| | | | | | | | | | | The new loop auto-destruct feature detaches automatically loop devices when no longer used. This means they are detached with the umount() call. But when we call umount with -d, del_loop() is called and fails because the ioctl() returns ENXIO. We have to check for autoclear loop devices rather than blindly call del_loop(). Reported-by: Matthias Koenig <mkoenig@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: don't print duplicate error messagesKarel Zak2008-01-281-0/+13
| | | | | | | | | | | | umount(8) is trying to umount a device two times to prevent some obscure scenarios. It's maybe a nice feature, but it also produces duplicate error messages. # umount /home umount: /home: device is busy umount: /home: device is busy Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: add hint about lsof & fuserKarel Zak2008-01-281-1/+4
| | | | | | | | This patch adds a hint about lsof and fuser to the "device is busy" error message. Addresses-Red-Hat-Bugzilla: #145844 Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: clean up global variablesKarel Zak2007-10-251-5/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: cleanup error() and die()Karel Zak2007-10-251-2/+0Star
| | | | | | | | * moves error() and die() to sundries.h * removes at_die * adds __attribute__ ((__format__ (__printf__ ))) Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: use atexit() rather than (*at_die)()Karel Zak2007-10-251-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: cleanup canonicalize() usageKarel Zak2007-10-251-0/+1
| | | | | | | | | | | This patch renames canonicalize() to canonicalize_mountpoint() and moves this function to realpath.c where is all cannonicalize code. The canonicalize_mountpoint() function checks for special "none", "proc", "swap" pseudo mointpoint. The patch also adds a new generic canonicalize() function. Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: cleanup "none" fstype usageKarel Zak2007-10-041-1/+4
| | | | | | | | * disable to call /sbin/mount.none * rewrite fstype to "none" for MS_BIND and MS_MOVE * add notes about "none" to fstab.5 and mount.8 Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: doesn't drop privileges properly when calling helpersLudwig Nussel2007-09-231-2/+6
| | | | | | | | {,u}mount calls setuid() and setgid() in the wrong order and doesn't checking the return value of set{u,g}id(() when running helpers like mount.nfs. Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: clean up getfs* (fstab.c) interfaceKarel Zak2007-05-251-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>