diff options
author | Eric Rannaud | 2014-06-27 07:17:18 +0200 |
---|---|---|
committer | Karel Zak | 2014-07-01 10:03:40 +0200 |
commit | 0382ba32eda9e9d14d1e425390abf4b1fd1bda6b (patch) | |
tree | e1e5fb6d007d08628571e0b28e3557652711422e /libmount/src/context_mount.c | |
parent | libmount: mnt_resolve_path: don't canonicalize fs->target for swap (diff) | |
download | kernel-qcow2-util-linux-0382ba32eda9e9d14d1e425390abf4b1fd1bda6b.tar.gz kernel-qcow2-util-linux-0382ba32eda9e9d14d1e425390abf4b1fd1bda6b.tar.xz kernel-qcow2-util-linux-0382ba32eda9e9d14d1e425390abf4b1fd1bda6b.zip |
libmount: mnt_resolve_target: tiptoe around active mount points
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>
Diffstat (limited to 'libmount/src/context_mount.c')
0 files changed, 0 insertions, 0 deletions