public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] nbd: Fix deadlock during fs reclaim under lock_sock().
@ 2026-03-25  6:38 Kuniyuki Iwashima
  2026-03-25  6:38 ` [PATCH 1/5] nbd: Remove redundant sock->ops->shutdown() check in nbd_get_socket() Kuniyuki Iwashima
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Kuniyuki Iwashima @ 2026-03-25  6:38 UTC (permalink / raw)
  To: Josef Bacik, Jens Axboe, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, Kuniyuki Iwashima, Kuniyuki Iwashima, linux-block,
	nbd, netdev

Recently, syzbot has reported 100+ possible deadlock splats
involving NBD, typically following this pattern:

  lock_sock(sk)
  -> GFP_KERNEL memory allocation
     -> fs reclaim
        -> lock_sock(sk) at NBD

Instead of spreading memalloc_noio_{save,restore} over the
networking code, we want to fix it in the NBD layer.

This series introduces a try-lock version of lock_sock() and
use it in NBD to fix the deadlock.

The try-lock variant should not fail in practice because while
the socket remain exposed to userspace even after being handed
over to NBD, the socket should not be touched by userspace.

The series can be applied cleanly on block-7.0 and net.git.


Kuniyuki Iwashima (5):
  nbd: Remove redundant sock->ops->shutdown() check in nbd_get_socket().
  nbd: Reject unconnected sockets in nbd_get_socket().
  net: Introduce lock_sock_try().
  inet: Add inet_shutdown_locked().
  nbd: Use lock_sock_try() for TCP sendmsg() and shutdown().

 drivers/block/nbd.c       | 44 ++++++++++++++++++++++++++++++++++-----
 include/net/inet_common.h |  1 +
 include/net/sock.h        | 31 +++++++++++++++++++++++++++
 net/ipv4/af_inet.c        | 43 ++++++++++++++++++++++++++++----------
 4 files changed, 103 insertions(+), 16 deletions(-)

-- 
2.53.0.1018.g2bb0e51243-goog


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-03-26 19:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25  6:38 [PATCH 0/5] nbd: Fix deadlock during fs reclaim under lock_sock() Kuniyuki Iwashima
2026-03-25  6:38 ` [PATCH 1/5] nbd: Remove redundant sock->ops->shutdown() check in nbd_get_socket() Kuniyuki Iwashima
2026-03-25  6:38 ` [PATCH 2/5] nbd: Reject unconnected sockets " Kuniyuki Iwashima
2026-03-25  6:38 ` [PATCH 3/5] net: Introduce lock_sock_try() Kuniyuki Iwashima
2026-03-25  6:38 ` [PATCH 4/5] inet: Add inet_shutdown_locked() Kuniyuki Iwashima
2026-03-25  6:38 ` [PATCH 5/5] nbd: Use lock_sock_try() for TCP sendmsg() and shutdown() Kuniyuki Iwashima
2026-03-26 19:13   ` kernel test robot
2026-03-26 19:38     ` Kuniyuki Iwashima

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox