Skip to content

Commit 33681d8

Browse files
authored
fix(namespace): make recursive propagation changes atomic (#2112)
Prepare recursive propagation changes as an explicit transaction while holding the mount lifecycle lock. Snapshot the target subtree and all affected peer, master, and slave relationships, reserve fallible resources up front, simulate Linux propagation semantics privately, and publish only fully prepared final state. Match Linux 6.6 behavior for DFS mount traversal, next-peer ring selection, exact mount-root identity, and slave-list rewiring. Keep group ID release allocation-free with IDA-backed hole tracking and avoid full-graph scans by maintaining direct slave adjacency. Add deterministic failure-path coverage and DragonOS guest tests for recursive propagation semantics, atomic mountinfo snapshots, namespace copying, and concurrent topology changes. Fixes #2098 Signed-off-by: longjin <longjin@dragonos.org>
1 parent 74e8319 commit 33681d8

3 files changed

Lines changed: 1360 additions & 82 deletions

File tree

kernel/src/filesystem/vfs/mount/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ use system_error::SystemError;
5454

5555
/// Serializes mount pin admission against multi-mount busy preflight and
5656
/// detach, including propagation peers in other namespaces.
57+
///
58+
/// Mount topology and propagation code acquires locks in this order:
59+
/// lifecycle -> namespace -> dentry mount gate -> parent mountpoints -> peer
60+
/// registry -> one mount's propagation state -> propagation group allocator.
61+
/// A lower layer must never acquire the lifecycle/topology layers in reverse.
5762
pub(crate) static MOUNT_LIFECYCLE_LOCK: Mutex<()> = Mutex::new(());
5863

5964
lazy_static! {

0 commit comments

Comments
 (0)