Skip to contentSkip to conversation

storage-daemon: Call job_cancel_sync_all() on shutdown

PATCH In review Kevin Wolf 2 participants 2 messages Mar 9, 2021

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 storage-daemon: Call job_cancel_sync_all() on shutdown

bdrv_close_all() asserts that no jobs are running any more, so we need to cancel all jobs first to avoid failing the assertion.

Fixes b55a3c8860b763b62b2cc2f4a6f55379977bbde5
---
 storage-daemon/qemu-storage-daemon.c  |  1 +
 tests/qemu-iotests/tests/qsd-jobs     | 66 +++++++++++++++++++++++++++
 tests/qemu-iotests/tests/qsd-jobs.out | 22 +++++++++
 3 files changed, 89 insertions(+)
 create mode 100755 tests/qemu-iotests/tests/qsd-jobs
 create mode 100644 tests/qemu-iotests/tests/qsd-jobs.out
storage-daemon/qemu-storage-daemon.c +1 -0
index 23756fc8e5..a39a22386a 100644
@@ -368,6 +368,7 @@ int main(int argc, char *argv[])
 
     blk_exp_close_all();
     bdrv_drain_all_begin();
+    job_cancel_sync_all();
     bdrv_close_all();
 
     monitor_cleanup();
tests/qemu-iotests/tests/qsd-jobs new file +66 -0

66 lines not on this page · raw message

tests/qemu-iotests/tests/qsd-jobs.out new file +22 -0
new file mode 100644
index 0000000000..e3a684b34d
@@ -0,0 +1,22 @@
+QA output created by qsd-jobs
+Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=134217728
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=IMGFMT
+
+=== Job still present at shutdown ===
+
+QMP_VERSION
+{"return": {}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}}
+{"return": {}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "ready", "id": "job0"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "job0", "len": 0, "offset": 0, "speed": 0, "type": "commit"}}
+{"return": {}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "standby", "id": "job0"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "ready", "id": "job0"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "job0"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "job0"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "job0", "len": 0, "offset": 0, "speed": 0, "type": "commit"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "job0"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "job0"}}
+*** done
Signature · 1 line
2.29.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Kevin Wolf

bdrv_close_all() asserts that no jobs are running any more, so we need to cancel all jobs first to avoid failing the assertion.

Fixes b55a3c8860b763b62b2cc2f4a6f55379977bbde5
Quoted 7 lines
---
 storage-daemon/qemu-storage-daemon.c  |  1 +
 tests/qemu-iotests/tests/qsd-jobs     | 66 +++++++++++++++++++++++++++
 tests/qemu-iotests/tests/qsd-jobs.out | 22 +++++++++
 3 files changed, 89 insertions(+)
 create mode 100755 tests/qemu-iotests/tests/qsd-jobs
 create mode 100644 tests/qemu-iotests/tests/qsd-jobs.out
Quoted 1 line

+++ b/tests/qemu-iotests/tests/qsd-jobs

Yay for nicer iotest names ;)

tests/qemu-iotests/tests/qsd-jobs line 26

Quoted 2 lines
tests/qemu-iotests/tests/qsd-jobs new file +2 -0
+seq="$(basename $0)"
+echo "QA output created by $seq"

$seq is a bit of a misnomer, now, but such is life.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org