| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The "umount -f -a -r" get stuck in a endless loop when run with a
mountinfo like below:
15 0 179:2 / / ro,relatime - ext4 /dev/root ro
16 15 0:6 / /dev rw,relatime - devtmpfs devtmpfs rw,size=242896k,nr_inodes=60724,mode=755
17 15 0:4 / /proc rw,relatime - proc proc rw
18 15 0:15 / /mnt/.psplash rw,relatime - tmpfs tmpfs rw,size=40k
19 15 0:16 / /sys rw,relatime - sysfs sysfs rw
20 19 0:7 / /sys/kernel/debug rw,relatime - debugfs debugfs rw
21 15 0:17 / /run rw,nosuid,nodev - tmpfs tmpfs rw,mode=755
22 15 0:18 / /var/volatile rw,relatime - tmpfs tmpfs rw
23 15 179:1 / /boot rw,relatime - vfat /dev/mmcblk0p1 rw,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro
24 16 0:19 / /dev/pts rw,relatime - devpts devpts rw,gid=5,mode=620,ptmxmode=000
25 18 0:20 / /mnt/.psplash rw,relatime - tmpfs tmpfs rw,size=40k
The reason is that the two same mnt entry "/mnt/.psplash" will cause
the dst->tab set to NULL when umount this mnt entry the second time.
This will trigger an endless loop in mnt_reset_table() because that
mnt entry is linked on the libmnt_table but its .tab is set to NULL.
Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Added member 'struct libmnt_table *tab' to libmnt_fs structure.
* Added 'mnt_fs_get_table()'.
* Removed overhead from 'mnt_table_{insert,move,remove}_fs().
* Added check to 'mnt_table_set_iter()' that entry is member of table.
[kzak@redhat.com: - add to libmount.sys
- add to docs
- cleanup commit message
- set fs->tab = NULL before mnt_unref_fs() in mnt_table_remove_fs()]
Signed-off-by: Tim Hildering <hilderingt@posteo.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
| |
* add SPDX-License-Identifier (see https://spdx.org/licenses/)
* add "This file part of libmount from util-linux project."
* use proper text for LGPL-2.1-or-later
* use the same texts everywhere
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
| |
Some more funny typos, please review carefully.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
| |
From libs where suid program may be executed by non-root user.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
///aaa/bbb and /aaa/bbb/ are the same paths. This is important
especially with NFS where number of slashes are not the same in
the /proc/self/mountinfo and fstab or utab. The regular URI is
euler://tmp
but /proc contains
euler:/tmp
Reported-by: Ales Novak <alnovak@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
| |
Fix various typos in error messages, warnings, debug strings,
comments and names of static functions.
Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
|
|
|
|
|
|
|
|
| |
For petty long time we have strdup_to_struct_member() macro to avoid
duplicate code when strdup() strings in setter functions. Let's use it
for libmount.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
This reverts commit 46a40c018438b7b2b25083a5e5a4a21055a0c1e9.
|
|
|
|
|
|
|
|
| |
BSD/Linux systems stick major/minor/makedev in sysmacros.h. Newer Linux
libraries have been moving away from including sysmacros.h implicitly via
sys/types.h, so include it directly.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
| |
[libblkid/src/superblocks/zfs.c:179]: (portability) 'label' is of type 'const void *'. When using void pointers in calculations, the behaviour is undefined.
[libblkid/src/superblocks/zfs.c:237]: (portability) 'label' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.
[libblkid/src/topology/topology.c:221]: (portability) 'chn.data' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.
[libmount/src/fs.c:153]: (portability) 'old' is of type 'const void *'. When using void pointers in calculations, the behaviour is undefined.
[libmount/src/fs.c:154]: (portability) 'new' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
| |
The requested path is also target mountpoint, so let's optimize
realpath() usage as well.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Current code in mnt_fs_match_target() and mnt_table_find_target()
already does not canonicalize active mount points (when read from
mountinfo), because they are already canonicalized by the kernel.
Calling realpath(fs->target) on a mount point can hang -- e.g. if the
NFS server is unreachable.
This patch optionally extends this strategy to the general case, that is
when @fs does not directly come from the kernel through mountinfo (for
instance, it may have been parsed from /etc/fstab).
Given @mtab parsed from mountinfo, and if mnt_cache_set_targets(cache,
mtab) is used, then mnt_fs_match_target() and mnt_table_find_target()
check whether @fs->target is a known mount point in the cached
mountinfo, before attempting to canonicalize @fs->target, no matter
where @fs itself comes from. If found in the cached mountinfo,
@fs->target is not canonicalized.
[kzak@redhat.com: - don't allocate libmnt_iter,
- add docs for mnt_cache_set_targets(),
- fallback to mnt_resolve_path() if no cache->mtab specified,
- use streq_except_trailing_slash() to compare paths]
Signed-off-by: Eric Rannaud <e@nanocritical.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
| |
This is how mnt_table_find_target() does it. It makes sense because
@fs->target is "none" for swap and is never a sensible match for a
user-specified target.
Signed-off-by: Eric Rannaud <e@nanocritical.com>
|
|
|
|
| |
Signed-off-by: Eric Rannaud <e@nanocritical.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
| |
We should not use the results from mnt_split_optstr() if the function
failed.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
| |
When strdup() failed, u, v and f optstr's should be freed.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
|
|
|
|
|
|
|
| |
.. otherwise mnt_free_fs() will try to remove FS from non-existing
list.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* mnt_new_fs() returns object with refcount=1
* mnt_free_fs() does not care about reference counter
* new functions mnt_ref_fs() and mnt_unref_fs()
* mnt_table_add_fs() and mnt_table_rem_fs() uses reference counter
* libmmnt_context uses reference counter for internal FS (as it could be
shared outside the context)
* backwardly incompatible change:
- FS could be deallocated after mnt_table_remove_fs()
* it's recommended to use mnt_unref_fs() after mnt_table_add_fs()
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
|
|
|
|
| |
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
|
|
|
|
| |
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
|
|
|
|
|
|
| |
Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
# mount DUMMY=filename.img /mnt
The 'DUMMY=filename.img' is a filename and should not be
interpreted as tag name. The valid tag names are LABEL, UUID,
PARTLABEL and PARTUUID only.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We use
mnt_optstr_append_option(&o, mnt_fs_get_vfs_options(fs), NULL);
in mount.nfs, unfortunately mnt_optstr_append_option() has been marked
ass nonnull(1, 2). That's wrong because append and prepend should
robust enough to accept NULL as option name.
The patch also removes almost all __attribute__((nonnull). It seems
better to rely on assert() to have usable feedback. In many cases
(nonnull) is premature optimization for the library. This attribute
makes sense for things like strlen() or so...
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=948274
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
| |
Reported-by: Mantas Mikulėnas <grawity@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
| |
* don't teach people C by header files, so use warn_unused_result
attribute only on places where we return allocated memory (to avoid
leaks in applications).
* merge multiple function attributes to the one list to make it
usable with gtk-doc
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
| |
References: https://bugzilla.redhat.com/show_bug.cgi?id=909866
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
[kzak@redhat.com: - rename struct member and functions from
"propagation" to "optional fields"
- split the original patch
- fix parser]
Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
- use __attribute__((nonnull) for functions where we not able to
return an return code ("is", "has" and some "get" functions).
- use __attribute__((nonnull) for small functions where we
always modify any of the function argument (some mnt_optstr_* functions)
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Raul Gutierrez Segales <rgs@itevenworks.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The tool misspellings (https://github.com/lyda/misspell-check)
detected several typos. Command used:
$ git ls-files | grep -v ^po/ | misspellings -f -
* Documentation/releases/v2.18-ReleaseNotes: Fix typo in news entry.
* NEWS: Likewise.
* config/texinfo.tex: Fix typo in comments.
* libmount/src/context.c: Fix typo in comment.
* libmount/src/fs.c: Likewise.
* login-utils/login.c: Likewise.
* login-utils.su.1: Fix typo in man page.
* sys-utils/chcpu.c: Fix typo in error message.
Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
|
|
|
|
|
|
| |
Add new function mnt_fs_get_tid() to get task ID for the given filesystem.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
We have to be careful with "none" or another dummy sources for pseudo
filesystems. These strings should be canonicalized or compared as a
paths.
The function is not exported by library API.
Signed-off-by: Karel Zak <kzak@redhat.com>
|