ae23c9
From b84814bde02585f990a32f2ebfbdda1de1fce5a8 Mon Sep 17 00:00:00 2001
ae23c9
From: John Snow <jsnow@redhat.com>
ae23c9
Date: Wed, 18 Jul 2018 22:55:00 +0200
ae23c9
Subject: [PATCH 242/268] nbd/server: fix trace
ae23c9
ae23c9
RH-Author: John Snow <jsnow@redhat.com>
ae23c9
Message-id: <20180718225511.14878-25-jsnow@redhat.com>
ae23c9
Patchwork-id: 81401
ae23c9
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 24/35] nbd/server: fix trace
ae23c9
Bugzilla: 1207657
ae23c9
RH-Acked-by: Eric Blake <eblake@redhat.com>
ae23c9
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
ae23c9
RH-Acked-by: Fam Zheng <famz@redhat.com>
ae23c9
ae23c9
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
ae23c9
ae23c9
Return code = 1 doesn't mean that we parsed base:allocation. Use
ae23c9
correct traces in both -parsed and -skipped cases.
ae23c9
ae23c9
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
ae23c9
Message-Id: <20180609151758.17343-2-vsementsov@virtuozzo.com>
ae23c9
Reviewed-by: Eric Blake <eblake@redhat.com>
ae23c9
[eblake: comment tweaks]
ae23c9
Signed-off-by: Eric Blake <eblake@redhat.com>
ae23c9
(cherry picked from commit dbb8b396bb46388cee92e9094c563297d04c43ed)
ae23c9
Signed-off-by: John Snow <jsnow@redhat.com>
ae23c9
ae23c9
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
ae23c9
---
ae23c9
 nbd/server.c | 14 ++++++++++----
ae23c9
 1 file changed, 10 insertions(+), 4 deletions(-)
ae23c9
ae23c9
diff --git a/nbd/server.c b/nbd/server.c
ae23c9
index 493a926..942c016 100644
ae23c9
--- a/nbd/server.c
ae23c9
+++ b/nbd/server.c
ae23c9
@@ -736,12 +736,16 @@ static int nbd_negotiate_send_meta_context(NBDClient *client,
ae23c9
 
ae23c9
 /* nbd_meta_base_query
ae23c9
  *
ae23c9
- * Handle query to 'base' namespace. For now, only base:allocation context is
ae23c9
- * available in it.  'len' is the amount of text remaining to be read from
ae23c9
+ * Handle queries to 'base' namespace. For now, only the base:allocation
ae23c9
+ * context is available.  'len' is the amount of text remaining to be read from
ae23c9
  * the current name, after the 'base:' portion has been stripped.
ae23c9
  *
ae23c9
  * Return -errno on I/O error, 0 if option was completely handled by
ae23c9
- * sending a reply about inconsistent lengths, or 1 on success. */
ae23c9
+ * sending a reply about inconsistent lengths, or 1 on success.
ae23c9
+ *
ae23c9
+ * Note: return code = 1 doesn't mean that we've parsed the "base:allocation"
ae23c9
+ * namespace. It only means that there are no errors.
ae23c9
+ */
ae23c9
 static int nbd_meta_base_query(NBDClient *client, NBDExportMetaContexts *meta,
ae23c9
                                uint32_t len, Error **errp)
ae23c9
 {
ae23c9
@@ -768,10 +772,12 @@ static int nbd_meta_base_query(NBDClient *client, NBDExportMetaContexts *meta,
ae23c9
     }
ae23c9
 
ae23c9
     if (strncmp(query, "allocation", alen) == 0) {
ae23c9
+        trace_nbd_negotiate_meta_query_parse("base:allocation");
ae23c9
         meta->base_allocation = true;
ae23c9
+    } else {
ae23c9
+        trace_nbd_negotiate_meta_query_skip("not base:allocation");
ae23c9
     }
ae23c9
 
ae23c9
-    trace_nbd_negotiate_meta_query_parse("base:allocation");
ae23c9
     return 1;
ae23c9
 }
ae23c9
 
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9