Skip to content

Conversation

@bsach64
Copy link
Member

@bsach64 bsach64 commented Sep 23, 2025

This PR adds initial support for files on detached bind mounts.
Detached mounts are mounts which are unmounted using the MNT_DETACH flag. This commit adds support for files opened on detached mounts which are a bind mount of a existing mount (which is not detached).

This PR requires the kernel patches in this github branch to be applied:
https://github.com/bsach64/linux/tree/umount-mnt-ns-plus-statx
https://github.com/bsach64/linux/tree/statmount-fd-v2
https://github.com/bsach64/linux/tree/statmount-fd-v3
https://github.com/bsach64/linux/tree/statmount-fd-v4
https://github.com/bsach64/linux/tree/statmount-fd-v5

This PR is pretty draft, we are still to support a lot of things. This work is part of Google Summer of Code 2025.

@bsach64 bsach64 force-pushed the detached-mounts branch 2 times, most recently from 7f3bd9d to cca3849 Compare October 27, 2025 08:20
@Snorch Snorch self-requested a review October 29, 2025 04:41
By "detached mount" we refer to a mount, unmounted with the MNT_DETACH
flag.

Signed-off-by: Bhavik Sachdev <b.sachdev1904@gmail.com>
"anonymous" mounts are those created via open_tree with OPEN_TREE_CLONE
and get "umount" when the fd returned by open_tree is closed.

Signed-off-by: Bhavik Sachdev <b.sachdev1904@gmail.com>
We will be using statmount to add support for files on "unmounted"
mounts. "unmounted" mounts refer to a mount that has been unmounted
using umount2(mnt, MNT_DETACH) but we still have access to files on that
mount.

Signed-off-by: Bhavik Sachdev <b.sachdev1904@gmail.com>
For supporting files on "unmounted" mounts (mounts umounted with
MNT_DETACH), we need support for statmount on fds. Add kerndat check to
check support for statmount on fd.

Signed-off-by: Bhavik Sachdev <b.sachdev1904@gmail.com>
Signed-off-by: Bhavik Sachdev <b.sachdev1904@gmail.com>
Detached mounts are mounts which are unmounted using the MNT_DETACH
flag. This commit adds support for files opened on detached mounts which
are a bind mount of a existing mount (which is not detached)

Signed-off-by: Bhavik Sachdev <b.sachdev1904@gmail.com>
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