Linux block layer
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Yu Kuai <yukuai1@huaweicloud.com>
Cc: Nilay Shroff <nilay@linux.ibm.com>,
	josef@toxicpanda.com, axboe@kernel.dk, hch@infradead.org,
	hare@suse.de, linux-block@vger.kernel.org, nbd@other.debian.org,
	linux-kernel@vger.kernel.org, yi.zhang@huawei.com,
	yangerkun@huawei.com, johnny.chenyi@huawei.com,
	"yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH] nbd: fix false lockdep deadlock warning
Date: Wed, 2 Jul 2025 10:32:54 +0800	[thread overview]
Message-ID: <aGSaVhiH2DeTvtdr@fedora> (raw)
In-Reply-To: <99b4afce-de05-ddcb-2634-b19214cf4534@huaweicloud.com>

On Wed, Jul 02, 2025 at 09:12:09AM +0800, Yu Kuai wrote:
> Hi,
> 
> 在 2025/07/01 21:28, Nilay Shroff 写道:
> > 
> > 
> > On 6/28/25 6:18 AM, Yu Kuai wrote:
> > > Hi,
> > > 
> > > 在 2025/06/27 19:04, Ming Lei 写道:
> > > > I guess the patch in the following link may be simper, both two take
> > > > similar approach:
> > > > 
> > > > https://lore.kernel.org/linux-block/aFjbavzLAFO0Q7n1@fedora/
> > > 
> > > I this the above approach has concurrent problems if nbd_start_device
> > > concurrent with nbd_start_device:
> > > 
> > > t1:
> > > nbd_start_device
> > > lock
> > > num_connections = 1
> > > unlock
> > >      t2:
> > >      nbd_add_socket
> > >      lock
> > >      config->num_connections++
> > >      unlock
> > >          t3:
> > >          nbd_start_device
> > >          lock
> > >          num_connections = 2
> > >          unlock
> > >          blk_mq_update_nr_hw_queues
> > > 
> > > blk_mq_update_nr_hw_queues
> > > //nr_hw_queues updated to 1 before failure
> > > return -EINVAL
> > > 
> > 
> > In the above case, yes I see that t1 would return -EINVAL (as
> > config->num_connections doesn't match with num_connections)
> > but then t3 would succeed to update nr_hw_queue (as both
> > config->num_connections and num_connections set to 2 this
> > time). Isn't it? If yes, then the above patch (from Ming)
> > seems good.
> 
> Emm, I'm confused, If you agree with the concurrent process, then
> t3 update nr_hw_queues to 2 first and return sucess, later t1 update
> nr_hw_queues back to 1 and return failure.

It should be easy to avoid failure by simple retrying.


Thanks,
Ming


  reply	other threads:[~2025-07-02  2:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-27  9:23 [PATCH] nbd: fix false lockdep deadlock warning Yu Kuai
2025-06-27 11:04 ` Ming Lei
2025-06-28  0:48   ` Yu Kuai
2025-07-01 13:28     ` Nilay Shroff
2025-07-02  1:12       ` Yu Kuai
2025-07-02  2:32         ` Ming Lei [this message]
2025-07-02  6:22           ` Nilay Shroff
2025-07-02  7:30             ` Yu Kuai
2025-07-05  1:15               ` Yu Kuai
2025-07-08  5:12                 ` Nilay Shroff
2025-07-08  7:34                   ` Ming Lei
2025-07-08 11:13                     ` Nilay Shroff

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=aGSaVhiH2DeTvtdr@fedora \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=hare@suse.de \
    --cc=hch@infradead.org \
    --cc=johnny.chenyi@huawei.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nbd@other.debian.org \
    --cc=nilay@linux.ibm.com \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai1@huaweicloud.com \
    --cc=yukuai3@huawei.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