Bug 1024730

Summary: While mounting two different file system (ext3, ext4 ) df tool shows only one mounted file system
Product: [Fedora] Fedora Reporter: IBM Bug Proxy <bugproxy>
Component: coreutilsAssignee: Ondrej Vasik <ovasik>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 20CC: admiller, bugproxy, extras-orphan, hannsj_uhl, jkachuck, jonathan, kdudka, kzak, mluscon, ooprala, ovasik, pbrady, p, rvokal, twaugh, wgomerin
Target Milestone: ---   
Target Release: ---   
Hardware: s390x   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-19 21:20:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
df patch
none
sosreport none

Description IBM Bug Proxy 2013-10-30 10:38:55 UTC
== Comment: #2 - Onkar N. Mahajan <onmahaja.com> - 2013-10-16 01:17:48 ==
=== Problem Statement === 

(1) You mounted two partititions - 
    part    -> fs   -> mnt point    ->  avl disk    ->  used    ->  avl %
------------------------------------------------------------------------------
    mpath1  -> fuse -> /tmp/test/   ->  1.0 T       ->  1.0 T   ->  100% 
    mpath2  -> ext3 -> /mnt         ->  1.8 T       ->  21G     ->  2% 
 
(2) You unmount the /mnt (formatted with ext3)
(3) mount mpath2 (you unmounted in step 2) on /tmp/test/
(4) Now , you do df and expect this - 

Filesystem          Type      Size  Used Avail Use% Mounted on
/dev/mapper/mpatha2 ext3      1.8T   21G  1.7T   2% /tmp/test
 
But you see this - 
Filesystem          Type      Size  Used Avail Use% Mounted on
/dev/mapper/mpatha1 fuse      1.8T   21G  1.7T   2% /tmp/test

== Comment: #4 - NITIN GARG <nitgarg8.com> - 2013-10-16 01:24:26 ==
(In reply to comment #2)
> === Problem Statement === 
> 
> (1) You mounted two partititions - 
>     part    -> fs   -> mnt point    ->  avl disk    ->  used    ->  avl %
> -----------------------------------------------------------------------------
> -
>     mpath1  -> fuse -> /tmp/test/   ->  1.0 T       ->  1.0 T   ->  100% 
>     mpath2  -> ext3 -> /mnt         ->  1.8 T       ->  21G     ->  2% 
>  
> (2) You unmount the /mnt (formatted with ext3)
> (3) mount mpath2 (you unmounted in step 2) on /tmp/test/
> (4) Now , you do df and expect this - 
> 
> Filesystem          Type      Size  Used Avail Use% Mounted on
> /dev/mapper/mpatha2 ext3      1.8T   21G  1.7T   2% /tmp/test
>  
> But you see this - 
> Filesystem          Type      Size  Used Avail Use% Mounted on
> /dev/mapper/mpatha1 fuse      1.8T   21G  1.7T   2% /tmp/test

yes Onkar you are right I see the old mounted partition only. like as you explained mpatha1 in this case.

== Comment: #5 - Onkar N. Mahajan <onmahaja.com> - 2013-10-16 01:50:25 ==
Nitin, I am examining the issue , until then can you please follow the same procedure for two partitions of different sizes but the and use some other filesystem in place of 'fuse'. What are the results in this case ?

Regards,
Onkar

== Comment: #6 - NITIN GARG <nitgarg8.com> - 2013-10-16 01:53:30 ==
(In reply to comment #5)
> Nitin, I am examining the issue , until then can you please follow the same
> procedure for two partitions of different sizes but the and use some other
> filesystem in place of 'fuse'. What are the results in this case ?
> 
> Regards,
> Onkar

Onkar, 

   As I have stated in my comments earlier : 

Same have been tested on RHEL7 with DASD : 

[root@r3513004 ~]# mke2fs -j /dev/dasdc1
mke2fs 1.42.6 (21-Sep-2012)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
451584 inodes, 1803036 blocks
90151 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1849688064
56 block groups
32768 blocks per group, 32768 fragments per group
8064 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

[root@r3513004 ~]# mke2fs -t ext4 /dev/dasdd1
mke2fs 1.42.6 (21-Sep-2012)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
451584 inodes, 1803036 blocks
90151 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1849688064
56 block groups
32768 blocks per group, 32768 fragments per group
8064 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

[root@r3513004 ~]# mount /dev/dasdc1 /mnt
[root@r3513004 ~]# df -hT
Filesystem     Type      Size  Used Avail Use% Mounted on
devtmpfs       devtmpfs  427M     0  427M   0% /dev
tmpfs          tmpfs     433M     0  433M   0% /dev/shm
tmpfs          tmpfs     433M  1.8M  431M   1% /run
tmpfs          tmpfs     433M     0  433M   0% /sys/fs/cgroup
/dev/dasda1    ext3      6.8G  809M  5.7G  13% /
/dev/dasdc1    ext3      6.8G  144M  6.3G   3% /mnt
[root@r3513004 ~]# mount /dev/dasdd1 /mnt
[root@r3513004 ~]# df -hT
Filesystem     Type      Size  Used Avail Use% Mounted on
devtmpfs       devtmpfs  427M     0  427M   0% /dev
tmpfs          tmpfs     433M     0  433M   0% /dev/shm
tmpfs          tmpfs     433M  1.8M  431M   1% /run
tmpfs          tmpfs     433M     0  433M   0% /sys/fs/cgroup
/dev/dasda1    ext3      6.8G  809M  5.7G  13% /
/dev/dasdc1    ext3      6.8G  144M  6.3G   3% /mnt

Though the size here is same but it doesn't matter. You can see that though I mounted dasdd1 but it shows me same pattern dasdc1.

Thanks
Nitin

== Comment: #7 - Onkar N. Mahajan <onmahaja.com> - 2013-10-16 04:01:50 ==
IMO, when you stack mount ext3 fs on top of fusefs , and do df , you must see both the mount points 
something like this - 

/dev/mapper/mpatha2 ext3      1.8T   21G  1.7T   2% /tmp/test
/dev/mapper/mpatha1 fuse      1.0T  1.0T     0 100% /tmp/test

Examined the coreutils-8.15 package (latest available package for fc17). Observations are following - 
(1) df makes a list of mounted filesystems.
(2) for each mountpoint - it stat's the mount point for the device id (stat.st_dev) and returns the 
    first entry found with the given mountpoint and device ID. Doesn't see all the device IDs at all. Whereas , in 
    fact it must list all the mounted partitions. 

I propose a patch here , this patch essentially does the following - 

looks up the device list for devices with a given mount point. Prepares a list of devices mounted on 
a given mount point and then appends this list at the end of a global device list of mounted devices.

I this way , all the mounted devices will be listed , this holds true even for unionfs.

Regards,
Onkar

== Comment: #10 - NITIN GARG <nitgarg8.com> - 2013-10-16 04:37:32 ==


== Comment: #16 - Onkar N. Mahajan <onmahaja.com> - 2013-10-25 00:21:00 ==
Issue is also observed on fedora 19.

# mke2fs -t ext3 /dev/dasdb2
mke2fs 1.42.7 (21-Jan-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
386304 inodes, 1544196 blocks
77209 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1585446912
48 block groups
32768 blocks per group, 32768 fragments per group
8048 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

#mount /dev/dasdb2 /mnt

# df -hT
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/dasda1    ext4      6.7G  4.4G  2.0G  70% /
devtmpfs       devtmpfs  491M     0  491M   0% /dev
tmpfs          tmpfs     496M     0  496M   0% /dev/shm
tmpfs          tmpfs     496M  220K  495M   1% /run
tmpfs          tmpfs     496M     0  496M   0% /sys/fs/cgroup
tmpfs          tmpfs     496M  4.0K  496M   1% /tmp
/dev/dasdb1    ext4      469M   68M  376M  16% /boot
/dev/dasdb2    ext3      5.7G   12M  5.4G   1% /mnt


# mke2fs -t ext4 /dev/dasdc1
mke2fs 1.42.7 (21-Jan-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
451584 inodes, 1803036 blocks
90151 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1849688064
56 block groups
32768 blocks per group, 32768 fragments per group
8064 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

# mount /dev/dasdc1 /mnt

# df -hT
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/dasda1    ext4      6.7G  4.4G  2.0G  70% /
devtmpfs       devtmpfs  491M     0  491M   0% /dev
tmpfs          tmpfs     496M     0  496M   0% /dev/shm
tmpfs          tmpfs     496M  224K  495M   1% /run
tmpfs          tmpfs     496M     0  496M   0% /sys/fs/cgroup
tmpfs          tmpfs     496M  4.0K  496M   1% /tmp
/dev/dasdb1    ext4      469M   68M  376M  16% /boot
/dev/dasdb2    ext3      6.7G   16M  6.3G   1% /mnt

I see only /dev/dasdb2 though I mount /dev/dasdc1 of ext4 type.

== Comment: #18 - Onkar N. Mahajan <onmahaja.com> - 2013-10-30 06:08:04 ==
looking at the source code , looks like this must be reproduced on f20 as well ..

Comment 1 IBM Bug Proxy 2013-10-30 10:39:10 UTC
Created attachment 817390 [details]
df patch

Comment 2 IBM Bug Proxy 2013-10-30 10:39:25 UTC
Created attachment 817391 [details]
sosreport

Comment 3 IBM Bug Proxy 2014-02-27 17:31:12 UTC
------- Comment From thorsten.diehl.com 2014-02-27 17:23 EDT-------
I can not reproduce this on RHEL7.0 snap8 with various filesystems, and also with a change and manually mounted filesystem it was ok, see here:

[root@p2315003 ~]# df -hT
/dev/dasda1    ext4      3.8G  715M  2.9G  20% /
devtmpfs       devtmpfs  994M     0  994M   0% /dev
tmpfs          tmpfs     999M     0  999M   0% /dev/shm
tmpfs          tmpfs     999M  8.3M  991M   1% /run
tmpfs          tmpfs     999M     0  999M   0% /sys/fs/cgroup
/dev/dasdb2    ext4      5.7G   12M  5.4G   1% /home
/dev/dasda2    ext3      1.9G   26M  1.8G   2% /var
/dev/dasdb1    xfs       469M   71M  398M  16% /boot
/dev/dasda3    xfs       569M   31M  539M   6% /srv
[root@p2315003 ~]# cat /etc/fstab |grep dasd
[root@p2315003 ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Thu Feb 27 17:12:39 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/disk/by-path/ccw-0.0.5c06-part1 /                       ext4    defaults        1 1
/dev/disk/by-path/ccw-0.0.5c07-part1 /boot                   xfs     defaults        1 2
/dev/disk/by-path/ccw-0.0.5c07-part2 /home                   ext4    defaults        1 2
/dev/disk/by-path/ccw-0.0.5c06-part3 /srv                    xfs     defaults        1 2
/dev/disk/by-path/ccw-0.0.5c06-part2 /var                    ext3    defaults        1 2
/dev/disk/by-path/ccw-0.0.5c07-part3 swap                    swap    defaults        0 0
[root@p2315003 ~]# umount /srv
[root@p2315003 ~]# mkfs.ext4 /dev/disk/by-path/ccw-0.0.5c06-part3
mke2fs 1.42.9 (28-Dec-2013)
38400 inodes, 153600 blocks
7680 blocks (5.00%) reserved for the super user
Maximum filesystem blocks=159383552
5 block groups
7680 inodes per group
32768, 98304

Creating journal (4096 blocks): done

[root@p2315003 ~]# mount -t ext4 /dev/disk/by-path/ccw-0.0.5c06-part3 /srv
[root@p2315003 ~]# df -hT
/dev/dasda1    ext4      3.8G  715M  2.9G  20% /
devtmpfs       devtmpfs  994M     0  994M   0% /dev
tmpfs          tmpfs     999M     0  999M   0% /dev/shm
tmpfs          tmpfs     999M  8.3M  991M   1% /run
tmpfs          tmpfs     999M     0  999M   0% /sys/fs/cgroup
/dev/dasdb2    ext4      5.7G   12M  5.4G   1% /home
/dev/dasda2    ext3      1.9G   26M  1.8G   2% /var
/dev/dasdb1    xfs       469M   71M  398M  16% /boot
/dev/dasda3    ext4      575M  468K  533M   1% /srv
[root@p2315003 ~]#

Comment 4 Ondrej Vasik 2014-02-28 08:07:04 UTC
Actually, what you see is caused by the change of /etc/mtab to symlink to /proc/mounts. df needs to do the deduplication, otherwise you can sometimes see dozens of duplicates because of bindmounts and various other "unwanted" items. Unfortunately, deduplication with the shortest mount approach has some disadvantages - but every approach we tried is not perfect.
For showing all mounted filesystems you can use df -a (or --all). Does that answer your question/concern? I tend to close it either CANTFIX or NOTABUG - as the behaviour is the result of the systemwide change and there is no good way how to fix it (other than some nasty workarounds like behaving differently for things like fuse fs).

Comment 5 Ondrej Vasik 2014-06-19 21:20:03 UTC
As no further comment is provided, I'm closing this CANTFIX ... we know about the df deduplication deficiencies and these are already tracked by various bugzillas (and were discussed upstream). Unfortunately, there is no clear solution atm. - and keeping this one opened doesn't make sense.

Comment 6 Pádraig Brady 2014-06-20 02:19:52 UTC
I think there were issues here.
though there is no point showing old mounts that can't be accessed.

The soon to be released coreutils 8.23 will show the last (i.e. only accessible)
details for a mount point, as per these commits:

http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commit;h=25a2c948
http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commit;h=4f8d74eb

Comment 7 IBM Bug Proxy 2017-07-13 11:30:40 UTC
------- Comment From hannsj_uhl.com 2017-07-13 07:29 EDT-------
.