Skip to content

Commit 3af682a

Browse files
committed
wishlist: add file-descriptor extension to statmount()
Signed-off-by: Christian Brauner <[email protected]>
1 parent 7650378 commit 3af682a

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,22 @@ Since `pivot_root()` only takes path arguments the new rootfs would need to
6363
be passed via `/proc/<pid>/fd/<nr>`. In the long run we should add a new
6464
`pivot_root()` syscall operating on file descriptors instead of paths.
6565

66+
### Query mount information via file descriptor with `statmount()`
67+
68+
Extend `struct mnt_id_req` to accept a file descriptor and introduce
69+
`STATMOUNT_BY_FD` flag. When a valid fd is provided and `STATMOUNT_BY_FD`
70+
is set, `statmount()` returns mount info about the mount the fd is on.
71+
72+
This works even for "unmounted" mounts (mounts that have been unmounted using
73+
`umount2(mnt, MNT_DETACH)`), if you have access to a file descriptor on that
74+
mount. These unmounted mounts will have no mountpoint and no valid mount
75+
namespace, so `STATMOUNT_MNT_POINT` and `STATMOUNT_MNT_NS_ID` are unset in
76+
`statmount.mask` for such mounts.
77+
78+
**Use-Case:** Query mount information directly from a file descriptor without
79+
needing the mount ID, which is particularly useful for detached or unmounted
80+
mounts.
81+
6682
---
6783

6884
### TODO

0 commit comments

Comments
 (0)