Re: [PATCH 17/26] attach_recursive_mnt(): unify the mnt_change_mountpoint() logics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 11, 2025 at 01:05:52PM +0200, Christian Brauner wrote:
> > -	if (beneath)
> > -		mnt_change_mountpoint(source_mnt, smp, top_mnt);
> > -	commit_tree(source_mnt);
> > +	hlist_add_head(&source_mnt->mnt_hash, &tree_list);
> 
> Please add a comment here. Right now it's easy to understand even with
> your mnt_change_mountpoint() changes. Afterwards the cases are folded
> and imho that leaves readers wondering why that's correct.

Hmm...  Does the incremental below look sane for you?

diff --git a/fs/namespace.c b/fs/namespace.c
index d5a7d7da3932..15b7959b1771 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2675,6 +2675,13 @@ static int attach_recursive_mnt(struct mount *source_mnt,
 	}
 
 	mnt_set_mountpoint(dest_mnt, dest_mp, source_mnt);
+	/*
+	 * Now the original copy is in the same state as the secondaries -
+	 * its root attached to mountpoint, but not hashed and all mounts
+	 * in it are either in our namespace or in no namespace at all.
+	 * Add the original to the list of copies and deal with the
+	 * rest of work for all of them uniformly.
+	 */
 	hlist_add_head(&source_mnt->mnt_hash, &tree_list);
 
 	hlist_for_each_entry_safe(child, n, &tree_list, mnt_hash) {




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux