Bug 1100026

Summary: 'df' command omits mounted NFS shares with the same superblock unless '-a' flag is used. (improve deduplication)
Product: Red Hat Enterprise Linux 7 Reporter: Kyle Squizzato <ksquizza>
Component: coreutilsAssignee: Ondrej Vasik <ovasik>
Status: CLOSED ERRATA QA Contact: Vaclav Danek <vdanek>
Severity: medium Docs Contact:
Priority: urgent    
Version: 7.0CC: feyang, fkrska, jayashree_doijad, jherrman, jscotka, kdudka, marbet, modellera, ooprala, ovasik, paulds, sreber, vdanek
Target Milestone: rcKeywords: FutureFeature, Reproducer, ZStream
Target Release: 7.1   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: coreutils-8.22-13.el7 Doc Type: Bug Fix
Doc Text:
Previously, if multiple NFS mount points shared a superblock, the "df" command only listed one of them unless the "-a" option was used. This update improves the filtering methods of "df", and the command now properly displays all NFS mount points on the same superblock.
Story Points: ---
Clone Of:
: 1247128 (view as bug list) Environment:
Last Closed: 2015-11-19 12:44:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1247128    

Description Kyle Squizzato 2014-05-21 20:05:30 UTC
Description of problem:
The 'df' command omits mounted NFS shares with the same superblock unless the '-a' to show dummy filesystems is used.

If I create a new share underneath the existing /share/ directory I can provide an example of this behavior:

# df -ht nfs
Filesystem                             Size  Used Avail Use% Mounted on
scooby.usersys.redhat.com:/share       360G  212G  131G  62% /mnt/nfs

I need the 'a' flag to make the share show up: 

# df -hat nfs
Filesystem                             Size  Used Avail Use% Mounted on
scooby.usersys.redhat.com:/share       360G  212G  131G  62% /mnt/nfs
scooby.usersys.redhat.com:/share/test  360G  212G  131G  62% /mnt/nfs_share

If I modify my /etc/exports file on the NFS server so that each export has a different fsid, thus a different NFS superblock it fixes the issue: 

/share *(rw,sync,no_subtree_check,no_root_squash,insecure,fsid=2)
/share/test *(rw,sync,fsid=3)

And the -a is no longer needed: 

# df -ht nfs
Filesystem                             Size  Used Avail Use% Mounted on
scooby.usersys.redhat.com:/share       360G  212G  131G  62% /mnt/nfs
scooby.usersys.redhat.com:/share/test  360G  212G  131G  62% /mnt/nfs_share

crash> mount | grep 'nfs '
     MOUNT           SUPERBLK     TYPE   DEVNAME   DIRNAME
ffff880018707400 ffff88003a5c4c00 nfs    scooby.usersys.redhat.com:/share /mnt/nfs  
ffff88003becc100 ffff88001cf8c800 nfs    scooby.usersys.redhat.com:/share/test /mnt/nfs_share

Once we remove the fsid's I have identical superblocks, thus 'df' omits the second share.

ffff880014faa700 ffff88003cd16800 nfs    scooby.usersys.redhat.com:/share/test /mnt/nfs_share
ffff880018619300 ffff88003cd16800 nfs    scooby.usersys.redhat.com:/share /mnt/nfs  

Version-Release number of selected component (if applicable):
coreutils-8.22-11.el7

How reproducible:
Always

Steps to Reproduce:
1. Mount two shares from the same underlying directory tree (so that they share a common NFS superblock) 

for example: 

/share/foo
/share/bar 

2. Run 'df' 

The behavior can be corrected by adding an fsid to each export, thusly modifying the NFS superblocks for each of the shares.

Actual results:
'df' omits shares with the same superblock 

Expected results:
'df' should show all underlying NFS shares mounted at different directories regardless of their superblock.


Additional info:
I think this can be argued as NOTABUG, however this implementation:

 1) Is a significant change in behavior for the 'df' command from previous Linux (and non-Linux) implementations
 
 2) Ignores the possibility that NFS servers may implement things like subdirectory-level quotas.

Comment 2 Kyle Squizzato 2014-05-21 20:32:43 UTC
So the behavior is purely caused by the deduplication most likely related to this upstream commit https://lists.gnu.org/archive/html/coreutils/2013-01/txtBi0iwyxKsd.txt

Maybe there needs to be some form of logic to not deduplicate NFS shares?

Comment 3 Ondrej Vasik 2014-05-22 06:08:53 UTC
Yes, it is caused by the /etc/mtab -> /proc/mounts symlink. This caused massive ammount of duplicate entries, therefore multiple bug reports/complains. Deduplication was added in cooperation with upstream, but it is probably too aggressive for some of the filesystems - NFS is likely not the only one. Adding FutureFeature keyword, there were multiple complains about the deduplication, but every solution had some drawback so far. We should resolve it somehow in RHEL 7.1+, though.

Comment 4 Ondrej Vasik 2014-11-05 16:23:18 UTC
*** Bug 1110624 has been marked as a duplicate of this bug. ***

Comment 5 Ondrej Vasik 2014-11-05 16:28:26 UTC
As a sidenote, upstream is discussing removing deduplication for remote filesystems. http://lists.gnu.org/archive/html/coreutils/2014-10/msg00073.html

In addition
http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=097897bd2c9de5723af24b3848d6d922a862064b improves the docs so it mentions the "deduplication".

Comment 6 Ondrej Vasik 2015-03-30 07:08:20 UTC
Part will be covered by #1197463 (to some extend duplicates), this one will likely be about "extending documentation as well".

Comment 8 Ondrej Vasik 2015-05-26 21:02:26 UTC
*** Bug 1221170 has been marked as a duplicate of this bug. ***

Comment 12 Filip Krska 2015-07-07 13:55:46 UTC
use case from #9 tested and seems OK with coreutils-8.22-13.el7 in my environment:

# rpm -q coreutils
coreutils-8.22-11.el7.x86_64
# df -a|grep /mnt
/etc/auto.direct             30487552 23447424   5491456  82% /mnt
# df -a|grep /mnt
/etc/auto.direct             30487552 23447424   5491456  82% /mnt
rhel62:/tmp                  30487552 23447424   5491456  82% /mnt
# df |grep /mnt
<empty>

not expected ^^

# rpm -q coreutils
coreutils-8.22-13.el7.x86_64
# df -a|grep /mnt
/etc/auto.direct                    -        -         -    - /mnt
rhel62:/tmp                  30487552 23447552   5491328  82% /mnt
# df |grep /mnt
rhel62:/tmp                  30487552 23447552   5491328  82% /mnt

expected ^^

Comment 17 errata-xmlrpc 2015-11-19 12:44:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2160.html

Comment 18 yangfei 2017-01-03 03:25:11 UTC
on rhel7.3 the issue seems still exists, the reproduce steps as below:

Server:
      
[root@NFS-Server ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.3 (Maipo)

[root@NFS-Server ~]# uname -a
Linux NFS-Server 3.10.0-514.el7.x86_64 #1 SMP Wed Oct 19 11:24:13 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux

[root@NFS-Server ~]# cat /etc/exports
/nfs_share	192.168.53.0/24(rw,sync,no_root_squash)	

Client:

[root@NFS-Client ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.3 (Maipo)

[root@NFS-Client ~]# uname -a
Linux NFS-Client 3.10.0-514.el7.x86_64 #1 SMP Wed Oct 19 11:24:13 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux

[root@NFS-Client ~]# mount -t nfs 192.168.53.128:/nfs_share /test1
[root@NFS-Client ~]# mount -t nfs 192.168.53.128:/nfs_share /test2

[root@NFS-Client ~]# df -h
Filesystem                 Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root       46G  3.0G   43G   7% /
devtmpfs                   1.9G     0  1.9G   0% /dev
tmpfs                      1.9G   84K  1.9G   1% /dev/shm
tmpfs                      1.9G  9.0M  1.9G   1% /run
tmpfs                      1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/sda1                 1014M  173M  842M  18% /boot
tmpfs                      378M   12K  378M   1% /run/user/42
tmpfs                      378M     0  378M   0% /run/user/0
192.168.53.128:/nfs_share   46G  3.0G   43G   7% /test1

[root@NFS-Client ~]# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,size=1916868k,nr_inodes=479217,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_prio,net_cls)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/mapper/rhel-root on / type xfs (rw,relatime,attr2,inode64,noquota)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=36,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
nfsd on /proc/fs/nfsd type nfsd (rw,relatime)
/dev/sda1 on /boot type xfs (rw,relatime,attr2,inode64,noquota)
tmpfs on /run/user/42 type tmpfs (rw,nosuid,nodev,relatime,size=386556k,mode=700,uid=42,gid=42)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
gvfsd-fuse on /run/user/42/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=42,group_id=42)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=386556k,mode=700)
192.168.53.128:/nfs_share on /test1 type nfs4 (rw,relatime,vers=4.0,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.53.129,local_lock=none,addr=192.168.53.128)
192.168.53.128:/nfs_share on /test2 type nfs4 (rw,relatime,vers=4.0,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.53.129,local_lock=none,addr=192.168.53.128)

[root@NFS-Client ~]# df -at nfs
df: no file systems processed

Comment 19 Kamil Dudka 2017-01-03 06:57:54 UTC
I believe this will be eventually fixed with bug #1042840.