Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1650045

Summary: When using bind mounts, df shows bind mountpoint instead of real one
Product: Red Hat Enterprise Linux 7 Reporter: Gonzalo Siero <gsierohu>
Component: coreutilsAssignee: Kamil Dudka <kdudka>
Status: CLOSED DUPLICATE QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.5CC: kdudka
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-11-15 09:36:59 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:

Description Gonzalo Siero 2018-11-15 09:09:37 UTC
Description of problem:

df displays bind mounts instead of "real" mounts if the bind mount is mounted to a shorter directory.

Version-Release number of selected component (if applicable):

I've tested in RHEL 7.5/coreutils-8.22-21.el7.x86_64 but the code is the
same for newer versions.

How reproducible:

Steps to Reproduce:

Suppose you mount "/dev/sdb" in "/export/home" (in my case ext4), then by
simply creating a bind mount with shorter mountpoint (strlen), will provoke the issue :

# mount --bind -s  -o defaults /export/home/test /home/test

Actual results:

# df -k|grep sdb
/dev/sdb             5029504 1044508     3706468  22% /home/test

Expected results:

# df -k|grep sdb
/dev/sdb             5029504 1044508     3706468  22% /export/home

Additional info:

The reason why this happens is because bind mounts cannot be differentiated 
from original ones, so st_dev in a stat syscall gives the same value. Then
in filter_mount_list() (src/df.c) the "real" mountpoint is dicarded when the
bind mountpoint strlen is shorter...

Looks like there has been some discussion upstream regarding this, see
3babaf83875ceac896c8dd3a64248e955dfecef9

Comment 2 Kamil Dudka 2018-11-15 09:36:59 UTC
Thank you for reporting it!  I believe this is already tracked as bug #1042840.

*** This bug has been marked as a duplicate of bug 1042840 ***