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 1815534

Summary: mount --rbind -o rprivate doesn't do recursive bind mount
Product: Red Hat Enterprise Linux 7 Reporter: Pavel Raiskup <praiskup>
Component: util-linuxAssignee: Karel Zak <kzak>
Status: CLOSED NEXTRELEASE QA Contact: Radka Brychtova <rskvaril>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.8CC: david.ward, kzak
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1946921 (view as bug list) Environment:
Last Closed: 2020-03-23 11:10:27 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: 1946921    
Attachments:
Description Flags
reproducer none

Description Pavel Raiskup 2020-03-20 14:09:09 UTC
Created attachment 1671921 [details]
reproducer

This bug may be used for documentation purposes only, and closed, if you wish.
It originally caused bug in mock, so we resolved it in mock PR [1].

When you do
   $ mount --rbind -o rprivate root bootstrap_root/root
.. only the top-most mount from ./root is bind-mounted to
bootstrap_root/root, not the sub-mounts like ./root/sub-mount.

This works fine on Fedora box.

Try the attached reproducer:
  # bash ./reproducer
  ...
  # findmnt --raw | cut -d' ' -f1 | grep /tmp/
  /tmp/root
  /tmp/bootstrap_root
  /tmp/root/cache_submount
  /tmp/bootstrap_root/root

It means that /tmp/bootstrap_root/root/cache_submount is missing.

[1] https://github.com/rpm-software-management/mock/pull/536

Comment 2 Karel Zak 2020-03-23 11:10:27 UTC
Sounds like bug #1584443. Unfortunately, not fixed on RHEL-7 (but fixed in RHEL>=8).

The best workaround is to split the "mount --rbind -o rprivate" command into two separate mount commands to be compatible with old versions.

Upstream commites:
 4ebea84bb1ca6b0fa817588aba13de26c8d5e5a0
 816773b475900909d42c2c8282a6ac50252cac22
 6691d53797ccc2e5ac840c5b1680fceaa23122db
 
Not sure if we really need it in RHEL-7 as it's a chance to relatively sensitive stuff and no reported by customers. 

Closing. Please, reopen if really need it. Thanks!

Comment 3 David Ward 2021-04-03 17:45:12 UTC
@Karel: no this is not fixed in RHEL 8, which also has util-linux 2.32.1 without a patch for this.

Comment 4 Karel Zak 2021-04-07 09:00:48 UTC
(In reply to David Ward from comment #3)
> @Karel: no this is not fixed in RHEL 8, which also has util-linux 2.32.1
> without a patch for this.

Ah, now I see what do you mean (for RHEL-8) 

The problem is not the feature itself, but the flag MS_REC which is not applied to
the first mount(2) call. It was originally reported for Fedora (bug #1584443) and 
fixed by upstream commit 816773b475900909d42c2c8282a6ac50252cac22.

# strace -e mount mount --rbind -o rprivate /mnt/test /mnt/test
mount("/mnt/test", "/mnt/test", 0x5607fc749960, MS_MGC_VAL|MS_BIND, NULL) = 0
mount("none", "/mnt/test", NULL, MS_REC|MS_PRIVATE, NULL) = 0

the same on Fedora:

# strace -e mount mount --rbind -o rprivate /mnt/test /mnt/test
mount("/mnt/test", "/mnt/test", 0x55c2efb1ec80, MS_BIND|MS_REC, NULL) = 0
mount("none", "/mnt/test", NULL, MS_REC|MS_PRIVATE, NULL) = 0


For RHEL-7 it's really too invasive (as there is missing all the code), but for RHEL-8
it's something we can fix in the 8.5 -- I'll clone this issue. 

Thanks for your patience ;-)