Skip to content

overlayfs: unmount before cleanup on build exception#215

Merged
mtelvers merged 1 commit into
ocurrent:masterfrom
mtelvers:fix-overlayfs-exception-umount
Jul 21, 2026
Merged

overlayfs: unmount before cleanup on build exception#215
mtelvers merged 1 commit into
ocurrent:masterfrom
mtelvers:fix-overlayfs-exception-umount

Conversation

@mtelvers

Copy link
Copy Markdown
Member

The exception path in Overlayfs.build ran rm -rf on the merged directory without unmounting it first, unlike the success and error paths which unmount before deleting.

When the build function raises, the overlay is still mounted, so rm -rf merged fails with Device or resource busy (EBUSY) and the mount leaks. Because merged/work are keyed only by the content-hash id and reused, each retry mounts on top of the leaked mount, stacking overlays (observed up to 6 deep) so even the success path's single umount can no longer clean up. This fills the store and permanently poisons that id.

Fix: unmount merged in the exception handler before deleting, mirroring the success/error paths.

The exception path deleted the merged dir without unmounting it first,
unlike the success/error paths. rm -rf on a live overlay mountpoint
fails with EBUSY, leaking the mount; retries then stack further mounts
on the reused id-keyed path.
@mtelvers
mtelvers merged commit 7ef7361 into ocurrent:master Jul 21, 2026
1 check failed
@mtelvers
mtelvers deleted the fix-overlayfs-exception-umount branch July 21, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant