From: Bart Van Assche <bvanassche@acm.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Josef Bacik <josef@toxicpanda.com>,
Eric Dumazet <edumazet@kernel.org>,
Aibing Chen <chenaibing@cmss.chinamobile.com>,
Bart Van Assche <bvanassche@acm.org>
Subject: [PATCH 0/8] nbd: Defer request transmission to a workqueue
Date: Mon, 16 Nov 2026 13:48:00 -0800 [thread overview]
Message-ID: <cover.1794865298.git.bvanassche@acm.org> (raw)
Hi Jens,
The NBD driver transmits requests over sockets owned by user space directly
from nbd_queue_rq(). Hence, sk_lock is acquired while blk-mq holds
q->q_usage_counter and set->srcu. Since other kernel code acquires sk_lock
before fs_reclaim, mm->mmap_lock and other subsystem locks, syzbot reports
multiple circular locking dependencies. Socket lockdep reclassification, the
existing workaround, introduces new races and module reference count leaks,
and does not suppress all of these reports.
This patch series fixes these lockdep complaints by deferring request
transmission to a workqueue, similar to the loop driver, and by removing
the socket lockdep reclassification code. Since requests are no longer
transmitted from a context in which signals can be pending, the
partial-send handling code is removed.
This patch series is organized as follows:
- Patch 1 fixes a missing wakeup of wait_for_reconnect() callers when
NBD_RT_DISCONNECTED is set.
- Patches 2 and 3 prepare for deferring request transmission by
simplifying the nbd_send_cmd() return values and by no longer taking a
config_refs reference for each request.
- Patch 4 defers request transmission to a workqueue.
- Patch 5 fixes a nsock->tx_lock -> cpu_hotplug_lock lockdep complaint.
- Patch 6 removes the socket lockdep reclassification code.
- Patches 7 and 8 remove the partial-send handling code that has become
unreachable.
Please consider this patch series for the next merge window.
Thanks,
Bart.
Bart Van Assche (8):
nbd: Wake up config->conn_wait when setting NBD_RT_DISCONNECTED
nbd: Requeue requests directly in nbd_send_cmd()
nbd: Stop taking a config_refs reference per request
nbd: Defer request transmission to a workqueue
nbd: Call sk_set_memalloc() outside nsock->tx_lock
nbd: Remove socket lockdep reclassification
nbd: Remove the partial-send handling
nbd: Remove the sent argument of sock_xmit()
drivers/block/nbd.c | 394 ++++++++++++++++----------------------------
1 file changed, 142 insertions(+), 252 deletions(-)
next reply other threads:[~2026-11-16 21:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 21:48 Bart Van Assche [this message]
2026-11-16 21:48 ` [PATCH 1/8] nbd: Wake up config->conn_wait when setting NBD_RT_DISCONNECTED Bart Van Assche
2026-11-16 21:48 ` [PATCH 2/8] nbd: Requeue requests directly in nbd_send_cmd() Bart Van Assche
2026-11-16 21:48 ` [PATCH 3/8] nbd: Stop taking a config_refs reference per request Bart Van Assche
2026-11-16 21:48 ` [PATCH 4/8] nbd: Defer request transmission to a workqueue Bart Van Assche
2026-11-16 21:48 ` [PATCH 5/8] nbd: Call sk_set_memalloc() outside nsock->tx_lock Bart Van Assche
2026-11-16 21:48 ` [PATCH 6/8] nbd: Remove socket lockdep reclassification Bart Van Assche
2026-11-16 21:48 ` [PATCH 7/8] nbd: Remove the partial-send handling Bart Van Assche
2026-11-16 21:48 ` [PATCH 8/8] nbd: Remove the sent argument of sock_xmit() Bart Van Assche
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1794865298.git.bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=axboe@kernel.dk \
--cc=chenaibing@cmss.chinamobile.com \
--cc=edumazet@kernel.org \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox