qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-6.2 v3 00/12] mirror: Handle errors after READY cancel
@ 2021-08-06  9:38 Max Reitz
  2021-08-06  9:38 ` [PATCH for-6.2 v3 01/12] job: Context changes in job_completed_txn_abort() Max Reitz
                   ` (11 more replies)
  0 siblings, 12 replies; 35+ messages in thread
From: Max Reitz @ 2021-08-06  9:38 UTC (permalink / raw)
  To: qemu-block
  Cc: Kevin Wolf, Vladimir Sementsov-Ogievskiy, qemu-devel, Max Reitz

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

-- 
2.31.1



^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2021-09-01 12:59 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-06  9:38 [PATCH for-6.2 v3 00/12] mirror: Handle errors after READY cancel Max Reitz
2021-08-06  9:38 ` [PATCH for-6.2 v3 01/12] job: Context changes in job_completed_txn_abort() Max Reitz
2021-08-06 19:16   ` Eric Blake
2021-08-09 10:04     ` Max Reitz
2021-09-01 10:05   ` Vladimir Sementsov-Ogievskiy
2021-09-01 12:47     ` Hanna Reitz
2021-08-06  9:38 ` [PATCH for-6.2 v3 02/12] mirror: Keep s->synced on error Max Reitz
2021-08-06  9:38 ` [PATCH for-6.2 v3 03/12] mirror: Drop s->synced Max Reitz
2021-08-06  9:38 ` [PATCH for-6.2 v3 04/12] job: Force-cancel jobs in a failed transaction Max Reitz
2021-08-06 19:22   ` Eric Blake
2021-09-01 10:08   ` Vladimir Sementsov-Ogievskiy
2021-08-06  9:38 ` [PATCH for-6.2 v3 05/12] job: @force parameter for job_cancel_sync{, _all}() Max Reitz
2021-08-06 19:39   ` Eric Blake
2021-08-09 10:09     ` Max Reitz
2021-09-01 10:20   ` [PATCH for-6.2 v3 05/12] job: @force parameter for job_cancel_sync{,_all}() Vladimir Sementsov-Ogievskiy
2021-09-01 12:49     ` Hanna Reitz
2021-09-01 11:04   ` Vladimir Sementsov-Ogievskiy
2021-09-01 12:50     ` Hanna Reitz
2021-08-06  9:38 ` [PATCH for-6.2 v3 06/12] jobs: Give Job.force_cancel more meaning Max Reitz
2021-08-06  9:38 ` [PATCH for-6.2 v3 07/12] job: Add job_cancel_requested() Max Reitz
2021-08-06 20:34   ` Eric Blake
2021-09-01 11:44   ` Vladimir Sementsov-Ogievskiy
2021-08-06  9:38 ` [PATCH for-6.2 v3 08/12] mirror: Use job_is_cancelled() Max Reitz
2021-08-06 20:35   ` Eric Blake
2021-09-01 11:45   ` Vladimir Sementsov-Ogievskiy
2021-08-06  9:38 ` [PATCH for-6.2 v3 09/12] mirror: Check job_is_cancelled() earlier Max Reitz
2021-08-06 20:36   ` Eric Blake
2021-09-01 12:11   ` Vladimir Sementsov-Ogievskiy
2021-08-06  9:38 ` [PATCH for-6.2 v3 10/12] mirror: Stop active mirroring after force-cancel Max Reitz
2021-08-06 20:37   ` Eric Blake
2021-09-01 12:16   ` Vladimir Sementsov-Ogievskiy
2021-08-06  9:38 ` [PATCH for-6.2 v3 11/12] mirror: Do not clear .cancelled Max Reitz
2021-08-06 20:42   ` Eric Blake
2021-09-01 12:22   ` Vladimir Sementsov-Ogievskiy
2021-08-06  9:38 ` [PATCH for-6.2 v3 12/12] iotests: Add mirror-ready-cancel-error test Max Reitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).