From patchwork Fri Jul 7 20:30:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 785750 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 3x45r31VBbz9ryr for ; Sat, 8 Jul 2017 06:32:03 +1000 (AEST) Received: from localhost ([::1]:58689 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTZuy-00033h-Ox for incoming@patchwork.ozlabs.org; Fri, 07 Jul 2017 16:32:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTZuD-0002uq-ET for qemu-devel@nongnu.org; Fri, 07 Jul 2017 16:31:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTZuC-0003vq-Ek for qemu-devel@nongnu.org; Fri, 07 Jul 2017 16:31:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60196) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dTZu9-0003pW-Sx; Fri, 07 Jul 2017 16:31:10 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DC7FF5D68D; Fri, 7 Jul 2017 20:31:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DC7FF5D68D Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=eblake@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com DC7FF5D68D Received: from red.redhat.com (ovpn-120-204.rdu2.redhat.com [10.10.120.204]) by smtp.corp.redhat.com (Postfix) with ESMTP id E6DA671C55; Fri, 7 Jul 2017 20:31:07 +0000 (UTC) From: Eric Blake To: qemu-devel@nongnu.org Date: Fri, 7 Jul 2017 15:30:44 -0500 Message-Id: <20170707203049.534-5-eblake@redhat.com> In-Reply-To: <20170707203049.534-1-eblake@redhat.com> References: <20170707203049.534-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 07 Jul 2017 20:31:09 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 4/9] nbd: Simplify trace of client flags in negotiation 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: pbonzini@redhat.com, vsementsov@virtuozzo.com, den@virtuozzo.com, qemu-block@nongnu.org, marcandre.lureau@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Simplify the tracing of client flags in the server, and return -EINVAL instead of -EIO if we successfully read but don't like those flags. Signed-off-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy --- v5: new patch --- nbd/server.c | 6 ++---- nbd/trace-events | 4 +--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/nbd/server.c b/nbd/server.c index 27a0aab..8e363d3 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -396,21 +396,19 @@ static int nbd_negotiate_options(NBDClient *client, Error **errp) error_prepend(errp, "read failed: "); return -EIO; } - trace_nbd_negotiate_options_flags(); be32_to_cpus(&flags); + trace_nbd_negotiate_options_flags(flags); if (flags & NBD_FLAG_C_FIXED_NEWSTYLE) { - trace_nbd_negotiate_options_newstyle(); fixedNewstyle = true; flags &= ~NBD_FLAG_C_FIXED_NEWSTYLE; } if (flags & NBD_FLAG_C_NO_ZEROES) { - trace_nbd_negotiate_options_no_zeroes(); client->no_zeroes = true; flags &= ~NBD_FLAG_C_NO_ZEROES; } if (flags != 0) { error_setg(errp, "Unknown client flags 0x%" PRIx32 " received", flags); - return -EIO; + return -EINVAL; } while (1) { diff --git a/nbd/trace-events b/nbd/trace-events index e61feda..765f5f4 100644 --- a/nbd/trace-events +++ b/nbd/trace-events @@ -35,9 +35,7 @@ nbd_negotiate_handle_export_name(void) "Checking length" nbd_negotiate_handle_export_name_request(const char *name) "Client requested export '%s'" nbd_negotiate_handle_starttls(void) "Setting up TLS" nbd_negotiate_handle_starttls_handshake(void) "Starting TLS handshake" -nbd_negotiate_options_flags(void) "Checking client flags" -nbd_negotiate_options_newstyle(void) "Client supports fixed newstyle handshake" -nbd_negotiate_options_no_zeroes(void) "Client supports no zeroes at handshake end" +nbd_negotiate_options_flags(uint32_t flags) "Received client flags 0x%" PRIx32 nbd_negotiate_options_check_magic(uint64_t magic) "Checking opts magic 0x%" PRIx64 nbd_negotiate_options_check_option(uint32_t option, const char *name) "Checking option 0x%" PRIx32 " (%s)" nbd_opt_abort_reply_failed(const char *error) "Reply to NBD_OPT_ABORT request failed: %s"