Linux block layer
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: linux-block@vger.kernel.org
Subject: Re: [PATCH blktests v3 0/2] Add an NBD performance test
Date: Wed, 2 Dec 2026 16:31:26 -0800	[thread overview]
Message-ID: <1d016add-cf91-48ed-8e40-cf9606a0058c@acm.org> (raw)
In-Reply-To: <axC0sbhx9y1UCNyw@shinmob>

On 12/2/26 4:23 PM, Shin'ichiro Kawasaki wrote:
> BTW, I found that this test case causes a lockdep WARN below. In that sense,
> this test case is good not only for performance testing, but also exercising
> block layer. The WARN was observed with v7.4-rc5 and v7.3 kernels. I'm not sure
> who to ask, but help to avoid the WARN will be appreciated.
The LLM that I asked to take a look at the lockdep complaint proposed
the patch below. This patch has not yet been tested. I will do that as
soon as I have the time to do this.

Bart.

--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -33,6 +33,7 @@
  #include <linux/kernel.h>
  #include <linux/slab.h>
  #include <net/sock.h>
+#include <net/af_unix.h>
  #include <linux/net.h>
  #include <linux/kthread.h>
  #include <linux/types.h>
@@ -1241,6 +1242,7 @@ static struct socket *nbd_get_socket(str
  #ifdef CONFIG_DEBUG_LOCK_ALLOC
  static struct lock_class_key nbd_key[3];
  static struct lock_class_key nbd_slock_key[3];
+static struct lock_class_key nbd_unix_iolock_key;

  static void nbd_reclassify_socket(struct socket *sock)
  {
@@ -1267,6 +1269,14 @@ static void nbd_reclassify_socket(struct
  					      &nbd_slock_key[2],
  					      "sk_lock-AF_UNIX-NBD",
  					      &nbd_key[2]);
+		/*
+		 * The AF_UNIX receive paths serialize on unix_sock::iolock
+		 * instead of sk_lock. Do not reclassify a held mutex.
+		 */
+		if (!mutex_is_locked(&unix_sk(sk)->iolock))
+			lockdep_set_class_and_name(&unix_sk(sk)->iolock,
+						   &nbd_unix_iolock_key,
+						   "iolock-AF_UNIX-NBD");
  		break;
  	}
  }

      reply	other threads:[~2026-12-03  0:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 23:52 [PATCH blktests v3 0/2] Add an NBD performance test Bart Van Assche
2026-11-29 23:52 ` [PATCH blktests v3 1/2] nbd/rc: Declare the loop variables of the wait helpers local Bart Van Assche
2026-11-29 23:52 ` [PATCH blktests v3 2/2] nbd/006: Measure NBD IOPS with a null_blk backing device Bart Van Assche
2026-12-03  0:23 ` [PATCH blktests v3 0/2] Add an NBD performance test Shin'ichiro Kawasaki
2026-12-03  0:31   ` Bart Van Assche [this message]

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=1d016add-cf91-48ed-8e40-cf9606a0058c@acm.org \
    --to=bvanassche@acm.org \
    --cc=linux-block@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.com \
    /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