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 <kw...@redhat.com> > --- > 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 <mre...@redhat.com>
signature.asc
Description: OpenPGP digital signature