nbd: fix circular lock dependency
Subsystems (2)
PATCH 1/1 nbd: fix circular lock dependency
nbd_genl_reconnect_sock_cb() replaces a dead socket with a new one obtained through nbd_get_socket(), but unlike nbd_add_socket() it never runs the socket through nbd_reclassify_socket(). The replacement socket therefore keeps the generic sk_lock-AF_INET/AF_INET6/AF_UNIX lock class instead of the NBD-specific class leading to a possible lock dependency.
Move the reclassification into nbd_get_socket(), the single place where sockets are acquired for NBD, so both the connect and reconnect paths reclassify the socket.
nbd_add_socket() no longer needs to do it.
--- drivers/block/nbd.c | 66 +++++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 29 deletions(-)
drivers/block/nbd.c +37 -29
@@ -1210,34 +1210,6 @@ static blk_status_t nbd_queue_rq(struct blk_mq_hw_ctx *hctx,return ret; } -static struct socket *nbd_get_socket (struct nbd_device *nbd,unsigned long fd, -int *err) -{ -struct socket *sock; - - *err =0 ; - sock =sockfd_lookup (fd, err); -if (!sock) -return NULL ; - -if (!sk_is_tcp (sock->sk) && - !sk_is_stream_unix (sock->sk)) { -dev_err (disk_to_dev (nbd->disk),"Unsupported socket: should be TCP or UNIX.\n" ); - *err = -EINVAL ; -sockfd_put (sock); -return NULL ; - } - -if (sock->ops->shutdown == sock_no_shutdown) { -dev_err (disk_to_dev (nbd->disk),"Unsupported socket: shutdown callout must be supported.\n" ); - *err = -EINVAL ; -sockfd_put (sock); -return NULL ; - } - -return sock; -} -#ifdef CONFIG_DEBUG_LOCK_ALLOC static struct lock_class_key nbd_key[3 ];static struct lock_class_key nbd_slock_key[3 ];
@@ -1274,6 +1246,43 @@ static void nbd_reclassify_socket(struct socket *sock)static inline void nbd_reclassify_socket (struct socket *sock) {}#endif +static struct socket *nbd_get_socket (struct nbd_device *nbd,unsigned long fd, +int *err) +{ +struct socket *sock; + + *err =0 ; + sock =sockfd_lookup (fd, err); +if (!sock) +return NULL ; + +if (!sk_is_tcp (sock->sk) && + !sk_is_stream_unix (sock->sk)) { +dev_err (disk_to_dev (nbd->disk),"Unsupported socket: should be TCP or UNIX.\n" ); + *err = -EINVAL ; +sockfd_put (sock); +return NULL ; + } + +if (sock->ops->shutdown == sock_no_shutdown) { +dev_err (disk_to_dev (nbd->disk),"Unsupported socket: shutdown callout must be supported.\n" ); + *err = -EINVAL ; +sockfd_put (sock); +return NULL ; + } + +/* +* NBD sockets are used from block/swap/writeback context, which can +* already hold locks that fs_reclaim depends on. Give them their own +* lockdep class so that a page fault on an unrelated userspace socket +* (sk_lock -> mmap_lock) is not chained to the NBD socket lock. +*/ +if (sock) +nbd_reclassify_socket (sock); + +return sock; +} +static int nbd_add_socket (struct nbd_device *nbd,unsigned long arg,bool netlink) {
@@ -1296,7 +1305,6 @@ static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg, sock =nbd_get_socket (nbd, arg, &err);if (!sock)return err; -nbd_reclassify_socket (sock);if (!netlink && !nbd->task_setup && !test_bit (NBD_RT_BOUND , &config->runtime_flags))
Signature · 1 line
2.52.0
Quoted 1 line · Guilherme Giacomo Simoes
Subject: [PATCH] nbd: fix circular lock dependency
There is no real circular lock dependency here. This patch addresses a lockdep false positive caused by the missing socket reclassification in the reconnect path. Please change the subject into something like "nbd: Also reclassify sockets in the reconnect path".
Quoted 1 line
instead of the NBD-specific class leading to a possible lock dependency.
Please change "possible lock dependency" into "lockdep false positive".
Quoted 2 lines
Please use Closes: instead of Link: for the syzbot report. Has this patch been tested against the syzbot reproducer, e.g. with "#syz test"? If so, please mention this.
Quoted 3 lines
drivers/block/nbd.c +0
-3-static struct socket *nbd_get_socket (struct nbd_device *nbd,unsigned long fd, -int *err) -{
[ ... ]
drivers/block/nbd.c static void nbd_reclassify_socket(struct socket *sock) · line 1251
Quoted 3 lines
drivers/block/nbd.c +3
-0+static struct socket *nbd_get_socket (struct nbd_device *nbd,unsigned long fd, +int *err) +{
Moving nbd_get_socket() makes this patch much larger than necessary, which makes reviewing and backporting it harder. Adding a single nbd_reclassify_socket(sock) call in nbd_genl_reconnect_sock_cb() right after the nbd_get_socket() call is sufficient. If the reclassification should happen in nbd_get_socket(), please move nbd_reclassify_socket() up instead of moving nbd_get_socket() down.
Additionally, reclassifying the socket in nbd_get_socket() happens before it is known whether NBD will use the socket. If nbd_genl_reconnect_sock_cb() does not find a dead connection, or if nbd_add_socket() fails, the socket is returned to user space with the NBD lock class. While this only affects lockdep and while the nbd_add_socket() error paths already behave this way, it is another reason to only reclassify a socket once it is really being used.
drivers/block/nbd.c static void nbd_reclassify_socket(struct socket *sock) · line 1279
Quoted 6 lines
drivers/block/nbd.c +6
-0+/* +* NBD sockets are used from block/swap/writeback context, which can +* already hold locks that fs_reclaim depends on. Give them their own +* lockdep class so that a page fault on an unrelated userspace socket +* (sk_lock -> mmap_lock) is not chained to the NBD socket lock. +*/
The description of commit d532cddb6c60 says that the problem is fs_reclaim being triggered while sk_lock is held, not a page fault (sk_lock -> mmap_lock). Please make this comment match the actual lockdep report or leave it out. The description of commit d532cddb6c60 already explains why NBD sockets are reclassified.
drivers/block/nbd.c static void nbd_reclassify_socket(struct socket *sock) · line 1281
Quoted 2 lines
drivers/block/nbd.c +2
-0+if (sock) +nbd_reclassify_socket (sock);
"sock" can't be NULL here because all code paths where it is NULL have already returned. Please remove the "if (sock)" test.
Thanks,
Bart.
Quoted 5 lines · Bart Van Assche
There is no real circular lock dependency here. This patch addresses a lockdep false positive caused by the missing socket reclassification in the reconnect path. Please change the subject into something like "nbd: Also reclassify sockets in the reconnect path".
Quoted 8 lines
Quoted 1 line
instead of the NBD-specific class leading to a possible lock dependency.
Please change "possible lock dependency" into "lockdep false positive".
Quoted 2 lines
Please use Closes: instead of Link: for the syzbot report.
Ok, I will send a V2
Quoted 2 lines
Has this patch been tested against the syzbot reproducer, e.g. with "#syz test"? If so, please mention this.
No, my bad. I send a email to syzbot now to test this patch. After tested, how can I mention this in my patch?
Quoted 4 lines
Moving
nbd_get_socket()makes this patch much larger than necessary, which makes reviewing and backporting it harder. Adding a singlenbd_reclassify_socket(sock)call innbd_genl_reconnect_sock_cb()right after thenbd_get_socket()call is sufficient
Yes, is sufficient but the if we need reclassify socket all times when I call nbd_get_socket(), looks like a uneccessary repetitive code.
Of course, I don't know if future situations where nbd_get_socket() is called will need nbd_reclassify_socket() but *now* is just that happen.
Quoted 2 lines
If the reclassification should happen in
nbd_get_socket(), please movenbd_reclassify_socket()up instead of movingnbd_get_socket()down.
I was have moved nbd_reclassify_socket up, just like you suggested, but git don't understanded this very well. But I will find way to get it
Quoted 7 lines
Additionally, reclassifying the socket in
nbd_get_socket()happens before it is known whether NBD will use the socket. Ifnbd_genl_reconnect_sock_cb()does not find a dead connection, or ifnbd_add_socket()fails, the socket is returned to user space with the NBD lock class. While this only affects lockdep and while thenbd_add_socket()error paths already behave this way, it is another reason to only reclassify a socket once it is really being used.
current the nbd_reclassify_socket() is called just below nbd_get_socket() call inside nbd_add_socket():
``` sock = nbd_get_socket(nbd, arg, &err); if (!sock) return err; nbd_reclassify_socket(sock); ```
what have exactly same effect that call at end of nbd_get_socket(). I guess that "reclassify a socket once it is really being used" must be done putting nbd_reclassify_socket at end of nbd_add_socket() (before put_socket tag). Maybe something like:
```
static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg,
bool netlink)
{
struct nbd_config *config = nbd->config;
struct socket *sock;
struct nbd_sock **socks;
struct nbd_sock *nsock;
int err;
/* Arg will be cast to int, check it to avoid overflow */
if (arg > INT_MAX)
return -EINVAL;
if (nbd->pid) {
dev_err(disk_to_dev(nbd->disk),
"Cannot add socket to a running device\n");
return -EBUSY;
}
sock = nbd_get_socket(nbd, arg, &err);
if (!sock)
return err;
if (!netlink && !nbd->task_setup &&
!test_bit(NBD_RT_BOUND, &config->runtime_flags))
nbd->task_setup = current;
if (!netlink &&
(nbd->task_setup != current ||
test_bit(NBD_RT_BOUND, &config->runtime_flags))) {
dev_err(disk_to_dev(nbd->disk),
"Device being setup by another task");
err = -EBUSY;
goto put_socket;
}
nsock = kzalloc_obj(*nsock);
if (!nsock) {
err = -ENOMEM;
goto put_socket;
}
socks = krealloc(config->socks, (config->num_connections + 1) *
sizeof(struct nbd_sock *), GFP_KERNEL);
if (!socks) {
kfree(nsock);
err = -ENOMEM;
goto put_socket;
}
+ nbd_reclassify_socket(sock);
config->socks = socks;
nsock->fallback_index = -1;
nsock->dead = false;
mutex_init(&nsock->tx_lock);
nsock->sock = sock;
nsock->pending = NULL;
nsock->sent = 0;
nsock->cookie = 0;
INIT_WORK(&nsock->work, nbd_pending_cmd_work);
socks[config->num_connections++] = nsock;
atomic_inc(&config->live_connections);
return 0;
put_socket:
sockfd_put(sock);
return err;
}
```I don't know if this is a really good thing once that until this be executed the user space can got a generic lock (the same generic lock of sock here) before nbd_reclassify_socket() call leading to the same problem. Thoughts?
Quoted 13 lines
drivers/block/nbd.c static void nbd_reclassify_socket(struct socket *sock) · line 1279
Quoted 6 lines
drivers/block/nbd.c +6
-0+/* +* NBD sockets are used from block/swap/writeback context, which can +* already hold locks that fs_reclaim depends on. Give them their own +* lockdep class so that a page fault on an unrelated userspace socket +* (sk_lock -> mmap_lock) is not chained to the NBD socket lock. +*/ The description of commit
d532cddb6c60says that the problem isfs_reclaimbeing triggered whilesk_lockis held, not a page fault (sk_lock->mmap_lock). Please make this comment match the actual lockdep report or leave it out. The description of commitd532cddb6c60already explains why NBD sockets are reclassified.
Quoted 5 lines
drivers/block/nbd.c static void nbd_reclassify_socket(struct socket *sock) · line 1281
Quoted 2 lines
drivers/block/nbd.c +2
-0+if (sock) +nbd_reclassify_socket (sock);"sock" can't be NULL here because all code paths where it is NULL have already returned. Please remove the "if (sock)" test.
Ok, I will fix this two things
Thanks,
Guilherme
Quoted 4 lines · Bart Van Assche
Moving
nbd_get_socket()makes this patch much larger than necessary, which makes reviewing and backporting it harder. Adding a singlenbd_reclassify_socket(sock)call innbd_genl_reconnect_sock_cb()right after thenbd_get_socket()call is sufficient.
Hi Guilherme and Bart,
Thanks for working on this! I'm currently fixing a possible deadlock in wg_ratelimiter_uninit
(Reported-by: [email protected]) involving cpu_hotplug_lock and slab_mutex.
My one syzbot test failed because of this lockdep
false positive that this patch addresses. I applied Bart's suggested 1-line fix locally, and will see if it resolves the false positive.
I will be submitting my cpu_hotplug_lock fix separately.
I am looking forward to see your v2!
Thanks,
Timo Joannin
Quoted 12 lines · Timo Joannin
Quoted 4 lines
Moving
nbd_get_socket()makes this patch much larger than necessary, which makes reviewing and backporting it harder. Adding a singlenbd_reclassify_socket(sock)call innbd_genl_reconnect_sock_cb()right after thenbd_get_socket()call is sufficient.Hi Guilherme and Bart,
Thanks for working on this! I'm currently fixing a possible deadlock in
wg_ratelimiter_uninit
(Reported-by: [email protected]) involvingcpu_hotplug_lockandslab_mutex.
Quoted 6 lines
My one syzbot test failed because of this lockdep
false positive that this patch addresses. I applied Bart's suggested 1-line fix locally, and will see if it resolves the false positive.
I will be submitting mycpu_hotplug_lockfix separately.
I am looking forward to see your v2!
Cool, thanks
Quoted 7 lines · Guilherme Giacomo Simoes
Quoted 7 lines
There is no real circular lock dependency here. This patch addresses a lockdep false positive caused by the missing socket reclassification in the reconnect path. Please change the subject into something like "nbd: Also reclassify sockets in the reconnect path".
Quoted 1 line
instead of the NBD-specific class leading to a possible lock dependency.
Quoted 7 lines
Quoted 6 lines
Please change "possible lock dependency" into "lockdep false positive".
Quoted 2 lines
Please use Closes: instead of Link: for the syzbot report.
Ok, I will send a V2
What do you think:
``` nbd: must reclassify socket when socket is created When we need to connect or reconnect a new socket, we need to call nbd_reclassify_socket() to ensure that a false positive lock_dep circular warning fires. Inside nbd_add_socket(), after nbd_get_socket() call he already call nbd_reclassify_socket(). However inside nbd_genl_reconnect_sock_cb() the nbd_reclassify_socket() must be called too and this is not doing. To ensure that even when nbd_get_socket() is called the nbd_reclassify_socket() will be called to, put the nbd_reclassify_socket() inside nbd_get_socket(). Move the nbd_get_socket() bellow of nbd_reclassify_socket(). nbd_add_socket() no longer needs to do it. ```
?
Quoted 4 lines
Quoted 2 lines
If the reclassification should happen in
nbd_get_socket(), please movenbd_reclassify_socket()up instead of movingnbd_get_socket()down.I was have moved
nbd_reclassify_socketup, just like you suggested, but git don't understanded this very well. But I will find way to get it
No , I couldn't do it :(
thanks,
Guilherme
Quoted 1 line · Guilherme Giacomo Simoes
After tested, how can I mention this in my patch?
If syzbot confirms the fix, you can either:
- Add a "Tested-by: syzbot..." tag if syzkaller provides one, or
- Mention it below the "---" separator in your patch (in the changelog/notes section), e.g.:
Tested against syzbot reproducer via #syz test: <link-to-syzbot-result>
Quoted 4 lines
What do you think now? We will call
nbd_reclassify_socket()insidenbd_get_socket()and call this only one time? Or is a better way call thenbd_reclassify_socket()insidenbd_genl_reconnect_sock_cb()when we have sure that we will use the socket?
Calling nbd_reclassify_socket(sock) directly inside nbd_genl_reconnect_sock_cb() (right after nbd_get_socket()) is definitely the best approach:
1. It is a 1-line addition to nbd_genl_reconnect_sock_cb().
2. It mirrors what nbd_add_socket() already does.
3. No code needs to be moved around, keeping the git diff minimal and making the fix trivial to review and backport to stable kernels.
Quoted 8 lines
What do you think:
``` nbd: must reclassify socket when socket is created When we need to connect or reconnect a new socket, we need to call nbd_reclassify_socket() to ensure that a false positive lock_dep circular warning fires. [...] ```
Please use the imperative mood, e.g. as follows:
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().
Thanks,
Bart.
Quoted 44 lines · On Wed, 11 Nov 2026 09:13:45 -0800 Bart Van Assche wrote:
Quoted 1 line · Guilherme Giacomo Simoes
After tested, how can I mention this in my patch?
If syzbot confirms the fix, you can either:
- Add a "Tested-by: syzbot..." tag if syzkaller provides one, or
- Mention it below the "---" separator in your patch (in the changelog/notes section), e.g.:
Tested against syzbot reproducer via #syz test: <link-to-syzbot-result>Quoted 3 lines
What do you think now? We will call
nbd_reclassify_socket()insidenbd_get_socket()and call this only one time? Or is a better way call thenbd_reclassify_socket()insidenbd_genl_reconnect_sock_cb()when wehave sure
Quoted 1 line
that we will use the socket?
Calling
nbd_reclassify_socket(sock)directly insidenbd_genl_reconnect_sock_cb()(right afternbd_get_socket()) is definitely the best approach:
1. It is a 1-line addition tonbd_genl_reconnect_sock_cb().
2. It mirrors whatnbd_add_socket()already does.
3. No code needs to be moved around, keeping the git diff minimal and making the fix trivial to review and backport to stable kernels.Quoted 8 lines
What do you think:
``` nbd: must reclassify socket when socket is created When we need to connect or reconnect a new socket, we need to call nbd_reclassify_socket() to ensure that a false positive lock_dep circular warning fires. [...] ```Please use the imperative mood, e.g. as follows:
nbd: Reclassify sockets in the reconnect path
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.
Quoted 8 lines
Fix this by reclassifying the replacement socket in
nbd_genl_reconnect_sock_cb().Fixes d532cddb6c60 ("nbd: Reclassify sockets to avoid lockdep circulardependency")
FYI reclassifying sockets is also corrupting memory [11], so can you fix the corrupter before reclassifying again?
[11] Subject: [syzbot] BUG: spinlock already unlocked in corrupted
https://lore.kernel.org/lkml/[email protected]/
Quoted 5 lines · Hillf Danton
FYI reclassifying sockets is also corrupting memory [11], so can you fix the corrupter before reclassifying again?
[11] Subject: [syzbot] BUG: spinlock already unlocked in corrupted
https://lore.kernel.org/lkml/[email protected]/
Important thing to do.
I'm not a nbd/net specialist, I only get the "fix possible circular dependency" bug to resolve because this appears in mm subsystem syzbot.
But, I read this bug and see that is a race condition between inet_shutdown() and sock_allow_reclassification().
How IA analysis say:
"""
- Thread 1 (runner/shutdown) calls inet_shutdown() -> release_sock(sk). Inside release_sock(), Thread 1 acquires spin_lock_bh(&sk->sk_lock.slock).
- Thread 2 (reclassifier) enters nbd_add_socket() -> nbd_reclassify_socket(sock). Right before Thread 1 acquired the lock, sock_allow_reclassification(sk) returned true. Thread 2 calls sock_lock_init_class_and_name(), which invokes spin_lock_init(&sk->sk_lock.slock) while Thread 1 is holding slock.
- spin_lock_init() zeroes the spinlock and marks it unlocked (SPINLOCK_OWNER_INIT).
- Thread 1 finishes processing in release_sock() and calls spin_unlock_bh(&sk->sk_lock.slock).
...
"""
What lead me think that when Thread 1 try acquire lock this would must be blocked to acquire this lock, so a spin_lock(&sk->sk_lock.slock) inside nbd_reclassify_socker right bellow sock_allow_reclassification(sk) fix this bug?
```
static void nbd_reclassify_socket(struct socket *sock)
{
struct sock *sk = sock->sk;
if (!sock_allow_reclassification(sk))
return;
spin_lock(&sk->sk_lock.slock);
...
```thanks,
guilherme
Quoted 7 lines
Quoted 1 line
After tested, how can I mention this in my patch?
If syzbot confirms the fix, you can either:
- Add a "Tested-by: syzbot..." tag if syzkaller provides one, or
- Mention it below the "---" separator in your patch (in the changelog/notes section), e.g.:
Tested against syzbot reproducer via #syz test: <link-to-syzbot-result>
Unfortunately the syzbot test is temporarily disabled:
https://github.com/google/syzkaller/issues/8122
Quoted 92 lines · Guilherme Giacomo Simoes
Quoted 7 lines
Additionally, reclassifying the socket in
nbd_get_socket()happens before it is known whether NBD will use the socket. Ifnbd_genl_reconnect_sock_cb()does not find a dead connection, or ifnbd_add_socket()fails, the socket is returned to user space with the NBD lock class. While this only affects lockdep and while thenbd_add_socket()error paths already behave this way, it is another reason to only reclassify a socket once it is really being used.current the
nbd_reclassify_socket()is called just belownbd_get_socket()call insidenbd_add_socket():
```drivers/block/nbd.c +0
-0sock =nbd_get_socket (nbd, arg, &err);if (!sock)return err;nbd_reclassify_socket(sock); ``` what have exactly same effect that call at end of nbd_get_socket(). I guess that "reclassify a socket once it is really being used" must be done putting nbd_reclassify_socket at end of nbd_add_socket() (before put_socket tag). Maybe something like: ``` static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg, bool netlink) { struct nbd_config *config = nbd->config; struct socket *sock; struct nbd_sock **socks; struct nbd_sock *nsock; int err; /* Arg will be cast to int, check it to avoid overflow */ if (arg > INT_MAX) return -EINVAL; if (nbd->pid) { dev_err(disk_to_dev(nbd->disk), "Cannot add socket to a running device\n"); return -EBUSY; } sock = nbd_get_socket(nbd, arg, &err); if (!sock) return err; if (!netlink && !nbd->task_setup && !test_bit(NBD_RT_BOUND, &config->runtime_flags)) nbd->task_setup = current; if (!netlink && (nbd->task_setup != current || test_bit(NBD_RT_BOUND, &config->runtime_flags))) { dev_err(disk_to_dev(nbd->disk), "Device being setup by another task"); err = -EBUSY; goto put_socket; } nsock = kzalloc_obj(*nsock); if (!nsock) { err = -ENOMEM; goto put_socket; } socks = krealloc(config->socks, (config->num_connections + 1) * sizeof(struct nbd_sock *), GFP_KERNEL); if (!socks) { kfree(nsock); err = -ENOMEM; goto put_socket; }+
nbd_reclassify_socket(sock);config->socks = socks; nsock->fallback_index = -1; nsock->dead = false; mutex_init(&nsock->tx_lock); nsock->sock = sock; nsock->pending = NULL; nsock->sent = 0; nsock->cookie = 0; INIT_WORK(&nsock->work, nbd_pending_cmd_work); socks[config->num_connections++] = nsock; atomic_inc(&config->live_connections); return 0;
put_socket:sockfd_put(sock); return err; }
Quoted 7 lines
```
I don't know if this is a really good thing once that until this be executed the user space can got a generic lock (the same generic lock of sock here) before
nbd_reclassify_socket()call leading to the same problem. Thoughts?
I back to read the nbd_genl_reconnect_sock_cb(), and now I understand what you say. YES, nbd_get_socket() also runs for sockets that are never installed. When nbd_genl_reconnect_sock_cb() finds no dead connection it does:
``` sockfd_put(sock); kfree(args); return 1; ```
So the add line inside nbd_add_socket() that I sended previous don't make sense.
What do you think now? We will call nbd_reclassify_socket() inside nbd_get_socket() and call this only one time? Or is a better way call the nbd_reclassify_socket() inside nbd_genl_reconnect_sock_cb() when we have sure that we will use the socket?
thanks,
guilherme