Linux block layer
 help / color / mirror / Atom feed
From: Nilay Shroff <nilay@linux.ibm.com>
To: Damien Le Moal <dlemoal@kernel.org>, linux-block@vger.kernel.org
Cc: hch@lst.de, ming.lei@redhat.com, hare@suse.de, axboe@kernel.dk,
	johannes.thumshirn@wdc.com, gjoyce@ibm.com
Subject: Re: [PATCH 2/2] null_blk: fix set->driver_data while setting up tagset
Date: Mon, 21 Jul 2025 19:07:28 +0530	[thread overview]
Message-ID: <a4f4d30e-c032-46b8-bc29-2254ddcf8fea@linux.ibm.com> (raw)
In-Reply-To: <4b30df72-72e0-484e-99d5-820af02619d9@kernel.org>



On 7/21/25 6:34 PM, Damien Le Moal wrote:
> On 2025/07/20 20:35, Nilay Shroff wrote:
>> When setting up a null block device, we initialize a tagset that
>> includes a driver_data field—typically used by block drivers to
>> store a pointer to driver-specific data. In the case of null_blk,
>> this should point to the struct nullb instance.
>>
>> However, due to recent tagset refactoring in the null_blk driver, we
>> missed initializing driver_data when creating a shared tagset. As a
>> result, software queues (ctx) fail to map correctly to new hardware
>> queues (hctx). For example, increasing the number of submit queues
>> triggers an nr_hw_queues update, which invokes null_map_queues() to
>> remap queues. Since set->driver_data is unset, null_map_queues()
>> fails to map any ctx to the new hctxs, leading to hctx->nr_ctx == 0,
>> effectively making the hardware queues unusable for I/O.
>>
>> This patch fixes the issue by ensuring that set->driver_data is properly
>> initialized to point to the struct nullb during tagset setup.
>>
>> Fixes: 72ca28765fc4 ("null_blk: refactor tag_set setup")
>> Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
>> ---
>>  drivers/block/null_blk/main.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
>> index aa163ae9b2aa..9e1c4ce6fc42 100644
>> --- a/drivers/block/null_blk/main.c
>> +++ b/drivers/block/null_blk/main.c
>> @@ -1854,13 +1854,14 @@ static int null_init_global_tag_set(void)
>>  
>>  static int null_setup_tagset(struct nullb *nullb)
>>  {
>> +	nullb->tag_set->driver_data = nullb;
>> +
> 
> How can this be correct since the tag_set pointer is initialized below ?
> 
>>  	if (nullb->dev->shared_tags) {
>>  		nullb->tag_set = &tag_set;
> 
> Shouldn't you add:
> 
> 		nullb->tag_set->driver_data = nullb;
> 
> here instead ?
> 
>>  		return null_init_global_tag_set();
>>  	}

Oh yes good catch! I'll fix this in the next patchset.
My bad.. :(

Thanks,
--Nilay


      reply	other threads:[~2025-07-21 13:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-20 11:35 [PATCH 0/2] fix sbitmap initialization and null_blk tagset setup Nilay Shroff
2025-07-20 11:35 ` [PATCH 1/2] lib/sbitmap: fix kernel crash observed when sbitmap depth is zero Nilay Shroff
2025-07-21  7:15   ` Hannes Reinecke
2025-07-21 13:02   ` Damien Le Moal
2025-07-20 11:35 ` [PATCH 2/2] null_blk: fix set->driver_data while setting up tagset Nilay Shroff
2025-07-21  7:16   ` Hannes Reinecke
2025-07-21 13:04   ` Damien Le Moal
2025-07-21 13:37     ` Nilay Shroff [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=a4f4d30e-c032-46b8-bc29-2254ddcf8fea@linux.ibm.com \
    --to=nilay@linux.ibm.com \
    --cc=axboe@kernel.dk \
    --cc=dlemoal@kernel.org \
    --cc=gjoyce@ibm.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=johannes.thumshirn@wdc.com \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.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