All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Bart Van Assche <bvanassche@acm.org>,
	Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
	linux-block@vger.kernel.org
Subject: Re: [blktests] zbd/012: Test requeuing of zoned writes and queue freezing
Date: Wed, 27 Nov 2024 20:31:43 +0900	[thread overview]
Message-ID: <3bc57ef3-4916-4bcf-ac1a-9efed89fc102@kernel.org> (raw)
In-Reply-To: <Z0bfKNMKhLkEHusz@infradead.org>

On 11/27/24 17:58, Christoph Hellwig wrote:
> On Wed, Nov 27, 2024 at 05:17:08PM +0900, Damien Le Moal wrote:
>> After all these fixes, the last remaining problem is the zone write
>> plug error recovery issuing a report zone which can block if a queue 
>> freeze was initiated.
>>
>> That can prevent forward progress and hang the freeze caller. I do not
>> see any way to avoid that report zones. I think this could be fixed with
>> a magic BLK_MQ_REQ_INTERNAL flag passed to blk_mq_alloc_request() and
>> propagated to blk_queue_enter() to forcefully take a queue usage counter
>> reference even if a queue freeze was started. That would ensure forward
>> progress (i.e. scsi_execute_cmd() or the NVMe equivalent would not block
>> forever). Need to think more about that.
> 
> You are talking about disk_zone_wplug_handle_error here, right?

Yes.

> We should not issue a report zones to a frozen queue, as that would
> bypass the freezing protection.  I suspect the right thing is to
> simply defer the error recovery action until after the queue is
> unfrozen.

But that is the issue: if we defer the report zones, we cannot make progress
with BIOs still plugged in the zone write plug BIO list. These hold a queue
usage reference that the queue freeze wait is waiting for. We have to somehow
allow that report zones to execute to make progress and empty the zone write
plugs of all plugged BIOs.

Note that if we were talking about regular writes only, we would not need to
care about error recovery as we would simply need to abort all these plugged
BIOs (as we know they will fail anyway). But for a correct zone append
emulation, we need to recover the zone write pointer to resume the execution of
the plugged BIOs. Otherwise, the user would see failed zone append commands that
are not suppose to fail unless the drive (or the zone) is dead...

> I wonder if the separate error work handler should go away, instead
> blk_zone_wplug_bio_work should always check for an error first
> and in that case do the report zones.  And blk_zone_wplug_handle_write
> would always defer to the work queue if there was an error.

That would not change a thing. The issue is that if a queue freeze has started,
executing a report zone can block on a request allocation (on the
blk_queue_enter() it implies if there are no cached requests). So the same
problem remains.

Though I agree that the error recovery could be moved to the zone BIO work and
we could get rid of the error recovery work.

But we still need to somehow allow that report zone to execute even if a queue
freeze has started... Hence the idea of the BLK_MQ_REQ_INTERNAL flag to allow
that, for special cases like this one were completing BIOs depends on first
executing another internal command. Or maybe we could try to pre-allocate a
request for such case, but managing that request to not have it freed to be able
to reuse it until all errors are processed may need many block layer changes...


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2024-11-27 11:31 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-25 21:10 [blktests] zbd/012: Test requeuing of zoned writes and queue freezing Bart Van Assche
2024-11-26  8:34 ` Damien Le Moal
2024-11-26 13:44   ` Bart Van Assche
2024-11-27  5:18     ` Damien Le Moal
2024-11-27  6:16       ` Christoph Hellwig
2024-11-27  6:21         ` Christoph Hellwig
2024-11-27  6:32           ` Damien Le Moal
2024-11-27  6:33             ` Christoph Hellwig
2024-11-27  6:43               ` Damien Le Moal
2024-11-27  6:45                 ` Christoph Hellwig
2024-11-27  7:02                   ` Damien Le Moal
2024-11-27  7:19                     ` Christoph Hellwig
2024-11-27  8:17                       ` Damien Le Moal
2024-11-27  8:58                         ` Christoph Hellwig
2024-11-27 11:31                           ` Damien Le Moal [this message]
2024-11-27 16:58                             ` Christoph Hellwig
2024-11-27 23:18                               ` Damien Le Moal
2024-11-27 23:36                                 ` Bart Van Assche
2024-11-27 23:43                                   ` Damien Le Moal
2024-11-28  3:20                                 ` Christoph Hellwig
2024-11-28  4:37                                   ` Damien Le Moal
2024-11-28  4:39                                     ` Christoph Hellwig
2024-11-28  4:52                                       ` Damien Le Moal
2024-11-28  5:00                                         ` Christoph Hellwig
2024-11-28  5:07                                           ` Damien Le Moal
2024-11-28  5:16                                             ` Christoph Hellwig
2024-11-28  5:19                                               ` Damien Le Moal
2024-11-28  5:21                                                 ` Christoph Hellwig
2024-11-28  5:27                                                   ` Damien Le Moal
2024-11-27 17:10           ` Bart Van Assche
2024-11-27 23:11             ` Damien Le Moal
2024-11-26 11:26 ` Damien Le Moal
2024-11-26 12:49   ` Christoph Hellwig
2024-11-27  2:28     ` Damien Le Moal
2024-11-28  4:35 ` Shinichiro Kawasaki

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=3bc57ef3-4916-4bcf-ac1a-9efed89fc102@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=bvanassche@acm.org \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.