On 02/27/2013 10:58 AM, Emmanuel Dreyfus wrote:
Emmanuel Dreyfus<manu@xxxxxxxxxx> wrote:
if (!xdr_string (xdrs, &objp->op_errstr, ~0))
return FALSE;
How is this supposed to work? Here is below the NetBSD xdr_string()
implementation from libc. Even if objp->op_errstr is not NULL, the
maxsize argument set to 0 will cause it to always retrurn false. Does it
has another semantic in Linux?
I overlooked it. ~0 is indeed not 0.
Hi Emmanuel,
I have attached a patch that should fix the glusterd crash on peer-probe.
xdr_string fails to serialize the supplied char * argument if it is
NULL. This
patch ensures that we supply a empty string when we don't have an actual
errstr to send across the wire.
Interestingly, in Linux glusterd didn't crash, but encoding the response
failed with
xdr_string failing to serialize a NULL string.
Could you raise a bug for this with the backtrace attached to it? That
would be handy to
push this patch.
thanks,
krish
>From 61f942f490aef47c1ac9722e302f6af7f87cdbd5 Mon Sep 17 00:00:00 2001
From: Krishnan Parthasarathi <kparthas@xxxxxxxxxx>
Date: Wed, 27 Feb 2013 16:44:07 +0530
Subject: [PATCH] glusterd: Setting errstr to to appease xdr_string
An empty string is sufficient, since the cli decodes the
errstr from op_errno sent in response. We use the op_errstr only when
the error cannot be categorised into one of the existing values.
Change-Id: Ic66803c125aa488687ee3d2dee6eb7071e406329
Signed-off-by: Krishnan Parthasarathi <kparthas@xxxxxxxxxx>
---
xlators/mgmt/glusterd/src/glusterd-handler.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 04e5833..328971c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -2058,6 +2058,7 @@ respond:
uuid_copy (rsp.uuid, MY_UUID);
rsp.hostname = probe_req.hostname;
+ rsp.op_errstr = "";
glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gd1_mgmt_probe_rsp);
--
1.7.11.7