public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>,
	Bart Van Assche <bvanassche@acm.org>,
	linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	Yu Kuai <yukuai1@huaweicloud.com>, Ming Lei <ming.lei@redhat.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] block: Fix a deadlock related freezing zoned storage devices
Date: Fri, 23 May 2025 10:20:48 +0200	[thread overview]
Message-ID: <20250523082048.GA15587@lst.de> (raw)
In-Reply-To: <3cd139d0-5fe0-4ce1-b7a7-36da4fad6eff@kernel.org>

On Fri, May 23, 2025 at 10:10:30AM +0200, Damien Le Moal wrote:
> > 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?
> 
> What about this patch, completely untested...

This still looks extremely backwards as it messed up common core
code for something that it shouldn't.  I'd still love to see an
actual reproducer ahead of me, but I think the problem is that
blk_zone_wplug_bio_work calls into the still fairly high-level
submit_bio_noacct_nocheck for bios that already went through
the submit_bio machinery.

Something like this completely untested patch:

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 8f15d1aa6eb8..6841af8a989c 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -1306,16 +1306,18 @@ static void blk_zone_wplug_bio_work(struct work_struct *work)
 	spin_unlock_irqrestore(&zwplug->lock, flags);
 
 	bdev = bio->bi_bdev;
-	submit_bio_noacct_nocheck(bio);
-
 	/*
 	 * blk-mq devices will reuse the extra reference on the request queue
 	 * usage counter we took when the BIO was plugged, but the submission
 	 * path for BIO-based devices will not do that. So drop this extra
 	 * reference here.
 	 */
-	if (bdev_test_flag(bdev, BD_HAS_SUBMIT_BIO))
+	if (bdev_test_flag(bdev, BD_HAS_SUBMIT_BIO)) {
+		bdev->bd_disk->fops->submit_bio(bio);
 		blk_queue_exit(bdev->bd_disk->queue);
+	} else {
+		blk_mq_submit_bio(bio);
+	}
 
 put_zwplug:
 	/* Drop the reference we took in disk_zone_wplug_schedule_bio_work(). */

  parent reply	other threads:[~2025-05-23  8:20 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
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 [this message]
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=20250523082048.GA15587@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=dlemoal@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --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