[Bug 1432871] [NEW] `df` shows bind mounts instead of real mounts.

Launchpad Bug Tracker 1432871 at bugs.launchpad.net
Wed Jul 22 22:26:18 UTC 2015


You have been subscribed to a public bug by Dave Chiluk (chiluk):

[Impact]

 * df displays bind mounts instead of "real" mounts if the bind mount is
mounted to a shorter directory.

 * justification - This is a change of behavior from precise

 * Explanation - This patch checks to see if the source directory of a
mount is contains the destination directory of the mount it's replacing
*(check if it's bind mount from the original directory).

[Test Case]

 * $ mount
<snip>
192.168.1.2:/raid on /raid type nfs (rw,nosuid,nodev,noexec,vers=4,addr=192.168.1.2,clientaddr=192.168.1.3)
/dev/sdc5 on /data type ext4 (rw)
<snip>
/data/a on /a type none (rw,bind)
/raid/temp on /b type none (rw,bind)

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

I'd expect to see the real 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>

[Regression Potential]

 * Patch is not upstream, and will not be upstreamed *(see other info)

 * df command could stop working if I wrote the patch poorly.  df might
not process mounts correctly.

[Other Info]
 
 * The behavior of df, mount and similar number of other commands has changed going forward.  Previously these commands all processed /etc/mtab which was maintained by the mount command.  Going forward they still process /etc/mtab, but this is simply a symlink to /proc/mounts now which is maintained by the kernel and likely significantly more accurate.  Unlike the mount command, the kernel makes no distinction between bind mounts and normal mounts.  This is evident by the fact that you can mount a device, bind mount from that device, and then unmount the original mount.  The default behavior of df in this case is to simply pick the mounted directory for a device that is the shortest since it has no other information to go on from /proc/mounts.
 * Theoretically df, mount and a number of other commands could be modified to run ioctl commands to determine if the mount is from a root inode of the mounted filesystem to determine preference, but that is really more of an upstream exercise.

Original bug.
________________________________________________________________________
Depending on mount path length df sometimes prioritizes showing bind mounts over real mounts

for example.
$ mount
<snip>
192.168.1.2:/raid on /raid type nfs (rw,nosuid,nodev,noexec,vers=4,addr=192.168.1.2,clientaddr=192.168.1.3)
/dev/sdc5 on /data type ext4 (rw)
<snip>
/data/a on /a type none (rw,bind)
/raid/temp on /b type none (rw,bind)

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

I'd expect to see the real 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>

** Affects: coreutils (Ubuntu)
     Importance: Low
     Assignee: Dave Chiluk (chiluk)
         Status: New


** Tags: cts patch
-- 
`df` shows bind mounts instead of real mounts.
https://bugs.launchpad.net/bugs/1432871
You received this bug notification because you are a member of Ubuntu Sponsors Team, which is subscribed to the bug report.



More information about the Ubuntu-sponsors mailing list