block-backend: Queue requests while drained
This fixes devices like IDE that can still start new requests from I/O handlers in the CPU thread while the block backend is drained. The basic assumption is that in a drain section, no new requests should be allowed through a BlockBackend (blk_drained_begin/end don't exist, we get drain sections only on the node level). However, there are two special cases where requests should not be queued: 1. Block jobs: We already make sure that block jobs are paused in a drain section, so they won't start new requests. However, if the drain_begin is called on the job's BlockBackend first, it can happen that we deadlock because the job stays busy until it reaches a pause point - which it can't if its requests aren't processed any more. The proper solution here would be to make all requests through the job's filter node instead of using a BlockBackend. For now, just disabling request queuing on the job BlockBackend is simpler. 2. In test cases where making requests through bdrv_* would be cumbersome because we'd need a BdrvChild. As we already got the functionality to disable request queuing from 1., use it in tests, too, for convenience. Signed-off-by:Kevin Wolf <kwolf@redhat.com> Reviewed-by:
Max Reitz <mreitz@redhat.com>
Showing
- block/backup.c 1 addition, 0 deletionsblock/backup.c
- block/block-backend.c 50 additions, 3 deletionsblock/block-backend.c
- block/commit.c 2 additions, 0 deletionsblock/commit.c
- block/mirror.c 1 addition, 0 deletionsblock/mirror.c
- blockjob.c 3 additions, 0 deletionsblockjob.c
- include/sysemu/block-backend.h 1 addition, 0 deletionsinclude/sysemu/block-backend.h
- tests/test-bdrv-drain.c 1 addition, 0 deletionstests/test-bdrv-drain.c
Loading
Please register or sign in to comment