block/iscsi: take iscsilun->mutex in iscsi_timed_check_events()

Commit d045c466d9 ("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 <stefanha@redhat.com>
Message-Id: <20180203061621.7033-3-stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2018-02-03 07:16:20 +01:00 committed by Paolo Bonzini
parent f92fa85f98
commit 83d11973fa

View File

@ -344,6 +344,8 @@ static void iscsi_timed_check_events(void *opaque)
{ {
IscsiLun *iscsilun = opaque; IscsiLun *iscsilun = opaque;
qemu_mutex_lock(&iscsilun->mutex);
/* check for timed out requests */ /* check for timed out requests */
iscsi_service(iscsilun->iscsi, 0); iscsi_service(iscsilun->iscsi, 0);
@ -356,6 +358,8 @@ static void iscsi_timed_check_events(void *opaque)
* to return to service once this situation changes. */ * to return to service once this situation changes. */
iscsi_set_events(iscsilun); iscsi_set_events(iscsilun);
qemu_mutex_unlock(&iscsilun->mutex);
timer_mod(iscsilun->event_timer, timer_mod(iscsilun->event_timer,
qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + EVENT_INTERVAL); qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + EVENT_INTERVAL);
} }