← Back to team overview

touch-packages team mailing list archive

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

 

So after further review this patch does not make sense upstream, so I
never submitted it *(see SRU template).

Subscribing sponsors again to see if we want to Ubuntu Sauce patch this
for trusty.

** Description changed:

- Depending on mount path length df sometimes prioritizes showing bind
- mounts over real mounts
+ [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>

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to coreutils in Ubuntu.
https://bugs.launchpad.net/bugs/1432871

Title:
  `df` shows bind mounts instead of real mounts.

Status in coreutils package in Ubuntu:
  New

Bug description:
  [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>

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/1432871/+subscriptions