Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 207611 - sys-apps/baselayout-2.0.0_rc6-r1 has two problems with --bind
Summary: sys-apps/baselayout-2.0.0_rc6-r1 has two problems with --bind
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-26 20:40 UTC by Martin Väth
Modified: 2008-03-31 16:33 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to fix 2 problems with mount --bind and mount --make-shared, respectively (mount-bind.patch,910 bytes, patch)
2008-01-26 20:46 UTC, Martin Väth
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Väth 2008-01-26 20:40:09 UTC
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.
Comment 1 Martin Väth 2008-01-26 20:46:34 UTC
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.
Comment 2 Roy Marples 2008-01-30 11:59:29 UTC
Added to OpenRC with a few cleanups
http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commitdiff;h=c59fa4d5e96e74366dbf0f48fd23b5df7704a131

Thanks!
Comment 3 Doug Goldstein (RETIRED) gentoo-dev 2008-03-31 16:33:47 UTC
Fixed in OpenRC.