[PATCH v1] job.c: add missing notifier initialization

Emanuele Giuseppe Esposito posted 1 patch 2 years, 6 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20211103162155.791482-1-eesposit@redhat.com
Maintainers: John Snow <jsnow@redhat.com>, Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
job.c | 1 +
1 file changed, 1 insertion(+)
[PATCH v1] job.c: add missing notifier initialization
Posted by Emanuele Giuseppe Esposito 2 years, 6 months ago
It seems that on_idle list is not properly initialized like
the other notifiers.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
 job.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/job.c b/job.c
index dbfa67bb0a..54db80df66 100644
--- a/job.c
+++ b/job.c
@@ -352,6 +352,7 @@ void *job_create(const char *job_id, const JobDriver *driver, JobTxn *txn,
     notifier_list_init(&job->on_finalize_completed);
     notifier_list_init(&job->on_pending);
     notifier_list_init(&job->on_ready);
+    notifier_list_init(&job->on_idle);
 
     job_state_transition(job, JOB_STATUS_CREATED);
     aio_timer_init(qemu_get_aio_context(), &job->sleep_timer,
-- 
2.27.0


Re: [PATCH v1] job.c: add missing notifier initialization
Posted by Philippe Mathieu-Daudé 2 years, 6 months ago
On 11/3/21 17:21, Emanuele Giuseppe Esposito wrote:
> It seems that on_idle list is not properly initialized like
> the other notifiers.
> 

Cc: qemu-stable@nongnu.org
Fixes: 34dc97b9a0e ("blockjob: Wake up BDS when job becomes idle")

> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
>  job.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/job.c b/job.c
> index dbfa67bb0a..54db80df66 100644
> --- a/job.c
> +++ b/job.c
> @@ -352,6 +352,7 @@ void *job_create(const char *job_id, const JobDriver *driver, JobTxn *txn,
>      notifier_list_init(&job->on_finalize_completed);
>      notifier_list_init(&job->on_pending);
>      notifier_list_init(&job->on_ready);
> +    notifier_list_init(&job->on_idle);
>  
>      job_state_transition(job, JOB_STATUS_CREATED);
>      aio_timer_init(qemu_get_aio_context(), &job->sleep_timer,
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


Re: [PATCH v1] job.c: add missing notifier initialization
Posted by Stefan Hajnoczi 2 years, 6 months ago
On Wed, Nov 03, 2021 at 12:21:55PM -0400, Emanuele Giuseppe Esposito wrote:
> It seems that on_idle list is not properly initialized like
> the other notifiers.
> 
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
>  job.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Re: [PATCH v1] job.c: add missing notifier initialization
Posted by Vladimir Sementsov-Ogievskiy 2 years, 5 months ago
03.11.2021 19:21, Emanuele Giuseppe Esposito wrote:
> It seems that on_idle list is not properly initialized like
> the other notifiers.
> 
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
>   job.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/job.c b/job.c
> index dbfa67bb0a..54db80df66 100644
> --- a/job.c
> +++ b/job.c
> @@ -352,6 +352,7 @@ void *job_create(const char *job_id, const JobDriver *driver, JobTxn *txn,
>       notifier_list_init(&job->on_finalize_completed);
>       notifier_list_init(&job->on_pending);
>       notifier_list_init(&job->on_ready);
> +    notifier_list_init(&job->on_idle);
>   
>       job_state_transition(job, JOB_STATUS_CREATED);
>       aio_timer_init(qemu_get_aio_context(), &job->sleep_timer,
> 

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>


I don't think it worth applying it now:

job object is alloced with g_malloc0, so job->on_idle is initialized to zero.

notifier_list_init() simply calls QLIST_INIT(), which initializes the only field of QLIST structure to NULL. So, actually these notifier_list_init() calls are no-op in this context.

I queue it in jobs branch, but will not send a pull request until more critical fix comes for 6.2 or 6.3 development starts.

Thanks!

-- 
Best regards,
Vladimir