Linux block layer
 help / color / mirror / Atom feed
From: Nilay Shroff <nilay@linux.ibm.com>
To: Bart Van Assche <bvanassche@acm.org>, Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org,
	Christoph Hellwig <hch@infradead.org>,
	Marco Elver <elver@google.com>, Christoph Hellwig <hch@lst.de>,
	Josef Bacik <josef@toxicpanda.com>
Subject: Re: [PATCH 20/27] nbd: Enable lock context analysis
Date: Thu, 11 Jun 2026 10:32:50 +0530	[thread overview]
Message-ID: <e86222df-62b2-4337-9563-f2a7eadeccbc@linux.ibm.com> (raw)
In-Reply-To: <ba18cfd5-0a52-4e2e-85a1-a9f0a20ff957@acm.org>

On 6/10/26 10:46 PM, Bart Van Assche wrote:
> On 6/10/26 1:02 AM, Nilay Shroff wrote:
>> Above changes are good, however I see nbd also uses @nbd_index_mutex
>> which guards @nbd_index_idr. So should we also annotate @nbd_index_idr
>> using __guarded_by(&nbd_index_mutex)?
> 
> How about adding these changes as an additional patch?
> 
> Thanks,
> 
> Bart.
> 
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index 345e4b73009d..b9e0ad0b3ca0 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -49,8 +49,8 @@
>   #define CREATE_TRACE_POINTS
>   #include <trace/events/nbd.h>
> 
> -static DEFINE_IDR(nbd_index_idr);
>   static DEFINE_MUTEX(nbd_index_mutex);
> +static __guarded_by(&nbd_index_mutex) DEFINE_IDR(nbd_index_idr);
>   static struct workqueue_struct *nbd_del_wq;
>   static int nbd_total_devices = 0;
> 
> @@ -2739,7 +2739,9 @@ static void __exit nbd_cleanup(void)
>       /* Also wait for nbd_dev_remove_work() completes */
>       destroy_workqueue(nbd_del_wq);
> 
> -    idr_destroy(&nbd_index_idr);
> +    scoped_guard(mutex_init, &nbd_index_mutex)
> +        idr_destroy(&nbd_index_idr);
> +
>       unregister_blkdev(NBD_MAJOR, "nbd");
>   }
> 
> 
Looks good. But as I said earlier for similar changes in
loop driver, you may want to consider updating current
patch (instead of adding an additional patch) with the
above changes while you're enabling lock context for
nbd driver.

Thanks,
--Nilay


  reply	other threads:[~2026-06-11  5:05 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09 22:04 [PATCH 00/27] Enable lock context analysis in drivers/block/ Bart Van Assche
2026-06-09 22:04 ` [PATCH 01/27] aoe: Enable lock context analysis Bart Van Assche
2026-06-12 14:52   ` Haris Iqbal
2026-06-09 22:04 ` [PATCH 02/27] drbd: Remove "extern" from function declarations Bart Van Assche
2026-06-10  5:17   ` Christoph Hellwig
2026-06-09 22:04 ` [PATCH 03/27] drbd: Retain one _get_ldev_if_state() implementation Bart Van Assche
2026-06-10  5:18   ` Christoph Hellwig
2026-06-09 22:04 ` [PATCH 04/27] drbd: Remove the get_ldev_if_state() macro Bart Van Assche
2026-06-10  5:19   ` Christoph Hellwig
2026-06-09 22:04 ` [PATCH 05/27] drbd: Remove the 'local' lock context Bart Van Assche
2026-06-10  5:19   ` Christoph Hellwig
2026-06-09 22:04 ` [PATCH 06/27] drbd: Simplify the bitmap locking functions Bart Van Assche
2026-06-10  5:20   ` Christoph Hellwig
2026-06-09 22:04 ` [PATCH 07/27] drbd: Move two declarations Bart Van Assche
2026-06-10  5:20   ` Christoph Hellwig
2026-06-09 22:04 ` [PATCH 08/27] drbd: Pass 'resource' directly to complete_conflicting_writes() Bart Van Assche
2026-06-10  5:21   ` Christoph Hellwig
2026-06-09 22:04 ` [PATCH 09/27] drbd: Split drbd_nl_get_connections_dumpit() Bart Van Assche
2026-06-10  5:22   ` Christoph Hellwig
2026-06-10 16:48     ` Bart Van Assche
2026-06-09 22:04 ` [PATCH 10/27] drbd: Make a mutex_unlock() call unconditional Bart Van Assche
2026-06-10  5:22   ` Christoph Hellwig
2026-06-09 22:04 ` [PATCH 11/27] drbd: Split drbd_req_state() Bart Van Assche
2026-06-10  5:24   ` Christoph Hellwig
2026-06-10 17:05     ` Bart Van Assche
2026-06-10 17:07       ` Bart Van Assche
2026-06-09 22:04 ` [PATCH 12/27] drbd: Convert drbd_req_state() to unconditional locking Bart Van Assche
2026-06-10  5:25   ` Christoph Hellwig
2026-06-09 22:05 ` [PATCH 13/27] drbd: Annotate drbd_bm_{lock,unlock}() Bart Van Assche
2026-06-10  5:26   ` Christoph Hellwig
2026-06-09 22:05 ` [PATCH 14/27] drbd: Enable lock context analysis Bart Van Assche
2026-06-09 22:05 ` [PATCH 15/27] loop: Split loop_change_fd() Bart Van Assche
2026-06-10  5:30   ` Christoph Hellwig
2026-06-09 22:05 ` [PATCH 16/27] loop: Split loop_configure() Bart Van Assche
2026-06-12 16:16   ` Haris Iqbal
2026-06-12 17:12     ` Bart Van Assche
2026-06-09 22:05 ` [PATCH 17/27] loop: Remove the "bool global" function argument Bart Van Assche
2026-06-09 22:05 ` [PATCH 18/27] loop: Add lock context annotations Bart Van Assche
2026-06-10  9:21   ` Nilay Shroff
2026-06-10 17:13     ` Bart Van Assche
2026-06-11  5:00       ` Nilay Shroff
2026-06-09 22:05 ` [PATCH 19/27] mtip32: Enable lock context analysis Bart Van Assche
2026-06-09 22:05 ` [PATCH 20/27] nbd: " Bart Van Assche
2026-06-10  8:02   ` Nilay Shroff
2026-06-10 17:16     ` Bart Van Assche
2026-06-11  5:02       ` Nilay Shroff [this message]
2026-06-09 22:05 ` [PATCH 21/27] null_blk: " Bart Van Assche
2026-06-09 23:42   ` Damien Le Moal
2026-06-10  5:31   ` Christoph Hellwig
2026-06-10 18:01     ` Bart Van Assche
2026-06-10  7:28   ` Nilay Shroff
2026-06-09 22:05 ` [PATCH 22/27] rbd: " Bart Van Assche
2026-06-10  5:32   ` Christoph Hellwig
2026-06-09 22:05 ` [PATCH 23/27] ublk: " Bart Van Assche
2026-06-10  2:24   ` Ming Lei
2026-06-09 22:05 ` [PATCH 24/27] xen-blkback: " Bart Van Assche
2026-06-09 22:05 ` [PATCH 25/27] zram: " Bart Van Assche
2026-06-09 22:05 ` [PATCH 26/27] rnbd: " Bart Van Assche
2026-06-09 22:05 ` [PATCH 27/27] block: Enable lock context analysis for all block drivers Bart Van Assche
2026-06-10  5:34 ` [PATCH 00/27] Enable lock context analysis in drivers/block/ Christoph Hellwig
2026-06-10  7:31   ` Marco Elver
2026-06-10 11:30     ` Christoph Hellwig
2026-06-10 17:00       ` 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=e86222df-62b2-4337-9563-f2a7eadeccbc@linux.ibm.com \
    --to=nilay@linux.ibm.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=elver@google.com \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --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