baselayout-2.0.0_rc6-r1 has two serious problems with --bind which can be fixed relatively easily: 1. If e.g. / was mounted with --bind to another mountpoint, say /chroot/main, this other mountpoint will falsely not be unmounted (which is a serious problem, because, in the above example, /chroot cannot be unmounted either afterwards if it is on another partition, because /chroot/main is still "in use"). The reason is that before attempting to unmount /chroot/main, fuser is used to check whether /chroot/main is in use by the current script. Unfortunately, fuser gives a positive result for /chroot/main even if the script actually accesses only something on e.g. /usr. 2. If some directory was mounted with --bind to another partition and some of the new --make-shared or --make-slave features is used, it might happen that one umount command actually unmounts several mountpoints at once. Thus, before attempting to unmount, one should check whether the considered partition is actually still mounted.
Created attachment 141842 [details, diff] Patch to fix 2 problems with mount --bind and mount --make-shared, respectively The attached patch fixes both issues: 1. The first issue is solved by simply omitting the test with fuse and trying to umount anyway: If the script really uses the partition, the umount will fail anyway, and the fuse test is done afterwards to print a corresponding message. (Hence, in the "worst case" the disadvantage of the patch is that the text of the output is slightly different than before, because in any case it is output that it is attempted to unmount the partition). 2. The second issue is solved by testing at the beginning of the umount loop whether the current mountpoint is actually still a mountpoint.
Added to OpenRC with a few cleanups http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commitdiff;h=c59fa4d5e96e74366dbf0f48fd23b5df7704a131 Thanks!
Fixed in OpenRC.