block: for jobs, do not clear user_paused until after the resume
PATCH 1/1 block: for jobs, do not clear user_paused until after the resume
The function job_cancel_async() will always cause an assert for blockjob user resume. We set job->user_paused to false, and then call job->driver->user_resume(). In the case of blockjobs, this is the block_job_user_resume() function.
In that function, we assert that job.user_paused is set to true. Unfortunately, right before calling this function, it has explicitly been set to false.
The fix is pretty simple: set job->user_paused to false only after the job user_resume() function has been called.
--- job.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
job.c +1 -1
@@ -732,10 +732,10 @@ static void job_cancel_async(Job *job, bool force) {if (job->user_paused) {/* Do not call job_enter here, the caller will handle it. */ - job->user_paused = false;if (job->driver->user_resume) { job->driver->user_resume (job); } + job->user_paused = false;assert (job->pause_count >0 ); job->pause_count--; }
Signature · 1 line
2.17.1
Quoted 24 lines · Jeff Cody
The function
job_cancel_async()will always cause an assert for blockjob user resume. We setjob->user_pausedto false, and then calljob->driver->user_resume(). In the case of blockjobs, this is theblock_job_user_resume()function.In that function, we assert that job.user_paused is set to true. Unfortunately, right before calling this function, it has explicitly been set to false.
The fix is pretty simple: set
job->user_pausedto false only after the jobuser_resume()function has been called.Signed-off-by Jeff Cody <[email protected]>--- job.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)job.c +0
-0@@ -732,10 +732,10 @@ static void job_cancel_async(Job *job, bool force) {
job.c static void job_cancel_async(Job *job, bool force) · line 741
Quoted 10 lines
job.c +1
-1if (job->user_paused) {/* Do not call job_enter here, the caller will handle it. */ - job->user_paused = false;if (job->driver->user_resume) { job->driver->user_resume (job); } + job->user_paused = false;assert (job->pause_count >0 ); job->pause_count--; }
Looks right to me; are you going to make good on your threat of a v2 with a unit test?
Quoted 32 lines · John Snow
Quoted 29 lines · Jeff Cody
The function
job_cancel_async()will always cause an assert for blockjob user resume. We setjob->user_pausedto false, and then calljob->driver->user_resume(). In the case of blockjobs, this is theblock_job_user_resume()function.In that function, we assert that job.user_paused is set to true. Unfortunately, right before calling this function, it has explicitly been set to false.
The fix is pretty simple: set
job->user_pausedto false only after the jobuser_resume()function has been called.Signed-off-by Jeff Cody <[email protected]>--- job.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)job.c +0
-1@@ -732,10 +732,10 @@ static void job_cancel_async(Job *job, bool force) {if (job->user_paused) {/* Do not call job_enter here, the caller will handle it. */ - job->user_paused = false;if (job->driver->user_resume) { job->driver->user_resume (job); }
Quoted 9 lines
job.c static void job_cancel_async(Job *job, bool force) · line 741
Quoted 5 lines
job.c +1
-0+ job->user_paused = false;assert (job->pause_count >0 ); job->pause_count--; }Looks right to me; are you going to make good on your threat of a v2 with a unit test?
Yep!
Quoted 1 line
Reviewed-by John Snow <[email protected]>
Thanks
-Jeff
Quoted 9 lines · Jeff Cody
The function
job_cancel_async()will always cause an assert for blockjob user resume. We setjob->user_pausedto false, and then calljob->driver->user_resume(). In the case of blockjobs, this is theblock_job_user_resume()function.In that function, we assert that job.user_paused is set to true. Unfortunately, right before calling this function, it has explicitly been set to false.
Quoted 8 lines
The fix is pretty simple: set
job->user_pausedto false only after the jobuser_resume()function has been called.Signed-off-by Jeff Cody <[email protected]>--- job.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Does this need to CC qemu-stable?
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Quoted 13 lines · Eric Blake
Quoted 12 lines · Jeff Cody
The function
job_cancel_async()will always cause an assert for blockjob user resume. We setjob->user_pausedto false, and then calljob->driver->user_resume(). In the case of blockjobs, this is theblock_job_user_resume()function.In that function, we assert that job.user_paused is set to true. Unfortunately, right before calling this function, it has explicitly been set to false.
The fix is pretty simple: set
job->user_pausedto false only after the jobuser_resume()function has been called.
Quoted 8 lines
Quoted 5 lines
Signed-off-by Jeff Cody <[email protected]>--- job.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Does this need to CC qemu-stable?
Good point, yes. I'm going to do a v2 with an iotest, and I'll CC qemu-stable on that one.
Quoted 2 lines
Reviewed-by Eric Blake <[email protected]>
Thanks
-Jeff