Skip to content

mirror: Handle errors after READY cancel

Hanna Reitz qemu-devel 2 versions – Applied

Status from this message: Thanks, applied to my jobs branch.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest13 patches 7 repliesApplied
  2. v412 patches 5 repliesApplied

Changes in v5 from the cover letter

- Added patch 7: When it was soft-cancelled, the mirror job clears .cancelled before leaving its main loop. The clear intention is to have the job be treated as having completed successfully (and this is also supported by the QMP documentation of block-job-cancel). It is however possible to cancel the job after it has left its main loop, before it can be unwound, and then the job would again be treated as cancelled. We don’t want that, so make a soft job-cancel a no-op when .deferred_to_main_loop is true.
(This fixes the test-replication failure.)

- Patch 8: Add a comment in job_cancel() that job_cancel_requested() and job_is_cancelled() are equivalent here, but why we want to inquire job_is_cancelled() instead of job_cancel_requested().

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/13job: Context changes in job_completed_txn_abort()job.c+17 -50 replies
2/13mirror: Keep s->synced on errorblock/mirror.c+0 -10 replies
3/13mirror: Drop s->syncedblock/mirror.c+9 -100 replies
4/13job: Force-cancel jobs in a failed transactionjob.c+6 -10 replies
5/13job: @force parameter for job_cancel_sync()block/replication.c blockdev.c include/qemu/job.h +4 more+50 -502 replies
6/13jobs: Give Job.force_cancel more meaningblock/backup.c block/mirror.c include/qemu/job.h +1 more+35 -90 replies
7/13job: Do not soft-cancel after a job is donejob.c+21 -42 replies
8/13job: Add job_cancel_requested()block/mirror.c include/qemu/job.h job.c+23 -92 replies
9/13mirror: Use job_is_cancelled()block/mirror.c+1 -10 replies
10/13mirror: Check job_is_cancelled() earlierblock/mirror.c+5 -50 replies
11/13mirror: Stop active mirroring after force-cancelblock/mirror.c+2 -00 replies
12/13mirror: Do not clear .cancelledblock/mirror.c job.c+3 -30 replies
13/13iotests: Add mirror-ready-cancel-error testtests/qemu-iotests/tests/mirror-ready-cancel-error tests/qemu-iotests/tests/mirror-ready-cancel-error.out+148 -00 replies

Reviews trailers per patch

All 13 patches have a Reviewed-by or Acked-by.

PatchVladimir Sementsov-OgievskiyKevin WolfEric Blake
1/13R-b
2/13R-b R-b
3/13R-b R-b R-b
4/13R-b R-b
5/13R-b R-b
6/13R-b R-b R-b
7/13R-b R-b
8/13R-b R-b
9/13R-b R-b
10/13R-b R-b
11/13R-b R-b
12/13R-b R-b
13/13R-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v5 thread

Cover letter [PATCH v5 00/13] mirror: Handle errors after READY cancel

Hi,

v1 cover letter:
https://lists.nongnu.org/archive/html/qemu-block/2021-07/msg00705.html

v2 cover letter:
https://lists.nongnu.org/archive/html/qemu-block/2021-07/msg00747.html

v3 cover letter:
https://lists.nongnu.org/archive/html/qemu-block/2021-08/msg00127.html

v4 cover letter:
https://lists.nongnu.org/archive/html/qemu-block/2021-09/msg00314.html

Changes in v5:
- Added patch 7: When it was soft-cancelled, the mirror job clears .cancelled before leaving its main loop. The clear intention is to have the job be treated as having completed successfully (and this is also supported by the QMP documentation of block-job-cancel). It is however possible to cancel the job after it has left its main loop, before it can be unwound, and then the job would again be treated as cancelled. We don’t want that, so make a soft job-cancel a no-op when .deferred_to_main_loop is true.
(This fixes the test-replication failure.)

- Patch 8: Add a comment in job_cancel() that job_cancel_requested() and job_is_cancelled() are equivalent here, but why we want to inquire job_is_cancelled() instead of job_cancel_requested().

git-backport-diff against v4:

Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch [down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

001/13:[----] [--] 'job: Context changes in job_completed_txn_abort()' 002/13:[----] [--] 'mirror: Keep s->synced on error' 003/13:[----] [--] 'mirror: Drop s->synced'
004/13:[----] [--] 'job: Force-cancel jobs in a failed transaction' 005/13:[----] [--] 'job: @force parameter for job_cancel_sync()' 006/13:[----] [--] 'jobs: Give Job.force_cancel more meaning' 007/13:[down] 'job: Do not soft-cancel after a job is done' 008/13:[0005] [FC] 'job: Add job_cancel_requested()' 009/13:[----] [--] 'mirror: Use job_is_cancelled()' 010/13:[----] [--] 'mirror: Check job_is_cancelled() earlier' 011/13:[----] [--] 'mirror: Stop active mirroring after force-cancel' 012/13:[----] [--] 'mirror: Do not clear .cancelled' 013/13:[----] [--] 'iotests: Add mirror-ready-cancel-error test'

Hanna Reitz (13):
job: Context changes in job_completed_txn_abort()
mirror: Keep s->synced on error
mirror: Drop s->synced
job: Force-cancel jobs in a failed transaction
job: @force parameter for job_cancel_sync()
jobs: Give Job.force_cancel more meaning
job: Do not soft-cancel after a job is done
job: Add job_cancel_requested()
mirror: Use job_is_cancelled()
mirror: Check job_is_cancelled() earlier
mirror: Stop active mirroring after force-cancel
mirror: Do not clear .cancelled
iotests: Add mirror-ready-cancel-error test

 include/qemu/job.h                            |  29 +++-
 block/backup.c                                |   3 +-
 block/mirror.c                                |  56 ++++---
 block/replication.c                           |   4 +-
 blockdev.c                                    |   4 +-
 job.c                                         |  94 ++++++++++--
 tests/unit/test-blockjob.c                    |   2 +-
 tests/qemu-iotests/109.out                    |  60 +++-----
 .../tests/mirror-ready-cancel-error           | 143 ++++++++++++++++++
 .../tests/mirror-ready-cancel-error.out       |   5 +
 tests/qemu-iotests/tests/qsd-jobs.out         |   2 +-
 11 files changed, 312 insertions(+), 90 deletions(-)
 create mode 100755 tests/qemu-iotests/tests/mirror-ready-cancel-error
 create mode 100644 tests/qemu-iotests/tests/mirror-ready-cancel-error.out
Signature · 1 line
2.31.1