commit.c (0db832f42e445398b2815cd740e9cd915e7dd644) | commit.c (12fa4af61fb2a08b156134c3b6717534c637c995) |
---|---|
1/* 2 * Live block commit 3 * 4 * Copyright Red Hat, Inc. 2012 5 * 6 * Authors: 7 * Jeff Cody <jcody@redhat.com> 8 * Based on stream.c by Stefan Hajnoczi --- 107 unchanged lines hidden (view full) --- 116 blk_unref(s->top); 117 block_job_completed(&s->common, ret); 118 g_free(data); 119 120 /* If bdrv_drop_intermediate() didn't already do that, remove the commit 121 * filter driver from the backing chain. Do this as the final step so that 122 * the 'consistent read' permission can be granted. */ 123 if (remove_commit_top_bs) { | 1/* 2 * Live block commit 3 * 4 * Copyright Red Hat, Inc. 2012 5 * 6 * Authors: 7 * Jeff Cody <jcody@redhat.com> 8 * Based on stream.c by Stefan Hajnoczi --- 107 unchanged lines hidden (view full) --- 116 blk_unref(s->top); 117 block_job_completed(&s->common, ret); 118 g_free(data); 119 120 /* If bdrv_drop_intermediate() didn't already do that, remove the commit 121 * filter driver from the backing chain. Do this as the final step so that 122 * the 'consistent read' permission can be granted. */ 123 if (remove_commit_top_bs) { |
124 bdrv_set_backing_hd(overlay_bs, top); | 124 bdrv_set_backing_hd(overlay_bs, top, &error_abort); |
125 } 126} 127 128static void coroutine_fn commit_run(void *opaque) 129{ 130 CommitBlockJob *s = opaque; 131 CommitCompleteData *data; 132 int64_t sector_num, end; --- 178 unchanged lines hidden (view full) --- 311 /* Insert commit_top block node above top, so we can block consistent read 312 * on the backing chain below it */ 313 commit_top_bs = bdrv_new_open_driver(&bdrv_commit_top, filter_node_name, 0, 314 errp); 315 if (commit_top_bs == NULL) { 316 goto fail; 317 } 318 | 125 } 126} 127 128static void coroutine_fn commit_run(void *opaque) 129{ 130 CommitBlockJob *s = opaque; 131 CommitCompleteData *data; 132 int64_t sector_num, end; --- 178 unchanged lines hidden (view full) --- 311 /* Insert commit_top block node above top, so we can block consistent read 312 * on the backing chain below it */ 313 commit_top_bs = bdrv_new_open_driver(&bdrv_commit_top, filter_node_name, 0, 314 errp); 315 if (commit_top_bs == NULL) { 316 goto fail; 317 } 318 |
319 bdrv_set_backing_hd(commit_top_bs, top); 320 bdrv_set_backing_hd(overlay_bs, commit_top_bs); | 319 bdrv_set_backing_hd(commit_top_bs, top, &error_abort); 320 bdrv_set_backing_hd(overlay_bs, commit_top_bs, &error_abort); |
321 322 s->commit_top_bs = commit_top_bs; 323 bdrv_unref(commit_top_bs); 324 325 /* Block all nodes between top and base, because they will 326 * disappear from the chain after this operation. */ 327 assert(bdrv_chain_contains(top, base)); 328 for (iter = top; iter != base; iter = backing_bs(iter)) { --- 56 unchanged lines hidden (view full) --- 385fail: 386 if (s->base) { 387 blk_unref(s->base); 388 } 389 if (s->top) { 390 blk_unref(s->top); 391 } 392 if (commit_top_bs) { | 321 322 s->commit_top_bs = commit_top_bs; 323 bdrv_unref(commit_top_bs); 324 325 /* Block all nodes between top and base, because they will 326 * disappear from the chain after this operation. */ 327 assert(bdrv_chain_contains(top, base)); 328 for (iter = top; iter != base; iter = backing_bs(iter)) { --- 56 unchanged lines hidden (view full) --- 385fail: 386 if (s->base) { 387 blk_unref(s->base); 388 } 389 if (s->top) { 390 blk_unref(s->top); 391 } 392 if (commit_top_bs) { |
393 bdrv_set_backing_hd(overlay_bs, top); | 393 bdrv_set_backing_hd(overlay_bs, top, &error_abort); |
394 } 395 block_job_unref(&s->common); 396} 397 398 399#define COMMIT_BUF_SECTORS 2048 400 401/* commit COW file into the raw image */ --- 44 unchanged lines hidden (view full) --- 446 447 commit_top_bs = bdrv_new_open_driver(&bdrv_commit_top, NULL, BDRV_O_RDWR, 448 &local_err); 449 if (commit_top_bs == NULL) { 450 error_report_err(local_err); 451 goto ro_cleanup; 452 } 453 | 394 } 395 block_job_unref(&s->common); 396} 397 398 399#define COMMIT_BUF_SECTORS 2048 400 401/* commit COW file into the raw image */ --- 44 unchanged lines hidden (view full) --- 446 447 commit_top_bs = bdrv_new_open_driver(&bdrv_commit_top, NULL, BDRV_O_RDWR, 448 &local_err); 449 if (commit_top_bs == NULL) { 450 error_report_err(local_err); 451 goto ro_cleanup; 452 } 453 |
454 bdrv_set_backing_hd(commit_top_bs, backing_file_bs); 455 bdrv_set_backing_hd(bs, commit_top_bs); | 454 bdrv_set_backing_hd(commit_top_bs, backing_file_bs, &error_abort); 455 bdrv_set_backing_hd(bs, commit_top_bs, &error_abort); |
456 457 ret = blk_insert_bs(backing, backing_file_bs, &local_err); 458 if (ret < 0) { 459 error_report_err(local_err); 460 goto ro_cleanup; 461 } 462 463 length = blk_getlength(src); --- 63 unchanged lines hidden (view full) --- 527 blk_flush(backing); 528 529 ret = 0; 530ro_cleanup: 531 qemu_vfree(buf); 532 533 blk_unref(backing); 534 if (backing_file_bs) { | 456 457 ret = blk_insert_bs(backing, backing_file_bs, &local_err); 458 if (ret < 0) { 459 error_report_err(local_err); 460 goto ro_cleanup; 461 } 462 463 length = blk_getlength(src); --- 63 unchanged lines hidden (view full) --- 527 blk_flush(backing); 528 529 ret = 0; 530ro_cleanup: 531 qemu_vfree(buf); 532 533 blk_unref(backing); 534 if (backing_file_bs) { |
535 bdrv_set_backing_hd(bs, backing_file_bs); | 535 bdrv_set_backing_hd(bs, backing_file_bs, &error_abort); |
536 } 537 bdrv_unref(commit_top_bs); 538 blk_unref(src); 539 540 if (ro) { 541 /* ignoring error return here */ 542 bdrv_reopen(bs->backing->bs, open_flags & ~BDRV_O_RDWR, NULL); 543 } 544 545 return ret; 546} | 536 } 537 bdrv_unref(commit_top_bs); 538 blk_unref(src); 539 540 if (ro) { 541 /* ignoring error return here */ 542 bdrv_reopen(bs->backing->bs, open_flags & ~BDRV_O_RDWR, NULL); 543 } 544 545 return ret; 546} |