diff mbox series

[v2,01/17] job: Fix missing locking due to mismerge

Message ID 20180913125217.23173-2-kwolf@redhat.com
State New
Headers show
Series Fix some jobs/drain/aio_poll related hangs | expand

Commit Message

Kevin Wolf Sept. 13, 2018, 12:52 p.m. UTC
job_completed() had a problem with double locking that was recently
fixed independently by two different commits:

"job: Fix nested aio_poll() hanging in job_txn_apply"
"jobs: add exit shim"

One fix removed the first aio_context_acquire(), the other fix removed
the other one. Now we have a bug again and the code is run without any
locking.

Add it back in one of the places.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 job.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Max Reitz Sept. 13, 2018, 1:56 p.m. UTC | #1
On 13.09.18 14:52, Kevin Wolf wrote:
> job_completed() had a problem with double locking that was recently
> fixed independently by two different commits:
> 
> "job: Fix nested aio_poll() hanging in job_txn_apply"
> "jobs: add exit shim"
> 
> One fix removed the first aio_context_acquire(), the other fix removed
> the other one. Now we have a bug again and the code is run without any
> locking.
> 
> Add it back in one of the places.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  job.c | 4 ++++
>  1 file changed, 4 insertions(+)

Reviewed-by: Max Reitz <mreitz@redhat.com>
John Snow Sept. 13, 2018, 5:38 p.m. UTC | #2
On 09/13/2018 08:52 AM, Kevin Wolf wrote:
> job_completed() had a problem with double locking that was recently
> fixed independently by two different commits:
> 
> "job: Fix nested aio_poll() hanging in job_txn_apply"
> "jobs: add exit shim"
> 
> One fix removed the first aio_context_acquire(), the other fix removed
> the other one. Now we have a bug again and the code is run without any
> locking.
> 
> Add it back in one of the places.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  job.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/job.c b/job.c
> index 82b46929bd..5c4e84f007 100644
> --- a/job.c
> +++ b/job.c
> @@ -847,7 +847,11 @@ static void job_completed(Job *job)
>  static void job_exit(void *opaque)
>  {
>      Job *job = (Job *)opaque;
> +    AioContext *ctx = job->aio_context;
> +
> +    aio_context_acquire(ctx);
>      job_completed(job);
> +    aio_context_release(ctx);
>  }
>  
>  /**
> 

OK =]
Reviewed-by: John Snow <jsnow@redhat.com>
diff mbox series

Patch

diff --git a/job.c b/job.c
index 82b46929bd..5c4e84f007 100644
--- a/job.c
+++ b/job.c
@@ -847,7 +847,11 @@  static void job_completed(Job *job)
 static void job_exit(void *opaque)
 {
     Job *job = (Job *)opaque;
+    AioContext *ctx = job->aio_context;
+
+    aio_context_acquire(ctx);
     job_completed(job);
+    aio_context_release(ctx);
 }
 
 /**