[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 30/39] block: Prevent sleeping jobs from resuming if
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 30/39] block: Prevent sleeping jobs from resuming if they have been paused |
Date: |
Thu, 16 Jun 2016 16:08:19 +0200 |
From: Alberto Garcia <address@hidden>
If we pause a block job and drain its BlockDriverState we want that
the job remains inactive until we call block_job_resume() again.
However if we pause the job while it is sleeping then it will resume
when the sleep timer fires.
This patch prevents that from happening by checking if the job has
been paused after it comes back from sleeping.
Signed-off-by: Alberto Garcia <address@hidden>
Suggested-by: Kevin Wolf <address@hidden>
Message-id: address@hidden
Reviewed-by: Max Reitz <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
blockjob.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/blockjob.c b/blockjob.c
index c095cc5..01b896b 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -361,10 +361,12 @@ void block_job_sleep_ns(BlockJob *job, QEMUClockType
type, int64_t ns)
}
job->busy = false;
+ if (!block_job_is_paused(job)) {
+ co_aio_sleep_ns(blk_get_aio_context(job->blk), type, ns);
+ }
+ /* The job can be paused while sleeping, so check this again */
if (block_job_is_paused(job)) {
qemu_coroutine_yield();
- } else {
- co_aio_sleep_ns(blk_get_aio_context(job->blk), type, ns);
}
job->busy = true;
}
--
1.8.3.1
- [Qemu-block] [PULL 19/39] linux-aio: Cancel BH if not needed, (continued)
- [Qemu-block] [PULL 19/39] linux-aio: Cancel BH if not needed, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 21/39] block: Introduce bdrv_preadv(), Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 17/39] raw-posix: Implement .bdrv_co_preadv/pwritev, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 15/39] block: Prepare bdrv_aligned_pwritev() for byte-aligned requests, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 10/39] block: Avoid bogus flags during mirroring, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 11/39] block: Assert that flags are in range, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 20/39] doc: Fix mailing list address in tests/qemu-iotests/README, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 24/39] block: Make bdrv_load/save_vmstate coroutine_fns, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 18/39] block: Don't enforce 512 byte minimum alignment, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 29/39] block: use the block job list in qmp_query_block_jobs(), Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 30/39] block: Prevent sleeping jobs from resuming if they have been paused,
Kevin Wolf <=
- [Qemu-block] [PULL 27/39] block: Fix snapshot=on with aio=native, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 25/39] qcow2: Let vmstate call qcow2_co_preadv/pwrite directly, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 22/39] block: Make .bdrv_load_vmstate() vectored, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 28/39] block: use the block job list in bdrv_drain_all(), Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 32/39] iotests: 095: Clean up QEMU before showing image info, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 31/39] block: Create the commit block job before reopening any image, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 26/39] block: Remove bs->zero_beyond_eof, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 38/39] iotests: Add test for oVirt-like storage migration, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 37/39] iotests: Add test for post-mirror backing chains, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 33/39] rbd:change error_setg() to error_setg_errno(), Kevin Wolf, 2016/06/16