]> git.proxmox.com Git - mirror_qemu.git/commit - block/mirror.c
mirror: Check job_is_cancelled() earlier
authorHanna Reitz <hreitz@redhat.com>
Wed, 6 Oct 2021 15:19:37 +0000 (17:19 +0200)
committerVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Thu, 7 Oct 2021 08:42:50 +0000 (10:42 +0200)
commit4feeec7e23b4151c962cb1b9f1a0e403803dfaee
treee8bcf7cc8fd87263956c4988356ca1bb5808206d
parent20ad4d204accb27346b05b046ee8225c6725ef49
mirror: Check job_is_cancelled() earlier

We must check whether the job is force-cancelled early in our main loop,
most importantly before any `continue` statement.  For example, we used
to have `continue`s before our current checking location that are
triggered by `mirror_flush()` failing.  So, if `mirror_flush()` kept
failing, force-cancelling the job would not terminate it.

Jobs can be cancelled while they yield, and once they are
(force-cancelled), they should not generate new I/O requests.
Therefore, we should put the check after the last yield before
mirror_iteration() is invoked.

Buglink: https://gitlab.com/qemu-project/qemu/-/issues/462
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20211006151940.214590-11-hreitz@redhat.com>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
block/mirror.c