summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>2017-09-18 19:49:10 +0530
committerPrasanna Kumar Kalever <pkalever@redhat.com>2017-09-19 04:07:48 +0000
commit3d0953aa99eed434a1977de3131b264c48fca64b (patch)
treebcf3008e0ced0365069a9414ee4efc85e0f96b09 /utils
parent2ab382593a3dea2e6ca2dc213bf735574933c10b (diff)
rpc: switch to MT-safe block RPC routines
blockResponse * block_delete_1(blockDelete *argp, CLIENT *clnt) { static blockResponse clnt_res; <<<<<<-------- Same memory is used by everyone memset((char *)&clnt_res, 0, sizeof(clnt_res)); <<<<<---- Here memset is happening if (clnt_call (clnt, BLOCK_DELETE, (xdrproc_t) xdr_blockDelete, (caddr_t) argp, (xdrproc_t) xdr_blockResponse, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return (&clnt_res); <<<<<---- ptr to this memory is returned. } So while Thread-1 is returned "return (&clnt_res);" another thread could be doing "memset((char *)&clnt_res, 0, sizeof(clnt_res));" This seem to be a day-1 gluster-blockd bug from the looks of it. Change-Id: I3fc76d7814c4fe5b286577586ec44d752dcc73f0 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com> Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/utils.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/utils/utils.h b/utils/utils.h
index d3b1027..ce1ef52 100644
--- a/utils/utils.h
+++ b/utils/utils.h
@@ -278,6 +278,18 @@ extern struct gbConf gbConf;
GB_FREE(tmp); \
} while (0)
+# define GB_RPC_CALL(op, blk, reply, rqstp, ret) \
+ do { \
+ blockResponse *resp = block_##op##_1_svc_st(blk, rqstp); \
+ if (resp) { \
+ memcpy(reply, resp, sizeof(*reply)); \
+ GB_FREE(resp); \
+ ret = true; \
+ } else { \
+ ret = false; \
+ } \
+ } while (0)
+
# define CALLOC(x) \
calloc(1, x)