mirror: Handle errors after READY cancel
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest12 patches 22 repliesIn review
- v27 patches 23 repliesSuperseded
- v16 patches 9 repliesSuperseded
Changes in v3 from the cover letter
- Patch 1: After adding patch 11, I got a failed assertion in tests/unit/test-block-iothread (failing qemu_mutex_unlock_impl()). That is because before patch 11, for zero-length source devices, mirror clears .cancelled unconditionally before exiting. So even force-cancelled jobs are considered to be completed normally, which doesn’t seem quite right.
Anyway, test-block-iothread does some iothread switching, and cancelling jobs is not really prepared for that. This patch fixes that (I hope...).
- Patch 4: Split off from patch 5
- Patch 7:
- Added a long section in the commit message detailing every choice for every job_is_cancelled() invocation
- Use job_cancel_requested() in the assertion in job_completed_txn_abort(), because it is not quite clear whether soft-cancelled mirror jobs can end up in this path (it seems like a bug if that happens, but I think that’s something to fix in some other series)
- Patch 8: Added: This is kind of preparation for patch 9, but also just a bug fix in itself, I believe
- Patch 9: Moved the job_is_cancelled() check after the last yield point before the mirror_iteration() call
- Patch 10: Added: If force-cancelled jobs should not generate new I/O requests at all (except for forwarding something to the source device), then we need to stop doing active mirroring once the mirror job is force-cancelled
- Patch 11: Added: Clearing .cancelled seemed like a hack, so getting rid of it seems like a good thing to do
(And only with this patch, I can assert that .force_cancel can only be true when .cancelled is true also; if we tried it before this patch, tests/unit/test-block-iothread would fail.)
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/12 | job: Context changes in job_completed_txn_abort()job.c | +18 | 4 replies | |
| 2/12 | mirror: Keep s->synced on errorblock/ | +0 | 0 replies | |
| 3/12 | mirror: Drop s->syncedblock/ | +9 | 0 replies | |
| 4/12 | job: Force-cancel jobs in a failed transactionjob.c | +6 | 2 replies | |
| 5/12 | job: @force parameter for job_cancel_sync{, _all}()block/ blockdev.c include/ +8 more | +55 | 6 replies | |
| 6/12 | jobs: Give Job.force_cancel more meaningblock/ block/ include/ +1 more | +35 | 0 replies | |
| 7/12 | job: Add job_cancel_requested()block/ include/ job.c | +18 | 2 replies | |
| 8/12 | mirror: Use job_is_cancelled()block/ | +1 | 2 replies | |
| 9/12 | mirror: Check job_is_cancelled() earlierblock/ | +5 | 2 replies | |
| 10/12 | mirror: Stop active mirroring after force-cancelblock/ | +2 | 2 replies | |
| 11/12 | mirror: Do not clear .cancelledblock/ job.c | +3 | 2 replies | |
| 12/12 | iotests: Add mirror-ready-cancel-error testtests/ tests/ | +148 | 0 replies |
Reviews trailers per patch
All 12 patches have a Reviewed-by or Acked-by.
| Patch | Eric Blake | Vladimir Sementsov-Ogievskiy | Kevin Wolf |
|---|---|---|---|
| 1/12 | R-b | R-b | |
| 2/12 | R-b | R-b | |
| 3/12 | R-b | R-b | R-b |
| 4/12 | R-b | R-b | |
| 5/12 | R-b | R-b | |
| 6/12 | R-b | R-b | R-b |
| 7/12 | R-b | R-b | |
| 8/12 | R-b | R-b | |
| 9/12 | R-b | R-b | |
| 10/12 | R-b | R-b | |
| 11/12 | R-b | R-b | |
| 12/12 | R-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.
Cover letter [PATCH for-6.2 v3 00/12] 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
Changes in v3:
- Patch 1: After adding patch 11, I got a failed assertion in tests/unit/test-block-iothread (failing qemu_mutex_unlock_impl()). That is because before patch 11, for zero-length source devices, mirror clears .cancelled unconditionally before exiting. So even force-cancelled jobs are considered to be completed normally, which doesn’t seem quite right.
Anyway, test-block-iothread does some iothread switching, and cancelling jobs is not really prepared for that. This patch fixes that (I hope...).
- Patch 4: Split off from patch 5
- Patch 7:
- Added a long section in the commit message detailing every choice for every job_is_cancelled() invocation
- Use job_cancel_requested() in the assertion in job_completed_txn_abort(), because it is not quite clear whether soft-cancelled mirror jobs can end up in this path (it seems like a bug if that happens, but I think that’s something to fix in some other series)
- Patch 8: Added: This is kind of preparation for patch 9, but also just a bug fix in itself, I believe
- Patch 9: Moved the job_is_cancelled() check after the last yield point before the mirror_iteration() call
- Patch 10: Added: If force-cancelled jobs should not generate new I/O requests at all (except for forwarding something to the source device), then we need to stop doing active mirroring once the mirror job is force-cancelled
- Patch 11: Added: Clearing .cancelled seemed like a hack, so getting rid of it seems like a good thing to do
(And only with this patch, I can assert that .force_cancel can only be true when .cancelled is true also; if we tried it before this patch, tests/unit/test-block-iothread would fail.)
The discussion around v2 has shown that there are probably more bugs in the job code, but I think this series is becoming long enough that we should tackle those in a different series.
git-backport-diff against v1:
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/12:[down] 'job: Context changes in job_completed_txn_abort()' 002/12:[----] [--] 'mirror: Keep s->synced on error' 003/12:[----] [--] 'mirror: Drop s->synced'
004/12:[down] 'job: Force-cancel jobs in a failed transaction' 005/12:[0007] [FC] 'job: @force parameter for job_cancel_sync{,_all}()' 006/12:[----] [--] 'jobs: Give Job.force_cancel more meaning' 007/12:[0002] [FC] 'job: Add job_cancel_requested()' 008/12:[down] 'mirror: Use job_is_cancelled()'
009/12:[0007] [FC] 'mirror: Check job_is_cancelled() earlier' 010/12:[down] 'mirror: Stop active mirroring after force-cancel' 011/12:[down] 'mirror: Do not clear .cancelled' 012/12:[----] [--] 'iotests: Add mirror-ready-cancel-error test'
Max Reitz (12):
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{,_all}()
jobs: Give Job.force_cancel more meaning
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 | 67 ++++++-- qemu-nbd.c | 2 +- softmmu/runstate.c | 2 +- storage-daemon/qemu-storage-daemon.c | 2 +- tests/unit/test-block-iothread.c | 2 +- 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 +- 15 files changed, 292 insertions(+), 91 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