Commit dbb8b396 authored by Vladimir Sementsov-Ogievskiy's avatar Vladimir Sementsov-Ogievskiy Committed by Eric Blake
Browse files

nbd/server: fix trace



Return code = 1 doesn't mean that we parsed base:allocation. Use
correct traces in both -parsed and -skipped cases.

Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20180609151758.17343-2-vsementsov@virtuozzo.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
[eblake: comment tweaks]
Signed-off-by: default avatarEric Blake <eblake@redhat.com>
parent d8b20291
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -736,12 +736,16 @@ static int nbd_negotiate_send_meta_context(NBDClient *client,

/* nbd_meta_base_query
 *
 * Handle query to 'base' namespace. For now, only base:allocation context is
 * available in it.  'len' is the amount of text remaining to be read from
 * Handle queries to 'base' namespace. For now, only the base:allocation
 * context is available.  'len' is the amount of text remaining to be read from
 * the current name, after the 'base:' portion has been stripped.
 *
 * Return -errno on I/O error, 0 if option was completely handled by
 * sending a reply about inconsistent lengths, or 1 on success. */
 * sending a reply about inconsistent lengths, or 1 on success.
 *
 * Note: return code = 1 doesn't mean that we've parsed the "base:allocation"
 * namespace. It only means that there are no errors.
 */
static int nbd_meta_base_query(NBDClient *client, NBDExportMetaContexts *meta,
                               uint32_t len, Error **errp)
{
@@ -768,10 +772,12 @@ static int nbd_meta_base_query(NBDClient *client, NBDExportMetaContexts *meta,
    }

    if (strncmp(query, "allocation", alen) == 0) {
        trace_nbd_negotiate_meta_query_parse("base:allocation");
        meta->base_allocation = true;
    } else {
        trace_nbd_negotiate_meta_query_skip("not base:allocation");
    }

    trace_nbd_negotiate_meta_query_parse("base:allocation");
    return 1;
}