[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH for-5.0 1/2] block: Don't blk_wait_while_drained() in blk_co_
From: |
Max Reitz |
Subject: |
Re: [PATCH for-5.0 1/2] block: Don't blk_wait_while_drained() in blk_co_preadv/pwritev |
Date: |
Fri, 3 Apr 2020 14:40:23 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 |
On 03.04.20 12:44, Kevin Wolf wrote:
> Calling blk_wait_while_drained() while blk->in_flight is increased for
> the current request is wrong because it will cause the drain operation
> to deadlock.
>
> In blk_co_preadv() and blk_co_pwritev_part(), this deadlock is easily
> fixed by simply removing the blk_wait_while_drained() call. We already
> wait in blk_aio_read_entry() and blk_aio_write_entry(), and if a request
> didn't wait there because it started basically at the same time as the
> drain, we can simply let it complete.
>
> We still do need the wait for emulating synchronous operations, which
> don't have a second call yet, so add blk_wait_while_drained() calls
> there.
>
> Fixes: cf3129323f900ef5ddbccbe86e4fa801e88c566e
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
> block/block-backend.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
I suppose we need this patch regardless of the next one because before
it, blk_co_preadv() and blk_co_pwritev_part() are sometimes called with
in_flight increased, and sometimes not, so we’d still need to make sure
it’s always increased. Or, alternatively, just move it out of
blk_co_preadv() and blk_co_pwritev_part(), as this patch does.
Reviewed-by: Max Reitz <address@hidden>
signature.asc
Description: OpenPGP digital signature