Skip to content

Commit

Permalink
Merge remote-tracking branch 'jtc/tags/block-pull-request' into staging
Browse files Browse the repository at this point in the history
# gpg: Signature made Fri 26 May 2017 08:22:27 PM BST
# gpg:                using RSA key 0xBDBE7B27C0DE3057
# gpg: Good signature from "Jeffrey Cody <[email protected]>"
# gpg:                 aka "Jeffrey Cody <[email protected]>"
# gpg:                 aka "Jeffrey Cody <[email protected]>"
# Primary key fingerprint: 9957 4B4D 3474 90E7 9D98  D624 BDBE 7B27 C0DE 3057

* jtc/tags/block-pull-request:
  block/gluster: glfs_lseek() workaround
  blockjob: use deferred_to_main_loop to indicate the coroutine has ended
  blockjob: reorganize block_job_completed_txn_abort
  blockjob: strengthen a bit test-blockjob-txn
  blockjob: group BlockJob transaction functions together
  blockjob: introduce block_job_cancel_async, check iostatus invariants
  blockjob: move iostatus reset inside block_job_user_resume
  blockjob: separate monitor and blockjob APIs
  blockjob: introduce block_job_pause/resume_all
  blockjob: introduce block_job_early_fail
  blockjob: remove iostatus_reset callback
  blockjob: remove unnecessary check

Signed-off-by: Stefan Hajnoczi <[email protected]>
  • Loading branch information
stefanhaRH committed May 30, 2017
2 parents 5bb0d22 + 223a23c commit 7b6badb
Show file tree
Hide file tree
Showing 11 changed files with 538 additions and 466 deletions.
2 changes: 1 addition & 1 deletion block/backup.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
}
if (job) {
backup_clean(&job->common);
block_job_unref(&job->common);
block_job_early_fail(&job->common);
}

return NULL;
Expand Down
2 changes: 1 addition & 1 deletion block/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ void commit_start(const char *job_id, BlockDriverState *bs,
if (commit_top_bs) {
bdrv_set_backing_hd(overlay_bs, top, &error_abort);
}
block_job_unref(&s->common);
block_job_early_fail(&s->common);
}


Expand Down
18 changes: 16 additions & 2 deletions block/gluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,14 @@ static int find_allocation(BlockDriverState *bs, off_t start,
if (offs < 0) {
return -errno; /* D3 or D4 */
}
assert(offs >= start);

if (offs < start) {
/* This is not a valid return by lseek(). We are safe to just return
* -EIO in this case, and we'll treat it like D4. Unfortunately some
* versions of gluster server will return offs < start, so an assert
* here will unnecessarily abort QEMU. */
return -EIO;
}

if (offs > start) {
/* D2: in hole, next data at offs */
Expand Down Expand Up @@ -1307,7 +1314,14 @@ static int find_allocation(BlockDriverState *bs, off_t start,
if (offs < 0) {
return -errno; /* D1 and (H3 or H4) */
}
assert(offs >= start);

if (offs < start) {
/* This is not a valid return by lseek(). We are safe to just return
* -EIO in this case, and we'll treat it like H4. Unfortunately some
* versions of gluster server will return offs < start, so an assert
* here will unnecessarily abort QEMU. */
return -EIO;
}

if (offs > start) {
/*
Expand Down
19 changes: 3 additions & 16 deletions block/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "trace.h"
#include "sysemu/block-backend.h"
#include "block/blockjob.h"
#include "block/blockjob_int.h"
#include "block/block_int.h"
#include "qemu/cutils.h"
#include "qapi/error.h"
Expand Down Expand Up @@ -301,16 +302,9 @@ void bdrv_drain_all_begin(void)
bool waited = true;
BlockDriverState *bs;
BdrvNextIterator it;
BlockJob *job = NULL;
GSList *aio_ctxs = NULL, *ctx;

while ((job = block_job_next(job))) {
AioContext *aio_context = blk_get_aio_context(job->blk);

aio_context_acquire(aio_context);
block_job_pause(job);
aio_context_release(aio_context);
}
block_job_pause_all();

for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
AioContext *aio_context = bdrv_get_aio_context(bs);
Expand Down Expand Up @@ -354,7 +348,6 @@ void bdrv_drain_all_end(void)
{
BlockDriverState *bs;
BdrvNextIterator it;
BlockJob *job = NULL;

for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
AioContext *aio_context = bdrv_get_aio_context(bs);
Expand All @@ -365,13 +358,7 @@ void bdrv_drain_all_end(void)
aio_context_release(aio_context);
}

while ((job = block_job_next(job))) {
AioContext *aio_context = blk_get_aio_context(job->blk);

aio_context_acquire(aio_context);
block_job_resume(job);
aio_context_release(aio_context);
}
block_job_resume_all();
}

void bdrv_drain_all(void)
Expand Down
2 changes: 1 addition & 1 deletion block/mirror.c
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ static void mirror_start_job(const char *job_id, BlockDriverState *bs,

g_free(s->replaces);
blk_unref(s->target);
block_job_unref(&s->common);
block_job_early_fail(&s->common);
}

bdrv_child_try_set_perm(mirror_top_bs->backing, 0, BLK_PERM_ALL,
Expand Down
1 change: 0 additions & 1 deletion blockdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -3715,7 +3715,6 @@ void qmp_block_job_resume(const char *device, Error **errp)
}

trace_qmp_block_job_resume(job);
block_job_iostatus_reset(job);
block_job_user_resume(job);
aio_context_release(aio_context);
}
Expand Down
Loading

0 comments on commit 7b6badb

Please sign in to comment.