nbd: Reclassify sockets in the reconnect path
Subsystems (2)
PATCH v2 1/1 nbd: Reclassify sockets in the reconnect path
Commit d532cddb6c60 ("nbd: Reclassify sockets to avoid lockdep circular dependency") introduced nbd_reclassify_socket() to prevent lockdep false positives when NBD sockets are used in memory reclaim paths. While nbd_add_socket() reclassifies newly added sockets, nbd_genl_reconnect_sock_cb() omitted this call when replacing dead sockets during reconnection. Consequently, reconnected sockets retain the generic socket lockdep class and trigger false-positive lockdep reports.
Fix this by reclassifying the replacement socket in nbd_genl_reconnect_sock_cb().
---
v2:
- change previous patch to a single line addition of nbd_reclassify_socket()
- improve commit message
v1:
https://lore.kernel.org/all/[email protected]/
--- drivers/block/nbd.c | 1 + 1 file changed, 1 insertion(+)
drivers/block/nbd.c +1 -0
@@ -1356,6 +1356,7 @@ static int nbd_genl_reconnect_sock_cb(struct nbd_device *nbd, unsigned long arg) sock =nbd_get_socket (nbd, arg, &err);if (!sock)return err; +nbd_reclassify_socket (sock); args =kzalloc_obj (*args);if (!args) {
Signature · 1 line
2.52.0
drivers/block/nbd.c static int nbd_genl_reconnect_sock_cb(struct nbd_device *nbd, unsigned long arg) · line 1362
Quoted 12 lines · Guilherme Giacomo Simoes
drivers/block/nbd.c +1
-0@@ -1356,6 +1356,7 @@ static int nbd_genl_reconnect_sock_cb(struct nbd_device *nbd, unsigned long arg) sock =nbd_get_socket (nbd, arg, &err);if (!sock)return err; +nbd_reclassify_socket (sock); args =kzalloc_obj (*args);if (!args) {
Quoted 10 lines · Guilherme Giacomo Simoes
Commit
d532cddb6c60("nbd: Reclassify sockets to avoid lockdep circular dependency") introducednbd_reclassify_socket()to prevent lockdep false positives when NBD sockets are used in memory reclaim paths. Whilenbd_add_socket()reclassifies newly added sockets,nbd_genl_reconnect_sock_cb()omitted this call when replacing dead sockets during reconnection. Consequently, reconnected sockets retain the generic socket lockdep class and trigger false-positive lockdep reports.[...]
Applied, thanks!
[1/1] nbd: Reclassify sockets in the reconnect path
commit: 553d28925fdea4044bad4ae1e2bf9484ad21f758
Best regards,
Signature · 1 line
Jens Axboe