On Tue, Jul 05, 2022 at 04:22:41PM +0300, Vladimir Sementsov-Ogievskiy wrote: > On 7/5/22 16:01, Emanuele Giuseppe Esposito wrote: > > > > > > Am 05/07/2022 um 10:17 schrieb Emanuele Giuseppe Esposito: > > > > > > > > > Am 05/07/2022 um 10:14 schrieb Stefan Hajnoczi: > > > > On Wed, Jun 29, 2022 at 10:15:31AM -0400, Emanuele Giuseppe Esposito > > > > wrote: > > > > > diff --git a/blockdev.c b/blockdev.c > > > > > index 71f793c4ab..5b79093155 100644 > > > > > --- a/blockdev.c > > > > > +++ b/blockdev.c > > > > > @@ -150,12 +150,15 @@ void blockdev_mark_auto_del(BlockBackend *blk) > > > > > return; > > > > > } > > > > > - for (job = block_job_next(NULL); job; job = block_job_next(job)) > > > > > { > > > > > + JOB_LOCK_GUARD(); > > > > > + > > > > > + for (job = block_job_next_locked(NULL); job; > > > > > + job = block_job_next_locked(job)) { > > > > > if (block_job_has_bdrv(job, blk_bs(blk))) { > > > > > AioContext *aio_context = job->job.aio_context; > > > > > aio_context_acquire(aio_context); > > > > > > > > Is there a lock ordering rule for job_mutex and the AioContext lock? I > > > > haven't audited the code, but there might be ABBA lock ordering issues. > > > > > > Doesn't really matter here, as lock is nop. To be honest I forgot which > > > one should go first, probably job_lock because the aiocontext lock can > > > be taken and released in callbacks. > > > > > > Should I resend with ordering fixed? Just to have a consistent logic > > > > Well actually how do I fix that? I would just add useless additional > > changes into the diff, because for example in the case below I am not > > even sure what exactly is the aiocontext protecting. > > > > So I guess I'll leave as it is. I will just update the commit message to > > make sure it is clear that the lock is nop and ordering is mixed. > > > > Yes, I think it's OK. > > As far as I understand, our final ordering rule is that job_mutex can be > taken under aio context lock but not visa-versa.
I'm also fine with resolving the ordering in a later patch. Stefan
signature.asc
Description: PGP signature