[PATCH v2 0/9] block/io: safer inc/dec in_flight sections

Vladimir Sementsov-Ogievskiy posted 9 patches 4 years ago
Test docker-mingw@fedora passed
Test docker-quick@centos7 failed
Test checkpatch passed
Test FreeBSD failed
Test asan failed
Failed in applying to current master (apply log)
block/io.c | 789 +++++++++++++++++++++++++++++++++++------------------
1 file changed, 525 insertions(+), 264 deletions(-)
[PATCH v2 0/9] block/io: safer inc/dec in_flight sections
Posted by Vladimir Sementsov-Ogievskiy 4 years ago
Hi all!

This is inspired by Kevin's
"block: Fix blk->in_flight during blk_wait_while_drained()" series.

So, like it's now done for block-backends, let's expand
in_flight-protected sections for bdrv_ interfaces, including
coroutine_enter and BDRV_POLL_WHILE loop into these sections.

v2:
01: drop coroutine_fn from bdrv_is_allocated_above declaration
02-04: add Stefan's r-b
05: improve commit message
    fix typo in bdrv_do_pdiscard name
    add more "To be called between exactly one pair of bdrv_inc/dec_in_flight()" comments
    drop unused bs variable
    fix bdrv_pdiscard_co_entry to use bdrv_do_pdiscard
06: similarly to 05, add additional comment to bdrv_is_allocated_above_co_entry
07-08: add Stefan's r-b
09: add "To be called between exactly one pair of bdrv_inc/dec_in_flight()" for bdrv_make_zero_co_entry

Vladimir Sementsov-Ogievskiy (9):
  block/io: refactor bdrv_is_allocated_above to run only one coroutine
  block/io: refactor bdrv_co_ioctl: move aio stuff to corresponding
    block
  block/io: move flush and pdiscard stuff down
  block/io: move bdrv_rw_co_entry and friends down
  block/io: expand in_flight inc/dec section: simple cases
  block/io: expand in_flight inc/dec section: block-status
  block/io: add bdrv_do_pwrite_zeroes
  block/io: move bdrv_make_zero under block-status
  block/io: expand in_flight inc/dec section: bdrv_make_zero

 block/io.c | 789 +++++++++++++++++++++++++++++++++++------------------
 1 file changed, 525 insertions(+), 264 deletions(-)

-- 
2.21.0


Re: [PATCH v2 0/9] block/io: safer inc/dec in_flight sections
Posted by Vladimir Sementsov-Ogievskiy 3 years, 11 months ago
27.04.2020 17:38, Vladimir Sementsov-Ogievskiy wrote:
> Hi all!
> 
> This is inspired by Kevin's
> "block: Fix blk->in_flight during blk_wait_while_drained()" series.
> 
> So, like it's now done for block-backends, let's expand
> in_flight-protected sections for bdrv_ interfaces, including
> coroutine_enter and BDRV_POLL_WHILE loop into these sections.
> 

OK, let's postpone this thing.

1. Idea to move ind/dec out of coroutine seems wrong, it leads to dead-lock, as shown in backtrace in my answer to 5/9.

2. Idea to keep request inside only one pair of ind/dec is probably an extra restriction in bdrv layer (I just blindly followed how it was done in blk layer by Kevin)

3. We still may have a theoretical race between request start and drained section start, but it needs another audit and smarter solution.

So, seems that we should not apply these series as it is, sorry for the noise. I think, I'll resend my 64bit-block-layer series based on master instead of this one.

-- 
Best regards,
Vladimir