Subject: bug#20278: Possible problem with df on Solaris.

From: Rich Burridge <[email-masked]>
Date: Tue, 07 Apr 2015 19:25:14 -0700

Hi,

We are seeing the following problem with the df in coreutils version 8.23
(which we call /usr/bin/gdf on Solaris to differentiate it from the "native"
version):

Now I realize that the latest version of the GNU df utility doesn't list
all mounted file systems by default, it skips that it calls "dummy" file 
system.
However I noticed that on S12 the "/" file-system is no longer showing up
with "gdf -h". It works fine on Solaris 11.2 which has coreutils 8.16).

Here's what I see on my machine running Solaris 12 build #70:

$ gdf -h
Filesystem                       Size  Used Avail Use% Mounted on
/usr/lib/libc/libc_hwcap1.so.1   323G   13G  310G   4% /lib/libc.so.1
swap                              12G  2.4M   12G   1% /system/volatile
rpool/ROOT/os-s12-b70-take2/var  311G 1021M  310G   1% /var
swap                              12G  131M   12G   2% /tmp
rpool/VARSHARE                   310G  1.4M  310G   1% /var/share
rpool/export                     310G   32K  310G   1% /export
rpool/export/home                310G   32K  310G   1% /export/home
rpool/export/home/richb          316G  5.9G  310G   2% /export/home/richb
rpool                            310G  4.9M  310G   1% /rpool
rpool/VARSHARE/zones             310G   31K  310G   1% /system/zones
tank                             914G   41G  874G   5% /tank
rpool/VARSHARE/pkg               310G   32K  310G   1% /var/share/pkg
rpool/VARSHARE/pkg/repositories  310G   31K  310G   1% 
/var/share/pkg/repositories
strax:/                          786G   17G  770G   3% /net/strax
strax:/builds                    7.8T  1.1T  6.8T  14% /net/strax/builds

Compare this with the Solaris "native" df:

$ df -h
Filesystem             Size   Used  Available Capacity  Mounted on
rpool/ROOT/os-s12-b70-take2
                        457G    13G       310G     4%    /
/devices                 0K     0K         0K     0%    /devices
/dev                     0K     0K         0K     0%    /dev
ctfs                     0K     0K         0K     0% /system/contract
proc                     0K     0K         0K     0%    /proc
mnttab                   0K     0K         0K     0% /etc/mnttab
swap                    12G   2.3M        12G     1% /system/volatile
objfs                    0K     0K         0K     0% /system/object
sharefs                  0K     0K         0K     0% /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
                        322G    13G       310G     4% /lib/libc.so.1
fd                       0K     0K         0K     0%    /dev/fd
rpool/ROOT/os-s12-b70-take2/var
                        457G  1020M       310G     1%    /var
swap                    12G   130M        12G     2%    /tmp
rpool/VARSHARE         457G   1.3M       310G     1%    /var/share
rpool/export           457G    32K       310G     1%    /export
rpool/export/home      457G    32K       310G     1% /export/home
rpool/export/home/richb
                        457G   5.9G       310G     2% /export/home/richb
rpool                  457G   4.9M       310G     1%    /rpool
rpool/VARSHARE/zones   457G    31K       310G     1% /system/zones
tank                   914G    40G       873G     5%    /tank
rpool/VARSHARE/pkg     457G    32K       310G     1% /var/share/pkg
rpool/VARSHARE/pkg/repositories
                        457G    31K       310G     1% 
/var/share/pkg/repositories
strax:/                786G    17G       769G     3%    /net/strax

You'll notice that gdf no longer shows the "/" file-system:

rpool/ROOT/os-s12-b70-take2
                        457G    13G       310G     4%    /

Paul (Eggert) mentioned that adding the -a option gives the correct output:

$ gdf -h -a
Filesystem                       Size  Used Avail Use% Mounted on
rpool/ROOT/os-s12-b70-take2         -     -     -    - /
/devices                            0     0     0    - /devices
/dev                                0     0     0    - /dev
ctfs                                0     0     0    - /system/contract
proc                                0     0     0    - /proc
mnttab                              0     0     0    - /etc/mnttab
swap                              12G  2.4M   12G   1% /system/volatile
objfs                               0     0     0    - /system/object
sharefs                             0     0     0    - /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1   323G   13G  310G   4% /lib/libc.so.1
fd                                  0     0     0    - /dev/fd
rpool/ROOT/os-s12-b70-take2/var  311G 1021M  310G   1% /var
swap                              12G  131M   12G   2% /tmp
rpool/VARSHARE                   310G  1.4M  310G   1% /var/share
rpool/export                     310G   32K  310G   1% /export
rpool/export/home                310G   32K  310G   1% /export/home
rpool/export/home/richb          316G  5.9G  310G   2% /export/home/richb
rpool                            310G  4.9M  310G   1% /rpool
rpool/VARSHARE/zones             310G   31K  310G   1% /system/zones
tank                             914G   41G  874G   5% /tank
rpool/VARSHARE/pkg               310G   32K  310G   1% /var/share/pkg
rpool/VARSHARE/pkg/repositories  310G   31K  310G   1% 
/var/share/pkg/repositories
-hosts                              0     0     0    - /net
auto_home                           0     0     0    - /home
-fedfs                              0     0     0    - /nfs4
strax:/                          786G   17G  770G   3% /net/strax

but it suggests that there might be a bug here, and "/" should be
there without the need to specify -a.

More info:

$ mount
/ on rpool/ROOT/os-s12-b70-take2 
read/write/setuid/devices/rstchown/dev=4750002 on Wed Dec 31 16:00:00 1969
/devices on /devices read/write/setuid/devices/rstchown/dev=9040000 on 
Fri Mar 27 06:16:10 2015
/dev on /dev read/write/setuid/devices/rstchown/dev=9080000 on Fri Mar 
27 06:16:10 2015
/system/contract on ctfs read/write/setuid/devices/rstchown/dev=9180001 
on Fri Mar 27 06:16:11 2015
/proc on proc read/write/setuid/devices/rstchown/dev=90c0000 on Fri Mar 
27 06:16:11 2015
/etc/mnttab on mnttab read/write/setuid/devices/rstchown/dev=91c0001 on 
Fri Mar 27 06:16:11 2015
/system/volatile on swap 
read/write/setuid/devices/rstchown/xattr/dev=9200001 on Fri Mar 27 
06:16:11 2015
/system/object on objfs read/write/setuid/devices/rstchown/dev=9240001 
on Fri Mar 27 06:16:11 2015
/etc/dfs/sharetab on sharefs 
read/write/setuid/devices/rstchown/dev=9280001 on Fri Mar 27 06:16:11 2015
/lib/libc.so.1 on /usr/lib/libc/libc_hwcap1.so.1 
read/write/setuid/devices/rstchown/dev=4750002 on Fri Mar 27 06:16:28 2015
/dev/fd on fd read/write/setuid/devices/rstchown/dev=9340001 on Fri Mar 
27 06:16:28 2015
/var on rpool/ROOT/os-s12-b70-take2/var 
read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=4750004 
on Fri Mar 27 06:16:44 2015
/tmp on swap read/write/setuid/devices/rstchown/xattr/dev=9200002 on Fri 
Mar 27 06:16:44 2015
/var/share on rpool/VARSHARE 
read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=4750005 
on Fri Mar 27 06:16:45 2015
/export on rpool/export 
read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=4750006 
on Fri Mar 27 06:18:26 2015
/export/home on rpool/export/home 
read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=4750007 
on Fri Mar 27 06:18:26 2015
/export/home/richb on rpool/export/home/richb 
read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=4750008 
on Fri Mar 27 06:18:26 2015
/rpool on rpool 
read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=4750009 
on Fri Mar 27 06:18:26 2015
/system/zones on rpool/VARSHARE/zones 
read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=475000a 
on Fri Mar 27 06:18:27 2015
/tank on tank 
read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=475000b 
on Fri Mar 27 06:18:27 2015
/var/share/pkg on rpool/VARSHARE/pkg 
read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=475000c 
on Fri Mar 27 06:18:27 2015
/var/share/pkg/repositories on rpool/VARSHARE/pkg/repositories 
read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=475000d 
on Fri Mar 27 06:18:27 2015

$ mount -p
rpool/ROOT/os-s12-b70-take2 - / zfs - no
/devices - /devices devfs - no
/dev - /dev dev - no
ctfs - /system/contract ctfs - no
proc - /proc proc - no
mnttab - /etc/mnttab mntfs - no
swap - /system/volatile tmpfs - no xattr
objfs - /system/object objfs - no
sharefs - /etc/dfs/sharetab sharefs - no
/usr/lib/libc/libc_hwcap1.so.1 - /lib/libc.so.1 lofs - no
fd - /dev/fd fd - no rw
rpool/ROOT/os-s12-b70-take2/var - /var zfs - no 
rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime
swap - /tmp tmpfs - no xattr
rpool/VARSHARE - /var/share zfs - no 
rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime
rpool/export - /export zfs - no 
rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime
rpool/export/home - /export/home zfs - no 
rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime
rpool/export/home/richb - /export/home/richb zfs - no 
rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime
rpool - /rpool zfs - no rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime
rpool/VARSHARE/zones - /system/zones zfs - no 
rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime
tank - /tank zfs - no rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime
rpool/VARSHARE/pkg - /var/share/pkg zfs - no 
rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime
rpool/VARSHARE/pkg/repositories - /var/share/pkg/repositories zfs - no 
rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime

I've also attached the output from two truss runs (truss is the
Solaris equivilent of strace):

1/

$ truss -o solaris-df.out -a -f -e /usr/bin/df -h
Filesystem             Size   Used  Available Capacity  Mounted on
rpool/ROOT/os-s12-b70-take2
                        457G    13G       309G     4%    /
/devices                 0K     0K         0K     0%    /devices
/dev                     0K     0K         0K     0%    /dev
ctfs                     0K     0K         0K     0% /system/contract
proc                     0K     0K         0K     0%    /proc
mnttab                   0K     0K         0K     0% /etc/mnttab
swap                    12G   2.3M        12G     1% /system/volatile
objfs                    0K     0K         0K     0% /system/object
sharefs                  0K     0K         0K     0% /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
                        322G    13G       309G     4% /lib/libc.so.1
fd                       0K     0K         0K     0%    /dev/fd
rpool/ROOT/os-s12-b70-take2/var
                        457G  1020M       309G     1%    /var
swap                    12G   130M        12G     2%    /tmp
rpool/VARSHARE         457G   1.3M       309G     1%    /var/share
rpool/export           457G    32K       309G     1%    /export
rpool/export/home      457G    32K       309G     1% /export/home
rpool/export/home/richb
                        457G   6.0G       309G     2% /export/home/richb
rpool                  457G   4.9M       309G     1%    /rpool
rpool/VARSHARE/zones   457G    31K       309G     1% /system/zones
tank                   914G    40G       873G     5%    /tank
rpool/VARSHARE/pkg     457G    32K       309G     1% /var/share/pkg
rpool/VARSHARE/pkg/repositories
                        457G    31K       309G     1% 
/var/share/pkg/repositories

2/

$ truss -o gnu-df.out -a -f -e /usr/bin/gdf -h
Filesystem                       Size  Used Avail Use% Mounted on
/usr/lib/libc/libc_hwcap1.so.1   323G   13G  310G   4% /lib/libc.so.1
swap                              13G  2.4M   13G   1% /system/volatile
rpool/ROOT/os-s12-b70-take2/var  311G 1021M  310G   1% /var
swap                              13G  131M   13G   2% /tmp
rpool/VARSHARE                   310G  1.4M  310G   1% /var/share
rpool/export                     310G   32K  310G   1% /export
rpool/export/home                310G   32K  310G   1% /export/home
rpool/export/home/richb          316G  6.1G  310G   2% /export/home/richb
rpool                            310G  4.9M  310G   1% /rpool
rpool/VARSHARE/zones             310G   31K  310G   1% /system/zones
tank                             914G   41G  874G   5% /tank
rpool/VARSHARE/pkg               310G   32K  310G   1% /var/share/pkg
rpool/VARSHARE/pkg/repositories  310G   31K  310G   1% 
/var/share/pkg/repositories

 From a cursory look at the output, I'm not sure there's going to be
enough information to go on there, so if you can suggest places where
I should add debug to .../coreutils-8.23/src/df.c (or wherever), then
I'll do that, and send on that output.

Thanks.