* [Qemu-devel] [PATCH] block: for jobs, do not clear user_paused until after the resume
@ 2018-08-15 15:59 Jeff Cody
2018-08-15 21:23 ` John Snow
2018-08-15 21:25 ` Eric Blake
0 siblings, 2 replies; 5+ messages in thread
From: Jeff Cody @ 2018-08-15 15:59 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-block, jsnow
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.
Signed-off-by: Jeff Cody <jcody@redhat.com>
---
job.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/job.c b/job.c
index fa671b431a..e36ebaafd8 100644
--- a/job.c
+++ b/job.c
@@ -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--;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] block: for jobs, do not clear user_paused until after the resume
2018-08-15 15:59 [Qemu-devel] [PATCH] block: for jobs, do not clear user_paused until after the resume Jeff Cody
@ 2018-08-15 21:23 ` John Snow
2018-08-15 21:31 ` Jeff Cody
2018-08-15 21:25 ` Eric Blake
1 sibling, 1 reply; 5+ messages in thread
From: John Snow @ 2018-08-15 21:23 UTC (permalink / raw)
To: Jeff Cody, qemu-devel; +Cc: qemu-block
On 08/15/2018 11:59 AM, Jeff Cody wrote:
> 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.
>
> Signed-off-by: Jeff Cody <jcody@redhat.com>
> ---
> job.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/job.c b/job.c
> index fa671b431a..e36ebaafd8 100644
> --- a/job.c
> +++ b/job.c
> @@ -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--;
> }
>
Looks right to me; are you going to make good on your threat of a v2
with a unit test?
Reviewed-by: John Snow <jsnow@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] block: for jobs, do not clear user_paused until after the resume
2018-08-15 15:59 [Qemu-devel] [PATCH] block: for jobs, do not clear user_paused until after the resume Jeff Cody
2018-08-15 21:23 ` John Snow
@ 2018-08-15 21:25 ` Eric Blake
2018-08-15 21:30 ` Jeff Cody
1 sibling, 1 reply; 5+ messages in thread
From: Eric Blake @ 2018-08-15 21:25 UTC (permalink / raw)
To: Jeff Cody, qemu-devel; +Cc: jsnow, qemu-block
On 08/15/2018 10:59 AM, Jeff Cody wrote:
> 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.
>
> Signed-off-by: Jeff Cody <jcody@redhat.com>
> ---
> job.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Does this need to CC qemu-stable?
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] block: for jobs, do not clear user_paused until after the resume
2018-08-15 21:25 ` Eric Blake
@ 2018-08-15 21:30 ` Jeff Cody
0 siblings, 0 replies; 5+ messages in thread
From: Jeff Cody @ 2018-08-15 21:30 UTC (permalink / raw)
To: Eric Blake; +Cc: qemu-devel, jsnow, qemu-block
On Wed, Aug 15, 2018 at 04:25:16PM -0500, Eric Blake wrote:
> On 08/15/2018 10:59 AM, Jeff Cody wrote:
> >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.
> >
> >Signed-off-by: Jeff Cody <jcody@redhat.com>
> >---
> > 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.
> Reviewed-by: Eric Blake <eblake@redhat.com>
>
Thanks
-Jeff
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] block: for jobs, do not clear user_paused until after the resume
2018-08-15 21:23 ` John Snow
@ 2018-08-15 21:31 ` Jeff Cody
0 siblings, 0 replies; 5+ messages in thread
From: Jeff Cody @ 2018-08-15 21:31 UTC (permalink / raw)
To: John Snow; +Cc: qemu-devel, qemu-block
On Wed, Aug 15, 2018 at 05:23:43PM -0400, John Snow wrote:
>
>
> On 08/15/2018 11:59 AM, Jeff Cody wrote:
> > 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.
> >
> > Signed-off-by: Jeff Cody <jcody@redhat.com>
> > ---
> > job.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/job.c b/job.c
> > index fa671b431a..e36ebaafd8 100644
> > --- a/job.c
> > +++ b/job.c
> > @@ -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--;
> > }
> >
>
> Looks right to me; are you going to make good on your threat of a v2
> with a unit test?
>
Yep!
> Reviewed-by: John Snow <jsnow@redhat.com>
Thanks
-Jeff
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-08-15 21:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-15 15:59 [Qemu-devel] [PATCH] block: for jobs, do not clear user_paused until after the resume Jeff Cody
2018-08-15 21:23 ` John Snow
2018-08-15 21:31 ` Jeff Cody
2018-08-15 21:25 ` Eric Blake
2018-08-15 21:30 ` Jeff Cody
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).