[dm-devel] Why queue_work unneeded for REQUEUE bio
Mike Snitzer
snitzer at redhat.com
Tue Nov 3 13:48:25 UTC 2020
On Tue, Nov 03 2020 at 4:23am -0500,
Jeffle Xu <jefflexu at linux.alibaba.com> wrote:
> Hi Mike,
>
> Why queue_work() is unnecessary here for bio with BLK_STS_DM_REQUEUE
> returned?
>
> Thanks
> Jeffle Xu
>
> ---
> drivers/md/dm.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/md/dm.c b/drivers/md/dm.c
> index c18fc2548518..ae550daa99b5 100644
> --- a/drivers/md/dm.c
> +++ b/drivers/md/dm.c
> @@ -908,9 +908,11 @@ static void dec_pending(struct dm_io *io, blk_status_t error)
> * Target requested pushing back the I/O.
> */
> spin_lock_irqsave(&md->deferred_lock, flags);
> - if (__noflush_suspending(md))
> + if (__noflush_suspending(md)) {
> /* NOTE early return due to BLK_STS_DM_REQUEUE below */
> bio_list_add_head(&md->deferred, io->orig_bio);
> + queue_work(md->wq, &md->work);
> + }
> else
> /* noflush suspend was interrupted. */
> io->status = BLK_STS_IOERR;
> --
> 2.27.0
>
For the case you highlighted (BLK_STS_DM_REQUEUE + __noflush_suspending)
I think the missing queue_work is because we're actively dealing with
the fact that we do _not_ want to flush IO. SO kicking the workqueue
there isn't helpful because it just processes work that cannot be issued
yet -- the workqueue will be kicked upon resume (see __dm_resume's
dm_queue_flush).
Mike
More information about the dm-devel
mailing list