nbd: reclassify socket lock in nbd_reconnect_socket
Subsystems (2)
PATCH 1/1 nbd: reclassify socket lock in nbd_reconnect_socket
nbd_reconnect_socket() obtains a new socket via nbd_get_socket() but does not call nbd_reclassify_socket(), leaving the socket's sk_lock in the default AF_INET6 lockdep class. This causes false circular lock dependency warnings because lockdep merges the NBD socket's sk_lock with unrelated sockets (e.g., rawv6_sendmsg) that establish a sk_lock -> fs_reclaim dependency in normal operation.
nbd_add_socket() already reclassifies correctly on the initial connect path, but the reconnect path was missed.
Add the missing nbd_reclassify_socket() call after nbd_get_socket() in nbd_reconnect_socket().
--- drivers/block/nbd.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/block/nbd.c +2 -0
@@ -1386,6 +1386,8 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg)if (!sock)return err; +nbd_reclassify_socket (sock); + args =kzalloc_obj (*args);if (!args) {sockfd_put (sock);
Signature · 1 line
2.43.0
Friendly ping.
Quoted 34 lines · Yun Zhou
nbd_reconnect_socket()obtains a new socket vianbd_get_socket()but does not callnbd_reclassify_socket(), leaving the socket'ssk_lockin the defaultAF_INET6lockdep class. This causes false circular lock dependency warnings because lockdep merges the NBD socket'ssk_lockwith unrelated sockets (e.g.,rawv6_sendmsg) that establish ask_lock->fs_reclaimdependency in normal operation.
nbd_add_socket()already reclassifies correctly on the initial connect path, but the reconnect path was missed.Add the missing
nbd_reclassify_socket()call afternbd_get_socket()innbd_reconnect_socket().Reported-by [email protected]Fixes d532cddb6c60 ("nbd: Reclassify sockets to avoid lockdep circular dependency")Signed-off-by Yun Zhou <[email protected]>--- drivers/block/nbd.c | 2 ++ 1 file changed, 2 insertions(+)drivers/block/nbd.c +2
-0@@ -1386,6 +1386,8 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg)if (!sock)return err; +nbd_reclassify_socket (sock); + args =kzalloc_obj (*args);if (!args) {sockfd_put (sock);