public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	Damien Le Moal <dlemoal@kernel.org>,
	Yu Kuai <yukuai1@huaweicloud.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] block: Fix a deadlock related freezing zoned storage devices
Date: Fri, 23 May 2025 10:10:28 +0800	[thread overview]
Message-ID: <aC_ZFIICdxzSOxCt@fedora> (raw)
In-Reply-To: <78244478-3ce3-4671-b28f-c67c5b21dba9@acm.org>

On Thu, May 22, 2025 at 11:32:58AM -0700, Bart Van Assche wrote:
> On 5/22/25 10:38 AM, Jens Axboe wrote:
> > On 5/22/25 11:14 AM, Bart Van Assche wrote:
> > >   static void __submit_bio(struct bio *bio)
> > >   {
> > >   	/* If plug is not used, add new plug here to cache nsecs time. */
> > > @@ -633,8 +640,12 @@ static void __submit_bio(struct bio *bio)
> > >   	if (!bdev_test_flag(bio->bi_bdev, BD_HAS_SUBMIT_BIO)) {
> > >   		blk_mq_submit_bio(bio);
> > > -	} else if (likely(bio_queue_enter(bio) == 0)) {
> > > +	} else {
> > >   		struct gendisk *disk = bio->bi_bdev->bd_disk;
> > > +		bool zwp = bio_zone_write_plugging(bio);
> > > +
> > > +		if (unlikely(!zwp && bio_queue_enter(bio) != 0))
> > > +			goto finish_plug;
> > >   	
> > >   		if ((bio->bi_opf & REQ_POLLED) &&
> > >   		    !(disk->queue->limits.features & BLK_FEAT_POLL)) {
> > > @@ -643,9 +654,12 @@ static void __submit_bio(struct bio *bio)
> > >   		} else {
> > >   			disk->fops->submit_bio(bio);
> > >   		}
> > > -		blk_queue_exit(disk->queue);
> > > +
> > > +		if (!zwp)
> > > +			blk_queue_exit(disk->queue);
> > >   	}
> > 
> > This is pretty ugly, and I honestly absolutely hate how there's quite a
> > bit of zoned_whatever sprinkling throughout the core code. What's the
> > reason for not unplugging here, unaligned writes? Because you should
> > presumable have the exact same issues on non-zoned devices if they have
> > IO stuck in a plug (and doesn't get unplugged) while someone is waiting
> > on a freeze.
> > 
> > A somewhat similar case was solved for IOPOLL and queue entering. That
> > would be another thing to look at. Maybe a live enter could work if the
> > plug itself pins it?
> 
> Hi Jens,
> 
> q->q_usage_counter is not increased for bios on current->plug_list.
> q->q_usage_counter is increased before a bio is added to the zoned pluglist.
> So these two cases are different.
> 
> I think it is important to hold a q->q_usage_counter reference for bios
> on the zoned plug list because bios are added to that list after bio
> splitting happened. Hence, request queue limits must not change while
> any bio is on the zoned plug list.

Hi Bart,

Can you share why request queue limit can't be changed after bio is added
to zoned plug list?

If it is really true, we may have to drain zoned plug list when freezing
queue.


Thanks, 
Ming


  reply	other threads:[~2025-05-23  2:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-22 17:14 [PATCH] block: Fix a deadlock related freezing zoned storage devices Bart Van Assche
2025-05-22 17:38 ` Jens Axboe
2025-05-22 18:32   ` Bart Van Assche
2025-05-23  2:10     ` Ming Lei [this message]
2025-05-23  6:06       ` Damien Le Moal
2025-05-23  5:53     ` Damien Le Moal
2025-05-23  8:10   ` Damien Le Moal
2025-05-23  8:20     ` Damien Le Moal
2025-05-23  8:22       ` Christoph Hellwig
2025-05-23  8:20     ` Christoph Hellwig
2025-05-23 11:00       ` Damien Le Moal
2025-05-26  7:41       ` Damien Le Moal
2025-05-27 21:49       ` Bart Van Assche
2025-05-23 12:36     ` Jens Axboe
2025-05-23  3:10 ` Christoph Hellwig
2025-05-23 16:08   ` 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=aC_ZFIICdxzSOxCt@fedora \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=dlemoal@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=yukuai1@huaweicloud.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