25.03.2020 18:50, Stefan Reiter wrote:
backup_clean is only ever called as a handler via job_exit, which
Hmm.. I'm afraid it's not quite correct.
job_completed_txn_abort (lock aio context)
Hmm. job_do_finalize calls job_completed_txn_abort, which cares to lock aio
And on the same time, it directaly calls job_txn_apply(job->txn,
without locking. Is it a bug?
And, even if job_do_finalize called always with locked context, where is
guarantee that all
context of all jobs in txn are locked?
Still, let's look through its callers.
qmp_block_job_finalize (lock aio context)
qmp_job_finalize (lock aio context)
test_cancel_concluded (doesn't lock, but it's a test)
job_exit (lock aio context)
blockdev_mark_auto_del (lock aio context)
qmp_block_job_cancel (locks context)
qmp_job_cancel (locks context)
job_cancel_sync (return job_finish_sync(job,
&job_cancel_err, NULL);, job_finish_sync just calls callback)
replication_close (it's .bdrv_close.. Hmm, I
don't see context locking, where is it ?)
replication_stop (locks context)
drive_backup_abort (locks context)
blockdev_backup_abort (locks context)
job_cancel_sync_all (locks context)
cancel_common (locks context)
test_* (I don't care)
already acquires the job's context. The job's context is guaranteed to
be the same as the one used by backup_top via backup_job_create.
Since the previous logic effectively acquired the lock twice, this
broke cleanup of backups for disks using IO threads, since the BDRV_POLL_WHILE
in bdrv_backup_top_drop -> bdrv_do_drained_begin would only release the lock
once, thus deadlocking with the IO thread.
Signed-off-by: Stefan Reiter <s.rei...@proxmox.com>
Just note, that this thing were recently touched by 0abf2581717a19 , so add
Sergio (its author) to CC.
This is a fix for the issue discussed in this part of the thread:
...not the original problem (core dump) posted by Dietmar.
I've still seen it occasionally hang during a backup abort. I'm trying to figure
out why that happens, stack trace indicates a similar problem with the main
thread hanging at bdrv_do_drained_begin, though I have no clue why as of yet.
block/backup.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/block/backup.c b/block/backup.c
index 7430ca5883..a7a7dcaf4c 100644
@@ -126,11 +126,7 @@ static void backup_abort(Job *job)
static void backup_clean(Job *job)
BackupBlockJob *s = container_of(job, BackupBlockJob, common.job);
- AioContext *aio_context = bdrv_get_aio_context(s->backup_top);
void backup_do_checkpoint(BlockJob *job, Error **errp)