Unverified Commit 043bc81e authored by Christian Brauner's avatar Christian Brauner
Browse files

fs: add assert for move_mount()

After we've attached a detached mount tree the anonymous mount namespace
must be empty. Add an assert and make this assumption explicit.

Link: https://lore.kernel.org/r/20250221-brauner-open_tree-v1-3-dbcfcb98c676@kernel.org


Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 2f576220
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -3423,11 +3423,14 @@ static int do_move_mount(struct path *old_path, struct path *new_path,
out:
	unlock_mount(mp);
	if (!err) {
		if (attached)
		if (attached) {
			mntput_no_expire(parent);
		else
		} else {
			/* Make sure we notice when we leak mounts. */
			VFS_WARN_ON_ONCE(!mnt_ns_empty(ns));
			free_mnt_ns(ns);
		}
	}
	return err;
}