Re: [PATCH v2 5/8] fs: lockless mntns lookup for nsfs

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

 



On Thu, Dec 12, 2024 at 12:56:04PM +0100, Christian Brauner wrote:

> @@ -146,6 +147,7 @@ static void mnt_ns_tree_add(struct mnt_namespace *ns)
>  
>  	mnt_ns_tree_write_lock();
>  	node = rb_find_add_rcu(&ns->mnt_ns_tree_node, &mnt_ns_tree, mnt_ns_cmp);
> +	list_add_tail_rcu(&ns->mnt_ns_list, &mnt_ns_list);
>  	mnt_ns_tree_write_unlock();

This only works if the entries are inserted in order -- if not, you can
do something like:

  prev = rb_prev(&ns->mnt_ns_tree_node);
  if (!prev) {
    // no previous, add to head
    list_add(&ns->mnt_ns_list, &mnt_ns_list); 
  } else {
    // add after the previous tree node
    prev_ns = container_of(prev, struct mnt_namespace, mnt_ns_tree_node);
    list_add_tail(&ns->mnt_ns_list, &prev_ns->mnt_ns_list);
  }




[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