From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKlic-00041I-NV for qemu-devel@nongnu.org; Mon, 09 Feb 2015 05:37:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKliY-0003EP-NJ for qemu-devel@nongnu.org; Mon, 09 Feb 2015 05:37:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45331) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKliY-0003E8-G1 for qemu-devel@nongnu.org; Mon, 09 Feb 2015 05:37:26 -0500 Message-ID: <54D87FBE.4070209@redhat.com> Date: Mon, 09 Feb 2015 10:37:02 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1423302708-7900-1-git-send-email-wu.wubin@huawei.com> <1423302708-7900-2-git-send-email-wu.wubin@huawei.com> <20150209081252.GA29334@ad.nay.redhat.com> <54D87F8A.7000509@huawei.com> In-Reply-To: <54D87F8A.7000509@huawei.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qemu-coroutine-lock: fix co_queue multi-adding bug List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bin Wu , Fam Zheng Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com On 09/02/2015 10:36, Bin Wu wrote: > During the mirror phase with nbd devices, if we send a cancel command or > physical network breaks down, the source qemu process will receive a readable > event and the main loop will invoke nbd_reply_ready to deal with it. This > function finds the connection is down and then goes into > nbd_teardown_connection. nbd_teardown_connection wakes up all working coroutines > by nbd_recv_coroutines_enter_all. These coroutines include the one which holds > the sending lock, the ones which wait for the lock, and the ones which wait for > receiving messages. > > I think the purpose of nbd_recv_coroutines_enter_all is to terminate all waiting > coroutines by waking all of them up. If the coroutine waiting for the lock is > allowed for waking up, this implementation is ok. If not, we need to distinguish > the coroutines waiting for receiving messages from the ones waiting for the lock. > > In my option, if the coroutines waiting for a lock is allowd for waking up, it > should be more robust :> No, it's not allowed. Paolo