summaryrefslogtreecommitdiffstats
path: root/mount
Commit message (Collapse)AuthorAgeFilesLines
* swpaon: use canonicalized devnames on -s outputKarel Zak2010-12-171-10/+28
| | | | | | | | | | | | | | Old version Filename Type Size Used Priority /dev/sda3 partition 2353516 76 -1 /dev/dm-1 partition 409596 0 -2 New version: Filename Type Size Used Priority /dev/sda3 partition 2353516 76 -1 /dev/mapper/VUL-lvol0 partition 409596 0 -2 Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: Canonicalize swap deviceAlexey Gladkov2010-12-171-1/+7
| | | | | | | | | | | | | | | | | | | | | | | Swapon checks whether a swap device is active by searching for the device name in /proc/swaps. /proc/swaps always specifies the path to real device file, even if the path to real device file, even if symlink was passed to the swapon() system call. This differs from /proc/mounts semantics where each string contains exactly the same device name as it was passed to the mount*() system call. If a swap partition resides on lvm, libblkid returns a name in form /dev/mapper/*, but now there are symlinks pointing to device files /dev/dm-*, resulting to /proc/swaps containing /dev/dm-*, but swapon still looks for /dev/mapper/* and tries to activate the swap partition again. [kzak@redhat.com: - remove unnecessary changes from is_in_proc_swaps()] Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com> Tested-by: Petr Uzel <petr.uzel@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
* fix __noreturn__ usageKarel Zak2010-12-101-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: be more explicit about --move in mount.8Karel Zak2010-12-061-3/+18
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: read /sys for loopdev backing fileKarel Zak2010-12-013-3/+61
| | | | | | | | | On systems without /etc/mtab (or everywhere if kernel >= 2.6.37) we use loop autoclear flag and then the backing file name is not stored in /etc/mtab. mount(8) uses sysfs to get the filename (or LOOP_GET_STATU* ioctls on old kernels). Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: use /sys/dev/block/.../loop/backing_fileKarel Zak2010-12-011-1/+43
| | | | | | | | | | | | | | | | | The basic loopdev attributes are available in sysfs since kernel 2.6.37. This patch uses the backing_file attribute from sysfs for very long filenames (the LOOP_GET_STATUS ioctl uses only 64 bytes for the filename). old version: # losetup -a /dev/loop0: [0804]:12865322 (/home/images/filesystems/this_is_really_really_long_directory_*) new version: # losetup -a /dev/loop0: [0804]:12865322 (/home/images/filesystems/this_is_really_really_long_directory_name/ext2.img) Signed-off-by: Karel Zak <kzak@redhat.com>
* rename util-linux-ng back to util-linuxKarel Zak2010-11-306-11/+11
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add LINHIB0001 signature to swap proberKarel Zak2010-11-301-1/+2
| | | | | | | | | The new swsuspend signature has been added by commit 3624eb04c24861ab296842414f9752a393e68372 to kernel 2.6.37-rc1. Reported-by: "Dr. David Alan Gilbert" <linux@treblig.org> Addresses: https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/682176 Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [strutils] general purpose string handling functionsDavidlohr Bueso2010-11-234-7/+7
| | | | | | | | | | | | | 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>
* mount: mark die() as nonreturnKarel Zak2010-11-231-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: ignore *context= options on remountKarel Zak2010-11-191-3/+59
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=563267 Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: update relatime description in mount.8Karel Zak2010-11-161-0/+9
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=653705 Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: better text for "discard", note about swapon in fstab.5Karel Zak2010-11-102-4/+7
| | | | | | Suggested by Hugh Dickins. Thanks. Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: add "discard" supportHugh Dickins2010-11-012-12/+39
| | | | | | | | | | | | | | | | | | In kernel 2.6.36 (and in stable kernel 2.6.35.5) I made a tiny change to the swapon(const char *path, int swapflags) system call interface: kernel commit 3399446632739fcd05fd8b272b476a69c6e6d14a swap: discard while swapping only if SWAP_FLAG_DISCARD As things stand at present, we could just remove the swap discard support; but since several filesystems (including ext4 and btrfs and fat) are offering a "discard" mount option, I thought swap should take the same course, and offer a "--discard" or "-d" option to swapon(8). [kzak@redhat.com: - update swapon.8 man page - use for -d the same logic as for -p] Signed-off-by: Hugh Dickins <hughd@google.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: use utimensat(AT_FDCWD) rather than open()+futimens()Karel Zak2010-10-291-10/+3Star
| | | | | | Thanks to Kay Sievers. Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: add support for "nofail" fstab mount optionKarel Zak2010-10-252-3/+11
| | | | | | | | | This option is already supported by mount(8) and fsck(8), there is no reason to have any exception for swap devices. Note that the --ifexists command line option applies to all swap devices, the "nofail" setting is per device. Signed-off-by: Karel Zak <kzak@redhat.com>
* 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>
* mount: remove warning about FS detection from mount.1Karel Zak2010-10-211-5/+0Star
| | | | | | | The warning is from util-linux 2.7.1 (year 1996)... the filesystems detection is pretty generic now. Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: don't canonicalize "spec" with --no-canonicalize optionMiklos Szeredi2010-10-071-1/+1
| | | | | | | "Spec" was still canonicalized despite --no-canonicalize. This resulted in a hang during login with pam_encfs (Debian Bug#593336). Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
* swapon: warn if file owner is not rootKarel Zak2010-10-071-0/+4
| | | | | Reported-by: Bernhard Voelker <bernhard.voelker@siemens-enterprise.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: use strtosize() for offset=Karel Zak2010-10-072-4/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: Don't call canonicalize_*(SPEC) for 9pSven Eckelmann2010-09-301-1/+2
| | | | | | | | | | | | | | | When calling "mount -t 9p -o trans=virtio foobar /mnt/bar" and foobar exists in the current path, the 9p virtio transport driver will be called with $CWD/foobar and fail with "9p: no channels available". Similar problems exist with remote file servers "mount -t 9p 23.42.08.15 /mnt/bar" and Plan 9 From User Space applications "mount -t 9p -o trans=unix,uname=$USER `namespace`/acme /mnt/bar" A similar exception like for nfs, cifs and smbfs must be added for 9p. Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
* mount: avoid starting a man page line with a single quoteChris Frost2010-09-301-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: fix mount.8, shortname=mixed is now default for vfatPetr Uzel2010-09-301-2/+2
| | | | | | | | Since Linux kernel commit 955234755ce4a2c33cfc558912aa8f2148cc1fc6, the default mode for vfat filesystem is 'shortname=mixed'. Reported-by: Harald Koenig <koenig@linux.de> Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* mount: rewrite is_readonly()Karel Zak2010-09-201-19/+27
| | | | | | | | This new implementation is more optimistic and always calls access(2). The fallback solution (modify atime by futimens(2)) should be used very rarely. Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: add note about context= remount to mount.8Karel Zak2010-09-171-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: better describe UUIDs usage in man pagesKarel Zak2010-09-132-2/+17
| | | | | Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=632373 Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: clean up fstab.5Karel Zak2010-08-301-36/+63
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: add note about subtypes to fstab.5Karel Zak2010-08-302-0/+17
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: add info about type.subtype to /sbin/mount.<type> API descriptionKarel Zak2010-08-272-2/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: handle filesystems with subtypeMiklos Szeredi2010-08-272-5/+31
| | | | | | | | | | | | | | | | | 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>
* mount: sanity check mount flags for MS_PROPAGATIONKarel Zak2010-08-271-2/+4
| | | | | | | | | | | | | | | | | | mount(8) reuses mount flags from fstab/mtab, the problem is that for MS_PROPAGATION operations kernel incorrectly evaluates mount flags if the flags contains any non-propagation stuff (e.g. MS_RDONLY). For example --make-shared on read-only FS: # strace -e mount mount --make-shared /mnt/test mount("/dev/sda1", "/mnt/test", "none", MS_RDONLY|MS_SHARED, NULL) = 0 must be: # strace -e mount mount --make-shared /mnt/test mount("/dev/sda1", "/mnt/test", "none", MS_SHARED, NULL) = 0 Reported-by: Valerie Aurora <vaurora@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: Add more pseudo filesystems.Davidlohr Bueso2010-08-271-1/+3
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* losetup: do not distinguish between malloc and reallocTobias Klauser2010-08-201-3/+8
| | | | | | | | | | realloc(NULL, size) behaves the same as malloc(size) so there is no need to distinguish between the two. [kzak@redhat.com: - better handle realloc() errors] Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: use stdout and return 0 for --helpKarel Zak2010-08-041-15/+19
| | | | | Reported-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: get most recently mounted fs from /etc/mtab.Valerie Aurora2010-08-043-2/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I spent most of the day tracking down this subtle remount bug. I think this is the correct solution but I'd appreciate some double-checking. I suspect this bug will munge the mount options whenever you remount a file system mounted on the same mountpoint as another file system, using the mountpoint as the handle. -VAL commit c010b3a0783430e2b94f3b3dc0929ae299e383eb Author: Valerie Aurora <vaurora@redhat.com> Date: Tue Aug 3 16:32:52 2010 -0700 mount: get most recently mounted fs from /etc/mtab. In mount, when using /etc/mtab to lookup a mount entry, get the most recently mounted entry instead of the first mounted entry. You want to manipulate the most recent mount, not a covered mount. See comment to umount_one_bw(). This bug has been util-linux-ng since the first git checkin. It finally showed up on my system with the change to stop using SETLOOP_AUTOCLEAR if /etc/mtab is writable (commit af092544). If you do a remount of a file system mounted on the same dir as another file system, it will take the options from the first mount and write them out to /etc/mtab as the options to the second mount - including, in the case of a loop device, loop=/dev/loop0. Then when you umount the second mount, it grabs the line from /etc/mtab and tries to tear down the loop device, which complains because it is still in use by the first mount. Reproducible test case (on a system with writable /etc/mtab): mount -o loop,ro /tmp/ro /mnt mount -t tmpfs tmpfs /mnt mount -o remount,ro /mnt cat /etc/mtab | tail -2 Signed-off-by: Valerie Aurora <vaurora@redhat.com>
* mount: fix "mount -a" for auto-clear loopdevs and /proc/mountsKarel Zak2010-07-291-10/+37
| | | | | | | | | | | | | | | | | | | | | | The "mount -a" uses /etc/mtab to detect already mounted file systems from /etc/fstab -- this check requires the same FS name (1st field) in fstab and mtab. On systems with enabled auto-clear loop devies or systems without regular mtab (symlink to /proc/mounts) there is /dev/loopN rather than image filename in mtab. For example: fstab: /mnt/store/foo.ISO /mnt/image auto defaults 0 0 mtab: /dev/loop0 /mnt/image iso9960 rw 0 0 We have to scan all available loop devices to check if some of the devices is not associated with the image file from fstab. Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=618957 Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: don't use auto-clear loopdev if mtab is availableKarel Zak2010-07-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # mount /home/images/floppy.img /mnt/test2 # mount | grep loop /dev/loop0 on /mnt/test2 type udf (rw) mount(8) with auto-clear loopdev does not store information about the original backing file (the image) to /etc/mtab. (Note that this is our long-term goal, because we want to remove mtab from Linux.) Unfortunately, losetup(8) is not able to provide full path for the backing file, because LOOP_GET_STATUS ioctl uses 64 bytes for the filename... So, without the information about the backing file in mtab the information about mapping between the file and the loopdev is unaccessible from userspace. From my point of view it would be nice to add all necessary information about loopdevs to /sys rather than rely on broken LOOP_GET_STATUS[64] ioctls. with this patch: # mount /home/images/floppy.img /mnt/test2 # mount | grep loop# mount | grep loop /home/images/floppy.img on /mnt/test2 type udf (ro,loop=/dev/loop0) Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=615389 Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: Document btrfs limitation with swapfilesJeff Mahoney2010-07-071-0/+12
| | | | | | | | | | | | | | | | Btrfs, as of 2.6.35, is unable to allow swapfiles to be used on its filesystems. This is due to the swapfile implementation wanting to build an extent map of each block in the file and expecting it to be static for the life of the swapfile. Btrfs can't guarantee this and refuses to return the mapping. The swapfile implementation just makes a comment about there being holes in the file - but that's how btrfs denies the mapping. This patch adds a section to the swapon manpage to document it. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: fix memory leakPetr Uzel2010-06-301-1/+3
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* mount: fix typos in mount.8Petr Uzel2010-06-301-3/+3
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* mount: use %u for uid_t and gid_tKarel Zak2010-06-141-7/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: add notes about -o remount,ro,bind to mount.8Karel Zak2010-06-141-0/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* messages: gettextize a few skipped or forgotten onesBenno Schulenberg2010-06-141-3/+3
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: fix typos, and rephrase some things for clarityBenno Schulenberg2010-06-141-5/+5
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* mount: don't create loopdev for MS_BINDKarel Zak2010-06-141-2/+3
| | | | | | Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=602573 Reported-by: Adam Tkac <atkac@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: fix coding styleKarel Zak2010-05-281-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: detect when kernel silently adds MS_RDONLY flagPetr Uzel2010-05-281-0/+12
| | | | | | | | | | | | Linux kernel can silently add MS_RDONLY flag when mounting file system that does not have write support. Check this to avoid 'ro' in /proc/mounts and 'rw' in mtab. [kzak@redhat.com: - don't check for 'ro' for MS_MOVE and MS_PROPAGATION] Reported-by: James Foris <jim.foris@med.ge.com> Signed-off-by: Petr Uzel <petr.uzel@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
* 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>
* mount: fix typo in commentPetr Uzel2010-05-281-1/+1
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>