GNU bug report logs - #19570
bug: df and bind mounts

Previous Next

Package: coreutils;

Reported by: Vladimir A. Pavlov <pv4 <at> bk.ru>

Date: Sun, 11 Jan 2015 23:54:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 19570 in the body.
You can then email your comments to 19570 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#19570; Package coreutils. (Sun, 11 Jan 2015 23:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vladimir A. Pavlov <pv4 <at> bk.ru>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sun, 11 Jan 2015 23:54:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Vladimir A. Pavlov <pv4 <at> bk.ru>
To: bug-coreutils <at> gnu.org
Subject: bug: df and bind mounts
Date: Mon, 12 Jan 2015 02:36:37 +0300
[Message part 1 (text/plain, inline)]
Hello,

I have an issue with df (both in version 8.23 and in master branch).

I have tmpfs mounted as /run . There is /run/cgs/httpd subdirectory in
/run (just a subdirectory, not a tmpfs or another mount). This
/run/cgs/httpd is bind-mounted to /usr/cgs/httpd/run.

The current algorithm in df.c:filter_mount_list() chooses the bind
mountpoint since it has the leading slash in the "device" name
("/run/cgs/httpd" vs "run") which is wrong in my setup.

The similar (but not the same) issue is fixed by commit:
http://git.savannah.gnu.org/cgit/coreutils.git/commit/src/df.c?id=ed1a495b3ccb2665a13229ca866f2115bd768d17

I guess the "let real devices with / in the name win" replacement branch
should only be applied if mountpoints are the same as well.

Below is the data to reproduce the bug.

=== /etc/mtab (partial) ===
run /run tmpfs rw,noatime,nodiratime,nodev,noexec,mode=0755,size=1m 0 0
/run/cgs/httpd /usr/cgs/httpd/run none rw,bind 0 0
======

=== Real output (git) ===
Filesystem      Size  Used Avail Use% Mounted on
/run/cgs/httpd  1.0M  8.0K 1016K   1% /usr/cgs/httpd/run
======

=== Expected output (with the attached patch applied) ===
Filesystem      Size  Used Avail Use% Mounted on
run             1.0M  8.0K 1016K   1% /run
======

-- 
Vladimir A. Pavlov
[coreutils-8.23-df_bindmount_fix.patch (application/x-patch, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#19570; Package coreutils. (Mon, 12 Jan 2015 01:32:02 GMT) Full text and rfc822 format available.

Message #8 received at 19570 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: "Vladimir A. Pavlov" <pv4 <at> bk.ru>, 19570 <at> debbugs.gnu.org
Subject: Re: bug#19570: bug: df and bind mounts
Date: Mon, 12 Jan 2015 01:31:19 +0000
On 11/01/15 23:36, Vladimir A. Pavlov wrote:
> Hello,
> 
> I have an issue with df (both in version 8.23 and in master branch).
> 
> I have tmpfs mounted as /run . There is /run/cgs/httpd subdirectory in
> /run (just a subdirectory, not a tmpfs or another mount). This
> /run/cgs/httpd is bind-mounted to /usr/cgs/httpd/run.
> 
> The current algorithm in df.c:filter_mount_list() chooses the bind
> mountpoint since it has the leading slash in the "device" name
> ("/run/cgs/httpd" vs "run") which is wrong in my setup.
> 
> The similar (but not the same) issue is fixed by commit:
> http://git.savannah.gnu.org/cgit/coreutils.git/commit/src/df.c?id=ed1a495b3ccb2665a13229ca866f2115bd768d17
> 
> I guess the "let real devices with / in the name win" replacement branch
> should only be applied if mountpoints are the same as well.
> 
> Below is the data to reproduce the bug.
> 
> === /etc/mtab (partial) ===
> run /run tmpfs rw,noatime,nodiratime,nodev,noexec,mode=0755,size=1m 0 0
> /run/cgs/httpd /usr/cgs/httpd/run none rw,bind 0 0
> ======
> 
> === Real output (git) ===
> Filesystem      Size  Used Avail Use% Mounted on
> /run/cgs/httpd  1.0M  8.0K 1016K   1% /usr/cgs/httpd/run
> ======
> 
> === Expected output (with the attached patch applied) ===
> Filesystem      Size  Used Avail Use% Mounted on
> run             1.0M  8.0K 1016K   1% /run
> ======
> 

Thanks for the analysis and patch,
Current tests pass at least with it.
I'll analyse a little more, add tests and probably push.

thanks!
Pádraig.




Information forwarded to bug-coreutils <at> gnu.org:
bug#19570; Package coreutils. (Mon, 12 Jan 2015 21:28:01 GMT) Full text and rfc822 format available.

Message #11 received at 19570 <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: Pádraig Brady <P <at> draigBrady.com>, 
 "Vladimir A. Pavlov" <pv4 <at> bk.ru>, 19570 <at> debbugs.gnu.org
Subject: Re: bug#19570: bug: df and bind mounts
Date: Mon, 12 Jan 2015 22:27:13 +0100
On 01/12/2015 02:31 AM, Pádraig Brady wrote:
> On 11/01/15 23:36, Vladimir A. Pavlov wrote:
>> run /run tmpfs rw,noatime,nodiratime,nodev,noexec,mode=0755,size=1m 0 0
>> /run/cgs/httpd /usr/cgs/httpd/run none rw,bind 0 0

> Thanks for the analysis and patch,
> Current tests pass at least with it.
> I'll analyse a little more, add tests and probably push.

hmm, tmpfs is problematic anyway, as one can specify anything
as the dummy backing source device:

  $ mount -t tmpfs hello:/world /mnt
  $ mount -t tmpfs something /mnt
  $ mount -t tmpfs / /mnt
  $ findmnt /mnt
  TARGET SOURCE       FSTYPE OPTIONS
  /mnt   hello:/world tmpfs  rw,relatime
  /mnt   something    tmpfs  rw,relatime
  /mnt   /            tmpfs  rw,relatime

  $ df -a --out=source,target | grep /mnt
  hello:/world   /mnt
  something      /mnt
  /              /mnt

I'd almost tend to recommend to classify tmpfs as dummy
file system like procfs etc.

Have a nice day,
Berny




Information forwarded to bug-coreutils <at> gnu.org:
bug#19570; Package coreutils. (Mon, 12 Jan 2015 23:05:01 GMT) Full text and rfc822 format available.

Message #14 received at 19570 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>, 
 "Vladimir A. Pavlov" <pv4 <at> bk.ru>, 19570 <at> debbugs.gnu.org
Subject: Re: bug#19570: bug: df and bind mounts
Date: Mon, 12 Jan 2015 23:04:04 +0000
On 12/01/15 21:27, Bernhard Voelker wrote:
> On 01/12/2015 02:31 AM, Pádraig Brady wrote:
>> On 11/01/15 23:36, Vladimir A. Pavlov wrote:
>>> run /run tmpfs rw,noatime,nodiratime,nodev,noexec,mode=0755,size=1m 0 0
>>> /run/cgs/httpd /usr/cgs/httpd/run none rw,bind 0 0
> 
>> Thanks for the analysis and patch,
>> Current tests pass at least with it.
>> I'll analyse a little more, add tests and probably push.
> 
> hmm, tmpfs is problematic anyway, as one can specify anything
> as the dummy backing source device:
> 
>   $ mount -t tmpfs hello:/world /mnt
>   $ mount -t tmpfs something /mnt
>   $ mount -t tmpfs / /mnt
>   $ findmnt /mnt
>   TARGET SOURCE       FSTYPE OPTIONS
>   /mnt   hello:/world tmpfs  rw,relatime
>   /mnt   something    tmpfs  rw,relatime
>   /mnt   /            tmpfs  rw,relatime
> 
>   $ df -a --out=source,target | grep /mnt
>   hello:/world   /mnt
>   something      /mnt
>   /              /mnt
> 
> I'd almost tend to recommend to classify tmpfs as dummy
> file system like procfs etc.

I see what you mean.
However we take dummy to mean,
no associated storage in the memory hierarchy,
which tmpfs clearly has.

Pádraig





Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Fri, 26 Jun 2015 17:30:04 GMT) Full text and rfc822 format available.

Notification sent to Vladimir A. Pavlov <pv4 <at> bk.ru>:
bug acknowledged by developer. (Fri, 26 Jun 2015 17:30:07 GMT) Full text and rfc822 format available.

Message #19 received at 19570-done <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: "Vladimir A. Pavlov" <pv4 <at> bk.ru>, 19570-done <at> debbugs.gnu.org
Subject: Re: bug#19570: bug: df and bind mounts
Date: Fri, 26 Jun 2015 18:29:33 +0100
On 12/01/15 01:31, Pádraig Brady wrote:
> On 11/01/15 23:36, Vladimir A. Pavlov wrote:
>> Hello,
>>
>> I have an issue with df (both in version 8.23 and in master branch).
>>
>> I have tmpfs mounted as /run . There is /run/cgs/httpd subdirectory in
>> /run (just a subdirectory, not a tmpfs or another mount). This
>> /run/cgs/httpd is bind-mounted to /usr/cgs/httpd/run.
>>
>> The current algorithm in df.c:filter_mount_list() chooses the bind
>> mountpoint since it has the leading slash in the "device" name
>> ("/run/cgs/httpd" vs "run") which is wrong in my setup.
>>
>> The similar (but not the same) issue is fixed by commit:
>> http://git.savannah.gnu.org/cgit/coreutils.git/commit/src/df.c?id=ed1a495b3ccb2665a13229ca866f2115bd768d17
>>
>> I guess the "let real devices with / in the name win" replacement branch
>> should only be applied if mountpoints are the same as well.
>>
>> Below is the data to reproduce the bug.
>>
>> === /etc/mtab (partial) ===
>> run /run tmpfs rw,noatime,nodiratime,nodev,noexec,mode=0755,size=1m 0 0
>> /run/cgs/httpd /usr/cgs/httpd/run none rw,bind 0 0
>> ======
>>
>> === Real output (git) ===
>> Filesystem      Size  Used Avail Use% Mounted on
>> /run/cgs/httpd  1.0M  8.0K 1016K   1% /usr/cgs/httpd/run
>> ======
>>
>> === Expected output (with the attached patch applied) ===
>> Filesystem      Size  Used Avail Use% Mounted on
>> run             1.0M  8.0K 1016K   1% /run
>> ======
>>
> 
> Thanks for the analysis and patch,
> Current tests pass at least with it.
> I'll analyse a little more, add tests and probably push.

df v8.24 will read /proc/self/mountinfo if available
and so won't hit this issue in practise as the
bind mount location won't be passed to, or presented by df.
I.E. the "Filesystem" for a particular device id will
not switch representations.

thanks,
Pádraig.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 25 Jul 2015 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 335 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.