Bug 8560 - cenbuild doesn't unmount recursive mounts
Summary: cenbuild doesn't unmount recursive mounts
Status: RESOLVED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Build system (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.19.0
Assignee: Pierre Ossman
URL:
Keywords: prosaic
Depends on:
Blocks:
 
Reported: 2025-03-31 11:22 CEST by Pierre Ossman
Modified: 2025-04-01 15:50 CEST (History)
0 users

See Also:
Acceptance Criteria:
MUST: * After stopping or removing cenbuild, there should be no active mounts in /opt/cendio-build


Attachments

Description Pierre Ossman cendio 2025-03-31 11:22:19 CEST
The cenbuild service is supposed to unmount up everything that is mounted in each chroot environment. It does this by going through /proc/mounts and simply doing umount on each entry found that starts with the chroot's path.

The problem is if there are mounts within mounts in the chroot. Since we examine /proc/mounts from start to end, we'll get the mounts in the order they were created. Parent mounts will then be before child mounts, and we can't unmount the parent before the child.

The end result is that we get things left mounted and not cleaned up. We also see the problem in the logs:

Mar 31 09:06:07 be34ca00db9c cenbuild[900675]: umount: /opt/cendio-build/arch/x86_64/opt/docker-cenbuild: target is busy.

The issue is seen constantly in our container helper because of the way we map files in to it.
Comment 1 Pierre Ossman cendio 2025-03-31 11:22:57 CEST
For full robustness, we should probably do multiple passes over /proc/mounts. But simply reversing the order should hopefully be good enough in practice.
Comment 3 Pierre Ossman cendio 2025-04-01 15:50:21 CEST
Fixed and works well now.

Note You need to log in before you can comment on or make changes to this bug.