Re: Orphan filesystems after mount namespace destruction and tmpfs "leak"

Kiryl Shutsemau
2026-02-02T19:43:39Z

On Mon, Feb 02, 2026 at 06:43:56PM +0000, Al Viro wrote:
> > I am not sure what a possible solution would be here. I can only think
> > of blocking exit(2) for the last process in the namespace until all
> > filesystems are cleanly unmounted, but that is not very informative
> > either.
>
> That's insane - if nothing else, the process that holds the sucker
> opened may very well be waiting for the one you've blocked.

Good point. I obviously don't underhand lifecycle here.

> You are getting exactly what you asked for - same as you would on
> lazy umount, for that matter.
>
> Filesystem may be active without being attached to any namespace;
> it's an intentional behaviour. What's more, it _is_ visible to
> ustat(2), as well as lsof(1) and similar userland tools in case
> of opened file keeping it busy.

I can only see the opened file, not the rest of filesystem, right?

Do you see the USB stick scenario problematic? It is weird to me that
umount would fail with -EBUSY here, but kill full namespace is fine.

--
Kiryl Shutsemau / Kirill A. Shutemov