Skip to contentSkip to conversation

af_unix: remove redundant lockdep class

PATCH Applied Cong Wang 3 participants 3 messages Apr 2, 2018 – Apr 4, 2018

Subsystems (3)
lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH 1/1 af_unix: remove redundant lockdep class

After commit 581319c58600 ("net/socket: use per af lockdep classes for sk queues") sock queue locks now have per-af lockdep classes, including unix socket. It is no longer necessary to workaround it.

I noticed this while looking at a syzbot deadlock report, this patch itself doesn't fix it (this is why I don't add Reported-by).

Fixes 581319c58600 ("net/socket: use per af lockdep classes for sk queues")
Cc Paolo Abeni <[email protected]>
---
 net/unix/af_unix.c | 10 ----------
 1 file changed, 10 deletions(-)
net/unix/af_unix.c +0 -10
index 2d465bdeccbc..45971e173924 100644
@@ -745,14 +745,6 @@ static struct proto unix_proto = {
 	.obj_size		= sizeof(struct unix_sock),
 };
 
-/*
- * AF_UNIX sockets do not interact with hardware, hence they
- * dont trigger interrupts - so it's safe for them to have
- * bh-unsafe locking for their sk_receive_queue.lock. Split off
- * this special lock-class by reinitializing the spinlock key:
- */
-static struct lock_class_key af_unix_sk_receive_queue_lock_key;
-
 static struct sock *unix_create1(struct net *net, struct socket *sock, int kern)
 {
 	struct sock *sk = NULL;
@@ -767,8 +759,6 @@ static struct sock *unix_create1(struct net *net, struct socket *sock, int kern)
 		goto out;
 
 	sock_init_data(sock, sk);
-	lockdep_set_class(&sk->sk_receive_queue.lock,
-				&af_unix_sk_receive_queue_lock_key);
 
 	sk->sk_allocation	= GFP_KERNEL_ACCOUNT;
 	sk->sk_write_space	= unix_write_space;
Signature · 1 line
2.13.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 34 lines · Cong Wang

After commit 581319c58600 ("net/socket: use per af lockdep classes for sk queues") sock queue locks now have per-af lockdep classes, including unix socket. It is no longer necessary to workaround it.

I noticed this while looking at a syzbot deadlock report, this patch itself doesn't fix it (this is why I don't add Reported-by).

Fixes 581319c58600 ("net/socket: use per af lockdep classes for sk queues")
Cc Paolo Abeni <[email protected]>
---
 net/unix/af_unix.c | 10 ----------
 1 file changed, 10 deletions(-)
net/unix/af_unix.c +0 -8
index 2d465bdeccbc..45971e173924 100644
@@ -745,14 +745,6 @@ static struct proto unix_proto = {
 	.obj_size		= sizeof(struct unix_sock),
 };
 
-/*
- * AF_UNIX sockets do not interact with hardware, hence they
- * dont trigger interrupts - so it's safe for them to have
- * bh-unsafe locking for their sk_receive_queue.lock. Split off
- * this special lock-class by reinitializing the spinlock key:
- */
-static struct lock_class_key af_unix_sk_receive_queue_lock_key;
-
 static struct sock *unix_create1(struct net *net, struct socket *sock, int kern)
 {
 	struct sock *sk = NULL;

net/unix/af_unix.c static struct sock *unix_create1(struct net *net, struct socket *sock, int kern) · line 764

Quoted 8 lines
net/unix/af_unix.c +0 -2
@@ -767,8 +759,6 @@ static struct sock *unix_create1(struct net *net, struct socket *sock, int kern)
 		goto out;
 
 	sock_init_data(sock, sk);
-	lockdep_set_class(&sk->sk_receive_queue.lock,
-				&af_unix_sk_receive_queue_lock_key);
 
 	sk->sk_allocation	= GFP_KERNEL_ACCOUNT;
 	sk->sk_write_space	= unix_write_space;

LGTM

maintainer Applied
#2 lore raw
In reply to Cong Wang

From: Cong Wang <[email protected]>
Date: Mon, 2 Apr 2018 11:01:27 -0700

Quoted 10 lines

After commit 581319c58600 ("net/socket: use per af lockdep classes for sk queues") sock queue locks now have per-af lockdep classes, including unix socket. It is no longer necessary to workaround it.

I noticed this while looking at a syzbot deadlock report, this patch itself doesn't fix it (this is why I don't add Reported-by).

Fixes 581319c58600 ("net/socket: use per af lockdep classes for sk queues")
Cc Paolo Abeni <[email protected]>

Applied, thanks Cong.