]> git.proxmox.com Git - pve-qemu.git/blobdiff - debian/patches/pve/0037-PVE-Add-sequential-job-transaction-support.patch
update submodule and patches to 7.2.0
[pve-qemu.git] / debian / patches / pve / 0037-PVE-Add-sequential-job-transaction-support.patch
index b85b914e983467c124ba1b0b12ab37250a0fe899..fbf610e5107d549ef0ad1e7cfd528ab0a75a1444 100644 (file)
@@ -7,14 +7,14 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
 Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
 ---
  include/qemu/job.h | 12 ++++++++++++
- job.c              | 3+++++++++++++++++++++++++++++++
- 2 files changed, 43 insertions(+)
+ job.c              | 34 ++++++++++++++++++++++++++++++++++
+ 2 files changed, 46 insertions(+)
 
 diff --git a/include/qemu/job.h b/include/qemu/job.h
-index c105b31076..5096679571 100644
+index e502787dd8..963cf2bef5 100644
 --- a/include/qemu/job.h
 +++ b/include/qemu/job.h
-@@ -316,6 +316,18 @@ typedef enum JobCreateFlags {
+@@ -381,6 +381,18 @@ void job_unlock(void);
   */
  JobTxn *job_txn_new(void);
  
@@ -34,10 +34,10 @@ index c105b31076..5096679571 100644
   * Release a reference that was previously acquired with job_txn_add_job or
   * job_txn_new. If it's the last reference to the object, it will be freed.
 diff --git a/job.c b/job.c
-index e5699ad200..34c9758349 100644
+index 93e22d180b..2b31f1e14f 100644
 --- a/job.c
 +++ b/job.c
-@@ -72,6 +72,8 @@ struct JobTxn {
+@@ -93,6 +93,8 @@ struct JobTxn {
  
      /* Reference count */
      int refcnt;
@@ -45,8 +45,8 @@ index e5699ad200..34c9758349 100644
 +    bool sequential;
  };
  
- /* Right now, this mutex is only needed to synchronize accesses to job->busy
-@@ -102,6 +104,25 @@ JobTxn *job_txn_new(void)
+ void job_lock(void)
+@@ -118,6 +120,25 @@ JobTxn *job_txn_new(void)
      return txn;
  }
  
@@ -69,20 +69,23 @@ index e5699ad200..34c9758349 100644
 +    job_start(first);
 +}
 +
- static void job_txn_ref(JobTxn *txn)
+ /* Called with job_mutex held. */
+ static void job_txn_ref_locked(JobTxn *txn)
  {
-     txn->refcnt++;
-@@ -897,6 +918,9 @@ static void job_completed_txn_success(Job *job)
+@@ -1057,6 +1078,12 @@ static void job_completed_txn_success_locked(Job *job)
       */
      QLIST_FOREACH(other_job, &txn->jobs, txn_list) {
-         if (!job_is_completed(other_job)) {
+         if (!job_is_completed_locked(other_job)) {
 +            if (txn->sequential) {
++                job_unlock();
++                /* Needs to be called without holding the job lock */
 +                job_start(other_job);
++                job_lock();
 +            }
              return;
          }
          assert(other_job->ret == 0);
-@@ -1093,6 +1117,13 @@ int job_finish_sync(Job *job, void (*finish)(Job *, Error **errp), Error **errp)
+@@ -1268,6 +1295,13 @@ int job_finish_sync_locked(Job *job,
          return -EBUSY;
      }
  
@@ -90,9 +93,9 @@ index e5699ad200..34c9758349 100644
 +     * of cancelling, these have not begun work so job_enter won't do anything,
 +     * let's ensure they are marked as ABORTING if required */
 +    if (job->status == JOB_STATUS_CREATED && job->txn->sequential) {
-+        job_update_rc(job);
++        job_update_rc_locked(job);
 +    }
 +
-     AIO_WAIT_WHILE(job->aio_context,
-                    (job_enter(job), !job_is_completed(job)));
+     job_unlock();
+     AIO_WAIT_WHILE_UNLOCKED(job->aio_context,
+                             (job_enter(job), !job_is_completed(job)));