From patchwork Thu Jun 15 10:52:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 776240 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wpLRc63hnz9s65 for ; Thu, 15 Jun 2017 21:11:40 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="dkhLD2zj"; dkim-atps=neutral Received: from localhost ([::1]:53210 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLSgc-00008i-GA for incoming@patchwork.ozlabs.org; Thu, 15 Jun 2017 07:11:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41059) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLSPI-0008Vs-TJ for qemu-devel@nongnu.org; Thu, 15 Jun 2017 06:53:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLSPI-0007f1-8O for qemu-devel@nongnu.org; Thu, 15 Jun 2017 06:53:45 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:34396) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLSPI-0007ej-2D for qemu-devel@nongnu.org; Thu, 15 Jun 2017 06:53:44 -0400 Received: by mail-wr0-x243.google.com with SMTP id y25so547807wrd.1 for ; Thu, 15 Jun 2017 03:53:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=w8p28fqzOvomi5vhLQqJQLeMskvlslYZjWdj3HUBnPw=; b=dkhLD2zj9Dj4hcyWk9n99LrsnQG/VXPpNEfVhnA2//wT2wFb5s68jrfX1raliF3CcC xYKh/WByQ9xQTYh9evYArfdbPtZ/d8x+E3aYFNv0YUTZ0ubJZmeMt+S6sRZ8hsbstuzP tPBFJ/8vXkqFKG2Jqx4CtYfZSLSntR/bjbr9S2W+VrMaxg0jFBdEJmeS/opGRpo6UlWi YiJO3dDKjaHNhwGZ8gF/Ekvs0IuTaKDvKpRxbIUqqVXHOuZv8qnfCzRT3QMWG207TZLB Ppn8mvdb44jg9TvKf6b1mv4Q5uEH1FCMlFD/0lVvWVjOcSaiB9qELreIYUoQMqHZ1OYo 3FaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=w8p28fqzOvomi5vhLQqJQLeMskvlslYZjWdj3HUBnPw=; b=PrCmctMMcpuVp2Lx7rmtdsilcNgtFoowdGH2sFxw3Fq7CFjz/QjcJ484wxJm2VCAgk P2q1jgzucOKRXlKfwzNV6s5VqTn4Z195CCIKcROm9rLQPCVh1Gi7G2GSfa08t3rKpWFh p5Be12Y4WcLygDeQVl2jg2yB/2h5hBYfZC5AXXTxFmaRu2Pjkq+cmQx6ls8eZecr80pB +zuVNwU7gk8WJDSikF0eaQtm5fJ3sir3Ybe+o/MqpiY1+5M5HFOKgeqibS8TP3B+viff pMI/+w2Qg2VVSfMRM+SDMFKZCCbNWYmAcrnQGcK92Br3K8m/RWBDNHmwa/5CIguZ3wDh nfWA== X-Gm-Message-State: AKS2vOzkVaYNNJz61b3h4Q9MPlByowDGnS2OSRQ0hnifvNya71YZOKy0 squieyDTzJbYMZwEzAY= X-Received: by 10.28.93.134 with SMTP id r128mr1400423wmb.120.1497524022844; Thu, 15 Jun 2017 03:53:42 -0700 (PDT) Received: from 640k.lan (94-39-191-51.adsl-ull.clienti.tiscali.it. [94.39.191.51]) by smtp.gmail.com with ESMTPSA id f21sm3258597wra.5.2017.06.15.03.53.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Jun 2017 03:53:41 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 15 Jun 2017 12:52:49 +0200 Message-Id: <1497523981-38449-30-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1497523981-38449-1-git-send-email-pbonzini@redhat.com> References: <1497523981-38449-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PULL 29/41] nbd/server: get rid of EAGAIN dead code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vladimir Sementsov-Ogievskiy Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Vladimir Sementsov-Ogievskiy For now nbd_read never returns EAGAIN. So, don't handle it. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-Id: <20170602150150.258222-7-vsementsov@virtuozzo.com> Signed-off-by: Paolo Bonzini --- nbd/server.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/nbd/server.c b/nbd/server.c index 8ceac89..00a19f6 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -997,11 +997,12 @@ static int nbd_co_send_reply(NBDRequestData *req, NBDReply *reply, int len) return rc; } -/* Collect a client request. Return 0 if request looks valid, -EAGAIN - * to keep trying the collection, -EIO to drop connection right away, - * and any other negative value to report an error to the client - * (although the caller may still need to disconnect after reporting - * the error). */ +/* nbd_co_receive_request + * Collect a client request. Return 0 if request looks valid, -EIO to drop + * connection right away, and any other negative value to report an error to + * the client (although the caller may still need to disconnect after reporting + * the error). + */ static int nbd_co_receive_request(NBDRequestData *req, NBDRequest *request) { NBDClient *client = req->client; @@ -1011,9 +1012,7 @@ static int nbd_co_receive_request(NBDRequestData *req, NBDRequest *request) assert(client->recv_coroutine == qemu_coroutine_self()); rc = nbd_receive_request(client->ioc, request); if (rc < 0) { - if (rc != -EAGAIN) { - rc = -EIO; - } + rc = -EIO; goto out; } @@ -1114,9 +1113,6 @@ static coroutine_fn void nbd_trip(void *opaque) req = nbd_request_get(client); ret = nbd_co_receive_request(req, &request); - if (ret == -EAGAIN) { - goto done; - } if (ret == -EIO) { goto out; }