[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 for-7.1 8/9] nbd: take receive_mutex when reading requests
From: |
Eric Blake |
Subject: |
Re: [PATCH v2 for-7.1 8/9] nbd: take receive_mutex when reading requests[].receiving |
Date: |
Thu, 14 Apr 2022 14:42:17 -0500 |
User-agent: |
NeoMutt/20211029-34-be16c3 |
On Thu, Apr 14, 2022 at 07:57:55PM +0200, Paolo Bonzini wrote:
> requests[].receiving is set by nbd_receive_replies() under the receive_mutex;
> Read it under the same mutex as well. Waking up receivers on errors happens
> after each reply finishes processing, in nbd_co_receive_one_chunk().
> If there is no currently-active reply, there are two cases:
>
> * either there is no active request at all, in which case no
> element of request[] can have .receiving = true
>
> * or nbd_receive_replies() must be running and owns receive_mutex;
> in that case it will get back to nbd_co_receive_one_chunk() because
> the socket has been shutdown, and all waiting coroutines will wake up
> in turn.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> block/nbd.c | 15 +++++++--------
> 1 file changed, 7 insertions(+), 8 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
- Re: [PATCH v2 for-7.1 7/9] nbd: move s->state under requests_lock, (continued)