Re: [PATCH] df: avoid stat() for dummy file systems with -l
From:
Bernhard Voelker
Subject:
Re: [PATCH] df: avoid stat() for dummy file systems with -l
Date:
Wed, 2 Aug 2017 08:10:11 +0200
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0
On 08/01/2017 04:49 PM, Kamil Dudka wrote:
> If I understand it correctly, your patch takes effect regardless the use
> of -l option. Then please remove it from the summary to make it clear.
>
> The optimized-out stat() call is, however, not the only change done by
> your commit. It has a side-effect that is observable from df's output
> (and completely unrelated to autofs or remote file systems). At first
> glance, the side-effect looks useful but it should be properly analyzed
> and documented...
>
> Consider the following example:
>
> # mount -t proc none /opt
> # mount -t tmpfs none /opt
>
> Now unpached df does not list the /opt entry:
>
> # df | grep opt
>
> ... but after your patch, it does:
>
> # df | grep opt
> none 2005384 0 2005384 0% /opt
>
> Note that it was important that I have used the same "device" in both
> the mount commands.
hmm, adding that little condition was too tempting - as there is the
same one later on in get_dev(). ;-/
This sounds like there is another bug to fix in filter_mount_list
wrt over-mounting.
Maybe it should process the entries from /proc/self/mountinfo from
the end instead of the beginning: by this it would be easier to filter
out over-mounted file systems.
WDYT?
Have a nice day,
Berny