Whamcloud - gitweb
libext2fs: don't scan /etc/mtab if file system not found in /proc/mounts
authorTheodore Ts'o <tytso@mit.edu>
Mon, 6 Jan 2020 19:42:01 +0000 (14:42 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 6 Jan 2020 20:15:10 +0000 (15:15 -0500)
commit43bdb47d02b17d46e8495dae733c7b07cb9f9ce4
treec73322810315313c422d7eaef28d789ea1a72a32
parentc52d930f3ffbc19fa248d53daa171436ac391bb5
libext2fs: don't scan /etc/mtab if file system not found in /proc/mounts

Previously we would scan /etc/mtab if the device is not found in
/proc/mounts.  This is because previously, /etc/mtab would have the
filename for a loopback mount, while /proc/mounts would only have
something like /dev/loop0.  Since on many systems /etc/mtab is now a
symlink to /proc/mounts, ismounted.c has a special function,
check_loop_mounted.

For this reason, it's not necessary to fall back to trying to scan
/etc/mtab if a device / filename is not found from scanning
/proc/mounts.  This also prevents failures if the file /etc/mtab does
not exist but /proc/mounts does exist when checking to see if a device
is mounted when it isn't.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/ismounted.c