From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55692) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekCnu-00038i-Fw for qemu-devel@nongnu.org; Fri, 09 Feb 2018 12:49:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ekCns-00051m-Cf for qemu-devel@nongnu.org; Fri, 09 Feb 2018 12:49:42 -0500 References: <20180203061621.7033-1-stefanha@redhat.com> <20180203061621.7033-3-stefanha@redhat.com> From: Paolo Bonzini Message-ID: Date: Fri, 9 Feb 2018 18:49:33 +0100 MIME-Version: 1.0 In-Reply-To: <20180203061621.7033-3-stefanha@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 2/3] block/iscsi: take iscsilun->mutex in iscsi_timed_check_events() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Felipe Franciosi , qemu-block@nongnu.org, Ronnie Sahlberg , Peter Lieven 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 Reviewed-by: Paolo Bonzini > --- > 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); > } >