Skip to content

Commit 4215727

Browse files
Kirill Tkhaidavem330
authored andcommitted
net: Remove spinlock from get_net_ns_by_id()
idr_find() is safe under rcu_read_lock() and maybe_get_net() guarantees that net is alive. Signed-off-by: Kirill Tkhai <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0c06bea commit 4215727

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

net/core/net_namespace.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,9 @@ struct net *get_net_ns_by_id(struct net *net, int id)
273273
return NULL;
274274

275275
rcu_read_lock();
276-
spin_lock_bh(&net->nsid_lock);
277276
peer = idr_find(&net->netns_ids, id);
278277
if (peer)
279278
peer = maybe_get_net(peer);
280-
spin_unlock_bh(&net->nsid_lock);
281279
rcu_read_unlock();
282280

283281
return peer;

0 commit comments

Comments
 (0)