[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v12 02/19] block: Pause all jobs during bdrv_reo
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-block] [PATCH v12 02/19] block: Pause all jobs during bdrv_reopen_multiple() |
Date: |
Wed, 26 Oct 2016 16:36:12 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Am 26.10.2016 um 12:29 hat Alberto Garcia geschrieben:
> When a BlockDriverState is about to be reopened it can trigger certain
> operations that need to write to disk. During this process a different
> block job can be woken up. If that block job completes and also needs
> to call bdrv_reopen() it can happen that it needs to do it on the same
> BlockDriverState that is still in the process of being reopened.
>
> This can have fatal consequences, like in this example:
>
> 1) Block job A starts and sleeps after a while.
> 2) Block job B starts and tries to reopen node1 (a qcow2 file).
> 3) Reopening node1 means flushing and replacing its qcow2 cache.
> 4) While the qcow2 cache is being flushed, job A wakes up.
> 5) Job A completes and reopens node1, replacing its cache.
> 6) Job B resumes, but the cache that was being flushed no longer
> exists.
>
> This patch splits the bdrv_drain_all() call to keep all block jobs
> paused during bdrv_reopen_multiple(), so that step 4 can never happen
> and the operation is safe.
>
> Note that this scenario can only happen if both bdrv_reopen() calls
> are made by block jobs on the same backing chain. Otherwise there's no
> chance that the same BlockDriverState appears in both reopen queues.
>
> Signed-off-by: Alberto Garcia <address@hidden>
> Reviewed-by: Paolo Bonzini <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
- [Qemu-block] [PATCH v12 05/19] block: Use block_job_add_bdrv() in backup_start(), (continued)
- [Qemu-block] [PATCH v12 05/19] block: Use block_job_add_bdrv() in backup_start(), Alberto Garcia, 2016/10/26
- [Qemu-block] [PATCH v12 01/19] block: Add bdrv_drain_all_{begin, end}(), Alberto Garcia, 2016/10/26
- [Qemu-block] [PATCH v12 06/19] block: Check blockers in all nodes involved in a block-commit job, Alberto Garcia, 2016/10/26
- [Qemu-block] [PATCH v12 04/19] block: Use block_job_add_bdrv() in mirror_start_job(), Alberto Garcia, 2016/10/26
- [Qemu-block] [PATCH v12 07/19] block: Block all nodes involved in the block-commit operation, Alberto Garcia, 2016/10/26
- [Qemu-block] [PATCH v12 02/19] block: Pause all jobs during bdrv_reopen_multiple(), Alberto Garcia, 2016/10/26
- Re: [Qemu-block] [PATCH v12 02/19] block: Pause all jobs during bdrv_reopen_multiple(),
Kevin Wolf <=
- [Qemu-block] [PATCH v12 19/19] qemu-iotests: Test the 'base-node' parameter of 'block-stream', Alberto Garcia, 2016/10/26
- [Qemu-block] [PATCH v12 15/19] qemu-iotests: Test block-stream and block-commit in parallel, Alberto Garcia, 2016/10/26
- [Qemu-block] [PATCH v12 12/19] qemu-iotests: Test streaming to an intermediate layer, Alberto Garcia, 2016/10/26
- [Qemu-block] [PATCH v12 16/19] qemu-iotests: Add iotests.supports_quorum(), Alberto Garcia, 2016/10/26
- [Qemu-block] [PATCH v12 17/19] qemu-iotests: Test streaming to a Quorum child, Alberto Garcia, 2016/10/26