]> git.ipfire.org Git - thirdparty/util-linux.git/commit - misc-utils/findmnt.c
findmnt: use mnt_cache_set_targets() for non-kernel table
authorEric Rannaud <e@nanocritical.com>
Fri, 27 Jun 2014 05:18:48 +0000 (22:18 -0700)
committerKarel Zak <kzak@redhat.com>
Tue, 1 Jul 2014 08:05:16 +0000 (10:05 +0200)
commitfb329bbc048861d6f47d33caf61f0c5b4ae68636
tree30f503b36dab682083bbd07d05c72e8a830f81c1
parent0382ba32eda9e9d14d1e425390abf4b1fd1bda6b
findmnt: use mnt_cache_set_targets() for non-kernel table

findmnt compares the user-supplied path <target> with each entry in the
parsed table. To do this comparison, libmount attempts to canonicalize
the target path of each table entry, when the entry does not originate
from the kernel (kernel supplied target paths are already
canonicalized). However, if one of these entries is an active mount
point, stat(2) or readlink(2) on the mount target path can hang (e.g.
unreachable NFS server).

If the main table is not a kernel table, we parse /proc/self/mountinfo
into a secondary table and call mnt_cache_set_targets(). This allows
libmount to check that the target path of each entry in the main table
is not an active mount point, so it can avoid canonicalizing it.

Signed-off-by: Eric Rannaud <e@nanocritical.com>
misc-utils/findmnt.c