On Fri, Oct 21, 2022 at 10:28:04AM +0000, Klemens Nanni wrote:
> All interface ioctls always run with the kernel lock anyway, so this
> doesn't make a difference, except that it reflects how ifnetlist is not
> modified.
> 
> OK?
> 

netlock could be completely dropped here.

> diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c
> index a15820420ef..16006c4c102 100644
> --- a/sys/net/if_loop.c
> +++ b/sys/net/if_loop.c
> @@ -204,16 +204,16 @@ loop_clone_destroy(struct ifnet *ifp)
>                       return (EPERM);
>  
>               /* if there is any other interface in this rdomain, deny */
> -             NET_LOCK();
> +             NET_LOCK_SHARED();
>               TAILQ_FOREACH(p, &ifnetlist, if_list) {
>                       if (p->if_rdomain != ifp->if_rdomain)
>                               continue;
>                       if (p->if_index == ifp->if_index)
>                               continue;
> -                     NET_UNLOCK();
> +                     NET_UNLOCK_SHARED();
>                       return (EBUSY);
>               }
> -             NET_UNLOCK();
> +             NET_UNLOCK_SHARED();
>  
>               rdomain = ifp->if_rdomain;
>       }
> 

Reply via email to