Bug 1262436

Summary: Shared mount point not keep inconsistent between child and parent processes
Product: [Fedora] Fedora Reporter: haosdent <haosdent>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: CLOSED INSUFFICIENT_DATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: esandeen, gansalmon, itamar, jonathan, kernel-maint, madhu.chinakonda, mchehab, ovasik
Target Milestone: ---Flags: jforbes: needinfo?
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-23 17:17:28 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 haosdent 2015-09-11 16:37:21 UTC
Description of problem:

Let me try to explain the background:

In main thread:

We use 

    mount --bind source target
    mount --make-shared target

to create this shared mount point `target`

And then we use `CLONE_NEWNS` to clone a child thread(Only sleep, do nothing). So far everything looks normal.

And then in main thread, we umount the `target` successfully. According this kernel document: [sharedsubtree](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt). The child thread should also see the `target` has already umount although the child thread is started by `CLONE_NEWNS`. But the problem apprears now:

In child process, we cat `/proc/self/mountinfo` and found `target` still exists! This is an unmatch behaviour in above document. In main process, we cat `/proc/self/mountinfo` and found `taregt` has already unmount. Now we could not rmdir `target` folder because child is still holding this shared mount point.


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


How reproducible:


Steps to Reproduce:
1. (In main thread) mount --bind source target
2. (In main thread) mount --make-shared target
3. Clone a new child thread with CLONE_NEWNS
4. (In child thread) just sleep, do nothing
5. (In main thread) umount target
6. (In main thread) rm -rf target

Actual results:

rmdir return 'Device or resource busy'. The mount informations about target are inconsistent between child and parent processes

Expected results:

rmdir success

Additional info:

Comment 1 haosdent 2015-09-11 17:16:21 UTC
It also could reproduce through shell.

1. (In main bash) mount --bind /tmp/source /tmp/target
2. (In main bash) mount --make-shared /tmp/target
3. (Start child bash) unshare -m /bin/bash 
4. (In main bash) umount /tmp/target
5. (In main bash) rmdir /tmp/target return `Device or resource busy`
6. (In main bash) cat /proc/self/mountinfo could not see /tmp/target
7. (In child bash) cat /proc/self/mountinfo could found /tmp/target
   ```
   78 48 8:3 /tmp/source /tmp/target rw,relatime shared:1 - ext4 /dev/disk/by-uuid/98708f21-a59d-4b80-a85c-27b78c22e316 rw,errors=remount-ro,data=ordered
   ```

Comment 2 Ondrej Vasik 2015-09-11 17:28:31 UTC
Filesystem handles basic system directory layout. It has nothing to do with filesystems generally. Let's move it to kernel filesystem subcomponent, however it may be reassigned later to something else. Adding Eric Sandeen to cc - as he takes care of ext4 (which is mentioned as a filesystem here).

Comment 3 Justin M. Forbes 2015-10-20 19:30:15 UTC
*********** MASS BUG UPDATE **************

We apologize for the inconvenience.  There is a large number of bugs to go through and several of them have gone stale.  Due to this, we are doing a mass bug update across all of the Fedora 22 kernel bugs.

Fedora 22 has now been rebased to 4.2.3-200.fc22.  Please test this kernel update (or newer) and let us know if you issue has been resolved or if it is still present with the newer kernel.

If you have moved on to Fedora 23, and are still experiencing this issue, please change the version to Fedora 23.

If you experience different issues, please open a new bug report for those.

Comment 4 Fedora Kernel Team 2015-11-23 17:17:28 UTC
*********** MASS BUG UPDATE **************
This bug is being closed with INSUFFICIENT_DATA as there has not been a response in over 4 weeks. If you are still experiencing this issue, please reopen and attach the relevant data from the latest kernel you are running and any data that might have been requested previously.