[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 2/3] block/iscsi: take iscsilun->mutex in isc
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v2 2/3] block/iscsi: take iscsilun->mutex in iscsi_timed_check_events() |
Date: |
Fri, 9 Feb 2018 18:49:33 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
On 03/02/2018 07:16, Stefan Hajnoczi wrote:
> Commit d045c466d9e62b4321fadf586d024d54ddfd8bd4 ("iscsi: do not use
> aio_context_acquire/release") introduced iscsilun->mutex but appears to
> have overlooked iscsi_timed_check_events() when introducing the mutex.
>
> iscsi_service() and iscsi_set_events() must be called with
> iscsilun->mutex held.
>
> iscsi_timed_check_events() is invoked from the AioContext and does not
> take the mutex.
>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
> ---
> block/iscsi.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/block/iscsi.c b/block/iscsi.c
> index cd0738942c..1cfe1c647c 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -339,6 +339,8 @@ static void iscsi_timed_check_events(void *opaque)
> {
> IscsiLun *iscsilun = opaque;
>
> + qemu_mutex_lock(&iscsilun->mutex);
> +
> /* check for timed out requests */
> iscsi_service(iscsilun->iscsi, 0);
>
> @@ -351,6 +353,8 @@ static void iscsi_timed_check_events(void *opaque)
> * to return to service once this situation changes. */
> iscsi_set_events(iscsilun);
>
> + qemu_mutex_unlock(&iscsilun->mutex);
> +
> timer_mod(iscsilun->event_timer,
> qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + EVENT_INTERVAL);
> }
>