Skip to content

job: Allow complete for jobs on standby

Max Reitz qemu-devel 1 version Applied

Status from this message: Thanks, applied patches 1-4 to the block branch.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 2 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/4mirror: Move open_backing_file to exit_commonblock/mirror.c+8 -140 replies
2/4mirror: Do not enter a paused job on completionblock/mirror.c+5 -10 replies
3/4job: Allow complete for jobs on standbyjob.c+2 -20 replies
4/4test-blockjob: Test job_wait_unpaused()tests/unit/test-blockjob.c+121 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] job: Allow complete for jobs on standby

Hi,

We sometimes have a problem with jobs remaining on STANDBY after a drain (for a short duration), so if the user immediately issues a block-job-complete, that will fail.

(See also
https://lists.nongnu.org/archive/html/qemu-block/2021-04/msg00215.html,
which this series is an alternative for.)

Looking at the only implementation of .complete(), which is mirror_complete(), it looks like there is basically nothing that would prevent it from being run while mirror is paused. Really only the job_enter() at the end, which we should not and need not do when the job is paused.

So make that conditional (patch 2), clean up the function on the way (patch 1, which moves one of its blocks to mirror_exit_common()), and then we can allow job_complete() on jobs that are on standby (patch 3).

Patch 4 is basically the same test as in
https://lists.nongnu.org/archive/html/qemu-block/2021-04/msg00214.html,
except some comments are different and, well, job_complete() just works on STANDBY jobs.

Patch 5 is an iotest that may or may not show the problem for you. I’ve tuned the numbers so that on my machine, it fails about 50/50 without this series (i.e., the job is still on STANDBY and job_complete() refuses to do anything).

I’m not sure we want that iotest, because it does quite a bit of I/O and it’s unreliable, and I don’t think there’s anything I can do to make it reliable.

Max Reitz (5):
mirror: Move open_backing_file to exit_common
mirror: Do not enter a paused job on completion
job: Allow complete for jobs on standby
test-blockjob: Test job_wait_unpaused()
iotests: Test completion immediately after drain

 block/mirror.c                                |  28 ++--
 job.c                                         |   4 +-
 tests/unit/test-blockjob.c                    | 121 ++++++++++++++++++
 .../tests/mirror-complete-after-drain         |  89 +++++++++++++
 .../tests/mirror-complete-after-drain.out     |  14 ++
 5 files changed, 239 insertions(+), 17 deletions(-)
 create mode 100755 tests/qemu-iotests/tests/mirror-complete-after-drain
 create mode 100644 tests/qemu-iotests/tests/mirror-complete-after-drain.out
Signature · 1 line
2.29.2