Subject: df prioritizes some bind mounts over real ones.

From: Dave Chiluk <[email-masked]>
Date: Fri, 28 Aug 2015 15:42:44 -0500

With the recent move to /proc/self/mountinfo `df` now returns bind mounts
instead of the original mount when the directory being bound to is shorter than
the original mount destination.

For example:
 * $ mount
<snip>
192.168.1.2:/raid on /raid type nfs
/dev/sdc5 on /data type ext4 (rw)
<snip>

$ mount -o bind /data/a on /a type none (rw,bind)
$ mount -o bind /raid/temp on /b type none (rw,bind)

$df
Filesystem 1K-blocks Used Available Use% Mounted on
<snip>
192.168.1.2:/raid 449830616 229975284 196982196 54% /a
/dev/sdc5 7752072192 5581343744 1780023296 76% /b
</snip>

I'd expect to see the original mount prioritized over the bind mount. Like so.
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
<snip>
/dev/sdc5 449830616 229975284 196982196 54% /data
192.168.1.2:/raid 7752072192 5581438976 1779929088 76% /raid
<snip>

This is both mildly incorrect and misleading.  As the source device in both
cases isn't exactly what is being mounted at the destination directory.
Instead it is a subdir of the filesystem that is being mounted there.

I'm submitting patches to both gnulib and coreutils to correct this issue.

Thank you,
Dave Chiluk