diff options
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/changelog/src/changelog-rpc-common.c | 9 | ||||
-rw-r--r-- | xlators/features/snapview-server/src/snapview-server-mgmt.c | 8 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-conn-mgmt.c | 8 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 18 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rebalance.c | 8 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 9 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.c | 6 | ||||
-rw-r--r-- | xlators/nfs/server/src/acl3.c | 5 | ||||
-rw-r--r-- | xlators/nfs/server/src/mount3.c | 5 | ||||
-rw-r--r-- | xlators/nfs/server/src/nlm4.c | 7 |
10 files changed, 69 insertions, 14 deletions
diff --git a/xlators/features/changelog/src/changelog-rpc-common.c b/xlators/features/changelog/src/changelog-rpc-common.c index cf35175c3bc..dcdcfb1c735 100644 --- a/xlators/features/changelog/src/changelog-rpc-common.c +++ b/xlators/features/changelog/src/changelog-rpc-common.c @@ -47,7 +47,7 @@ changelog_rpc_client_init(xlator_t *this, void *cbkdata, char *sockfile, if (!options) goto error_return; - ret = rpc_transport_unix_options_build(&options, sockfile, 0); + ret = rpc_transport_unix_options_build(options, sockfile, 0); if (ret) { gf_msg(this->name, GF_LOG_ERROR, 0, CHANGELOG_MSG_RPC_BUILD_ERROR, "failed to build rpc options"); @@ -73,6 +73,7 @@ changelog_rpc_client_init(xlator_t *this, void *cbkdata, char *sockfile, goto dealloc_rpc_clnt; } + dict_unref(options); return rpc; dealloc_rpc_clnt: @@ -303,7 +304,11 @@ changelog_rpc_server_init(xlator_t *this, char *sockfile, void *cbkdata, if (!cbkdata) cbkdata = this; - ret = rpcsvc_transport_unix_options_build(&options, sockfile); + options = dict_new(); + if (!options) + return NULL; + + ret = rpcsvc_transport_unix_options_build(options, sockfile); if (ret) goto dealloc_dict; diff --git a/xlators/features/snapview-server/src/snapview-server-mgmt.c b/xlators/features/snapview-server/src/snapview-server-mgmt.c index b608cdfcd44..bc415efb81d 100644 --- a/xlators/features/snapview-server/src/snapview-server-mgmt.c +++ b/xlators/features/snapview-server/src/snapview-server-mgmt.c @@ -101,8 +101,12 @@ svs_mgmt_init(xlator_t *this) if (cmd_args->volfile_server) host = cmd_args->volfile_server; + options = dict_new(); + if (!options) + goto out; + opt = find_xlator_option_in_cmd_args_t("address-family", cmd_args); - ret = rpc_transport_inet_options_build(&options, host, port, + ret = rpc_transport_inet_options_build(options, host, port, (opt != NULL ? opt->value : NULL)); if (ret) { gf_msg(this->name, GF_LOG_ERROR, 0, SVS_MSG_BUILD_TRNSPRT_OPT_FAILED, @@ -145,6 +149,8 @@ svs_mgmt_init(xlator_t *this) gf_msg_debug(this->name, 0, "svs mgmt init successful"); out: + if (options) + dict_unref(options); if (ret) if (priv) { rpc_clnt_connection_cleanup(&priv->rpc->conn); diff --git a/xlators/mgmt/glusterd/src/glusterd-conn-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-conn-mgmt.c index e80e152cd58..c6d7a00b06d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-conn-mgmt.c +++ b/xlators/mgmt/glusterd/src/glusterd-conn-mgmt.c @@ -29,6 +29,10 @@ glusterd_conn_init(glusterd_conn_t *conn, char *sockpath, int frame_timeout, if (!this) goto out; + options = dict_new(); + if (!options) + goto out; + svc = glusterd_conn_get_svc_object(conn); if (!svc) { gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_SVC_GET_FAIL, @@ -36,7 +40,7 @@ glusterd_conn_init(glusterd_conn_t *conn, char *sockpath, int frame_timeout, goto out; } - ret = rpc_transport_unix_options_build(&options, sockpath, frame_timeout); + ret = rpc_transport_unix_options_build(options, sockpath, frame_timeout); if (ret) goto out; @@ -66,6 +70,8 @@ glusterd_conn_init(glusterd_conn_t *conn, char *sockpath, int frame_timeout, conn->rpc = rpc; conn->notify = notify; out: + if (options) + dict_unref(options); if (ret) { if (rpc) { rpc_clnt_unref(rpc); diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index c3830589ce7..b63fa77478a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -3429,11 +3429,10 @@ out: } int -glusterd_transport_inet_options_build(dict_t **options, const char *hostname, +glusterd_transport_inet_options_build(dict_t *dict, const char *hostname, int port, char *af) { xlator_t *this = NULL; - dict_t *dict = NULL; int32_t interval = -1; int32_t time = -1; int32_t timeout = -1; @@ -3441,14 +3440,14 @@ glusterd_transport_inet_options_build(dict_t **options, const char *hostname, this = THIS; GF_ASSERT(this); - GF_ASSERT(options); + GF_ASSERT(dict); GF_ASSERT(hostname); if (!port) port = GLUSTERD_DEFAULT_PORT; /* Build default transport options */ - ret = rpc_transport_inet_options_build(&dict, hostname, port, af); + ret = rpc_transport_inet_options_build(dict, hostname, port, af); if (ret) goto out; @@ -3488,7 +3487,6 @@ glusterd_transport_inet_options_build(dict_t **options, const char *hostname, if ((interval > 0) || (time > 0)) ret = rpc_transport_keepalive_options_set(dict, interval, time, timeout); - *options = dict; out: gf_msg_debug("glusterd", 0, "Returning %d", ret); return ret; @@ -3508,6 +3506,10 @@ glusterd_friend_rpc_create(xlator_t *this, glusterd_peerinfo_t *peerinfo, if (!peerctx) goto out; + options = dict_new(); + if (!options) + goto out; + if (args) peerctx->args = *args; @@ -3522,7 +3524,7 @@ glusterd_friend_rpc_create(xlator_t *this, glusterd_peerinfo_t *peerinfo, if (ret) gf_log(this->name, GF_LOG_TRACE, "option transport.address-family is not set in xlator options"); - ret = glusterd_transport_inet_options_build(&options, peerinfo->hostname, + ret = glusterd_transport_inet_options_build(options, peerinfo->hostname, peerinfo->port, af); if (ret) goto out; @@ -3532,6 +3534,7 @@ glusterd_friend_rpc_create(xlator_t *this, glusterd_peerinfo_t *peerinfo, * create our RPC endpoint with the same address that the peer would * use to reach us. */ + if (this->options) { data = dict_getn(this->options, "transport.socket.bind-address", SLEN("transport.socket.bind-address")); @@ -3573,6 +3576,9 @@ glusterd_friend_rpc_create(xlator_t *this, glusterd_peerinfo_t *peerinfo, peerctx = NULL; ret = 0; out: + if (options) + dict_unref(options); + GF_FREE(peerctx); return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index 34b0294474c..5562ebbda37 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -391,6 +391,10 @@ glusterd_rebalance_rpc_create(glusterd_volinfo_t *volinfo) if (!defrag) goto out; + options = dict_new(); + if (!options) + goto out; + GLUSTERD_GET_DEFRAG_SOCK_FILE(sockfile, volinfo); /* Check if defrag sockfile exists in the new location * in /var/run/ , if it does not try the old location @@ -420,7 +424,7 @@ glusterd_rebalance_rpc_create(glusterd_volinfo_t *volinfo) * default timeout of 30mins used for unreliable network connections is * too long for unix domain socket connections. */ - ret = rpc_transport_unix_options_build(&options, sockfile, 600); + ret = rpc_transport_unix_options_build(options, sockfile, 600); if (ret) { gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_UNIX_OP_BUILD_FAIL, "Unix options build failed"); @@ -437,6 +441,8 @@ glusterd_rebalance_rpc_create(glusterd_volinfo_t *volinfo) } ret = 0; out: + if (options) + dict_unref(options); return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index e8d4e1e35f0..dd4c02422e3 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -1974,7 +1974,11 @@ glusterd_brick_connect(glusterd_volinfo_t *volinfo, * The default timeout of 30mins used for unreliable network * connections is too long for unix domain socket connections. */ - ret = rpc_transport_unix_options_build(&options, socketpath, 600); + options = dict_new(); + if (!options) + goto out; + + ret = rpc_transport_unix_options_build(options, socketpath, 600); if (ret) goto out; @@ -1993,7 +1997,8 @@ glusterd_brick_connect(glusterd_volinfo_t *volinfo, brickinfo->rpc = rpc; } out: - + if (options) + dict_unref(options); gf_msg_debug("glusterd", 0, "Returning %d", ret); return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index ff5af42079d..280c9f3640e 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -1111,11 +1111,15 @@ glusterd_init_uds_listener(xlator_t *this) GF_ASSERT(this); + options = dict_new(); + if (!options) + goto out; + sock_data = dict_get(this->options, "glusterd-sockfile"); (void)snprintf(sockfile, sizeof(sockfile), "%s", sock_data ? sock_data->data : DEFAULT_GLUSTERD_SOCKFILE); - ret = rpcsvc_transport_unix_options_build(&options, sockfile); + ret = rpcsvc_transport_unix_options_build(options, sockfile); if (ret) goto out; diff --git a/xlators/nfs/server/src/acl3.c b/xlators/nfs/server/src/acl3.c index 0eca45d8a3e..2ede24b7bf5 100644 --- a/xlators/nfs/server/src/acl3.c +++ b/xlators/nfs/server/src/acl3.c @@ -787,9 +787,14 @@ acl3svc_init(xlator_t *nfsx) goto err; } + if (options) + dict_unref(options); + acl3_inited = _gf_true; return &acl3prog; err: + if (options) + dict_unref(options); return NULL; } diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c index 726dc293af6..396809cb2c2 100644 --- a/xlators/nfs/server/src/mount3.c +++ b/xlators/nfs/server/src/mount3.c @@ -4102,8 +4102,13 @@ mnt3svc_init(xlator_t *nfsx) gf_msg_debug(GF_MNT, GF_LOG_DEBUG, "Thread creation failed"); } } + if (options) + dict_unref(options); + return &mnt3prog; err: + if (options) + dict_unref(options); return NULL; } diff --git a/xlators/nfs/server/src/nlm4.c b/xlators/nfs/server/src/nlm4.c index a341ebd6638..c3c1453a091 100644 --- a/xlators/nfs/server/src/nlm4.c +++ b/xlators/nfs/server/src/nlm4.c @@ -1121,6 +1121,8 @@ nlm4_establish_callback(nfs3_call_state_t *cs, call_frame_t *cbk_frame) ret = 0; err: + if (options) + dict_unref(options); if (ret == -1) { if (rpc_clnt) rpc_clnt_unref(rpc_clnt); @@ -2708,8 +2710,13 @@ nlm4svc_init(xlator_t *nfsx) gf_timer_call_after(nfsx->ctx, timeout, nlm_grace_period_over, NULL); nlm4_inited = _gf_true; + + if (options) + dict_unref(options); return &nlm4prog; err: + if (options) + dict_unref(options); return NULL; } |