qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v9 15/21] job.c: enable job lock/unlock and remove Aiocontext


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [PATCH v9 15/21] job.c: enable job lock/unlock and remove Aiocontext locks
Date: Mon, 11 Jul 2022 17:33:55 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1

On 7/6/22 23:15, Emanuele Giuseppe Esposito wrote:
Change the job_{lock/unlock} and macros to use job_mutex.

Now that they are not nop anymore, remove the aiocontext
to avoid deadlocks.

Therefore:
- when possible, remove completely the aiocontext lock/unlock pair
- if it is used by some other function too, reduce the locking
   section as much as possible, leaving the job API outside.
- change AIO_WAIT_WHILE in AIO_WAIT_WHILE_UNLOCKED, since we
   are not using the aiocontext lock anymore

There is only one JobDriver callback, ->free() that assumes that
the aiocontext lock is held (because it calls bdrv_unref), so for
now keep that under aiocontext lock.

Also remove real_job_{lock/unlock}, as they are replaced by the
public functions.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---

[..]

  static int job_finalize_single_locked(Job *job)
  {
      int job_ret;
+    AioContext *ctx = job->aio_context;
assert(job_is_completed_locked(job)); /* Ensure abort is called for late-transactional failures */
      job_update_rc_locked(job);
+ aio_context_acquire(ctx);

so here we acquire aio-context under job_mutex lock? Wouldn't that dead-lock?

+
      if (!job->ret) {
          job_commit_locked(job);
      } else {



--
Best regards,
Vladimir



reply via email to

[Prev in Thread] Current Thread [Next in Thread]