libext2fs: avoid unnecessary stat(2) calls on mountpoints

If the device name in the mtab or /proc/mounts file does not match
with the device passed into ext2fs_check_if_mounted() or
ext2fs_check_mount_point(), skip the stat(2) call on the mountpoint,
since we never use the results of the stat(2) in that case.  Not only
does this provide a slight performance win, but it the stat calls on
the mountpoints could potentially trigger some SELinux denials that
could stress some sysadmins out.

Google-Bug-Id:  193137337
Signed-off-by: Theodore Ts'o <tytso@mit.edu>

(cherry picked from commit ddee43e8e847b25148d694bb5dbec633729e975b)
Bug: 193137337
Change-Id: I2f8ae579b892e959113a03c6615e8a2736ab41bc
1 file changed