From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddeJN-0005UH-3J for qemu-devel@nongnu.org; Fri, 04 Aug 2017 11:14:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ddeJK-0007CS-P6 for qemu-devel@nongnu.org; Fri, 04 Aug 2017 11:14:48 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:40618 helo=relay.sw.ru) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ddeJK-00078n-BP for qemu-devel@nongnu.org; Fri, 04 Aug 2017 11:14:46 -0400 From: Vladimir Sementsov-Ogievskiy Date: Fri, 4 Aug 2017 18:14:34 +0300 Message-Id: <20170804151440.320927-12-vsementsov@virtuozzo.com> In-Reply-To: <20170804151440.320927-1-vsementsov@virtuozzo.com> References: <20170804151440.320927-1-vsementsov@virtuozzo.com> Subject: [Qemu-devel] [PATCH 11/17] block/nbd-client: fix nbd_co_request: set s->reply.handle to 0 on error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org, qemu-devel@nongnu.org Cc: mreitz@redhat.com, kwolf@redhat.com, pbonzini@redhat.com, eblake@redhat.com, den@openvz.org, vsementsov@virtuozzo.com We set s->reply.handle to 0 on one error path and don't set on another. For consistancy and to avoid assert in nbd_read_reply_entry let's set s->reply.handle to 0 in case of wrong handle too. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/nbd-client.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/nbd-client.c b/block/nbd-client.c index d6965d24db..b84cab4079 100644 --- a/block/nbd-client.c +++ b/block/nbd-client.c @@ -183,13 +183,13 @@ static int nbd_co_request(BlockDriverState *bs, reply.error = EIO; } } - - /* Tell the read handler to read another header. */ - s->reply.handle = 0; } rc = -reply.error; out: + /* Tell the read handler to read another header. */ + s->reply.handle = 0; + s->recv_coroutine[i] = NULL; /* Kick the read_reply_co to get the next reply. */ -- 2.11.1