浏览代码

job: Force-cancel jobs in a failed transaction

When a transaction is aborted, no result matters, and so all jobs within
should be force-cancelled.

Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20211006151940.214590-5-hreitz@redhat.com>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Hanna Reitz 3 年之前
父节点
当前提交
1d4a43e946
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      job.c

+ 6 - 1
job.c

@@ -766,7 +766,12 @@ static void job_completed_txn_abort(Job *job)
         if (other_job != job) {
         if (other_job != job) {
             ctx = other_job->aio_context;
             ctx = other_job->aio_context;
             aio_context_acquire(ctx);
             aio_context_acquire(ctx);
-            job_cancel_async(other_job, false);
+            /*
+             * This is a transaction: If one job failed, no result will matter.
+             * Therefore, pass force=true to terminate all other jobs as quickly
+             * as possible.
+             */
+            job_cancel_async(other_job, true);
             aio_context_release(ctx);
             aio_context_release(ctx);
         }
         }
     }
     }