mirror: Don't call job_pause_point() under graph lock
commitae5a40e8581185654a667fbbf7e4adbc2a2a3e45
authorKevin Wolf <kwolf@redhat.com>
Wed, 13 Mar 2024 15:30:00 +0000 (13 16:30 +0100)
committerKevin Wolf <kwolf@redhat.com>
Mon, 18 Mar 2024 11:03:04 +0000 (18 12:03 +0100)
tree7f5df243c08ffc301ccb3a12b276e04617c6b624
parentba49d760eb04630e7b15f423ebecf6c871b8f77b
mirror: Don't call job_pause_point() under graph lock

Calling job_pause_point() while holding the graph reader lock
potentially results in a deadlock: bdrv_graph_wrlock() first drains
everything, including the mirror job, which pauses it. The job is only
unpaused at the end of the drain section, which is when the graph writer
lock has been successfully taken. However, if the job happens to be
paused at a pause point where it still holds the reader lock, the writer
lock can't be taken as long as the job is still paused.

Mark job_pause_point() as GRAPH_UNLOCKED and fix mirror accordingly.

Cc: qemu-stable@nongnu.org
Buglink: https://issues.redhat.com/browse/RHEL-28125
Fixes: 004915a96a7a ("block: Protect bs->backing with graph_lock")
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20240313153000.33121-1-kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/mirror.c
include/qemu/job.h