protocol/server: White space cleanup and NULL check validations.
Signed-off-by: Junaid <junaid@gluster.com> Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 2346 (Log message enhancements in GlusterFS - phase 1) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2346
This commit is contained in:
parent
0d7628c6c2
commit
d3e9a97b6e
@ -32,10 +32,7 @@
|
||||
#include "authenticate.h"
|
||||
|
||||
static void
|
||||
init (dict_t *this,
|
||||
char *key,
|
||||
data_t *value,
|
||||
void *data)
|
||||
init (dict_t *this, char *key, data_t *value, void *data)
|
||||
{
|
||||
void *handle = NULL;
|
||||
char *auth_file = NULL;
|
||||
@ -60,7 +57,6 @@ init (dict_t *this,
|
||||
|
||||
ret = gf_asprintf (&auth_file, "%s/%s.so", LIBDIR, key);
|
||||
if (-1 == ret) {
|
||||
gf_log ("authenticate", GF_LOG_ERROR, "asprintf failed");
|
||||
dict_set (this, key, data_from_dynptr (NULL, 0));
|
||||
*error = -1;
|
||||
return;
|
||||
@ -89,7 +85,6 @@ init (dict_t *this,
|
||||
auth_handle = GF_CALLOC (1, sizeof (*auth_handle),
|
||||
gf_common_mt_auth_handle_t);
|
||||
if (!auth_handle) {
|
||||
gf_log ("authenticate", GF_LOG_ERROR, "Out of memory");
|
||||
dict_set (this, key, data_from_dynptr (NULL, 0));
|
||||
*error = -1;
|
||||
return;
|
||||
@ -110,10 +105,7 @@ init (dict_t *this,
|
||||
}
|
||||
|
||||
static void
|
||||
fini (dict_t *this,
|
||||
char *key,
|
||||
data_t *value,
|
||||
void *data)
|
||||
fini (dict_t *this, char *key, data_t *value, void *data)
|
||||
{
|
||||
auth_handle_t *handle = data_to_ptr (value);
|
||||
if (handle) {
|
||||
@ -127,26 +119,31 @@ gf_auth_init (xlator_t *xl, dict_t *auth_modules)
|
||||
int ret = 0;
|
||||
auth_handle_t *handle = NULL;
|
||||
data_pair_t *pair = NULL;
|
||||
|
||||
dict_foreach (auth_modules, init, &ret);
|
||||
if (!ret) {
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
pair = auth_modules->members_list;
|
||||
while (pair) {
|
||||
handle = data_to_ptr (pair->value);
|
||||
if (handle) {
|
||||
if (!handle) {
|
||||
pair = pair->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
list_add_tail (&(handle->vol_opt->list),
|
||||
&(xl->volume_options));
|
||||
if (-1 ==
|
||||
validate_xlator_volume_options (xl,
|
||||
handle->vol_opt->given_opt)) {
|
||||
ret = validate_xlator_volume_options (xl,
|
||||
handle->vol_opt->given_opt);
|
||||
if (ret)
|
||||
gf_log ("authenticate", GF_LOG_ERROR,
|
||||
"volume option validation "
|
||||
"failed");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
"volume option validation failed");
|
||||
|
||||
pair = pair->next;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
if (ret) {
|
||||
gf_log (xl->name, GF_LOG_ERROR, "authentication init failed");
|
||||
dict_foreach (auth_modules, fini, &ret);
|
||||
@ -159,10 +156,7 @@ static dict_t *__input_params;
|
||||
static dict_t *__config_params;
|
||||
|
||||
void
|
||||
map (dict_t *this,
|
||||
char *key,
|
||||
data_t *value,
|
||||
void *data)
|
||||
map (dict_t *this, char *key, data_t *value, void *data)
|
||||
{
|
||||
dict_t *res = data;
|
||||
auth_fn_t authenticate;
|
||||
@ -179,10 +173,7 @@ map (dict_t *this,
|
||||
}
|
||||
|
||||
void
|
||||
reduce (dict_t *this,
|
||||
char *key,
|
||||
data_t *value,
|
||||
void *data)
|
||||
reduce (dict_t *this, char *key, data_t *value, void *data)
|
||||
{
|
||||
int64_t val = 0;
|
||||
int64_t *res = data;
|
||||
@ -212,8 +203,10 @@ gf_authenticate (dict_t *input_params,
|
||||
dict_t *config_params,
|
||||
dict_t *auth_modules)
|
||||
{
|
||||
char *name = NULL;
|
||||
dict_t *results = NULL;
|
||||
int64_t result = AUTH_DONT_CARE;
|
||||
data_t *peerinfo_data = NULL;
|
||||
|
||||
results = get_new_dict ();
|
||||
__input_params = input_params;
|
||||
@ -223,8 +216,7 @@ gf_authenticate (dict_t *input_params,
|
||||
|
||||
dict_foreach (results, reduce, &result);
|
||||
if (AUTH_DONT_CARE == result) {
|
||||
data_t *peerinfo_data = dict_get (input_params, "peer-info-name");
|
||||
char *name = NULL;
|
||||
peerinfo_data = dict_get (input_params, "peer-info-name");
|
||||
|
||||
if (peerinfo_data) {
|
||||
name = peerinfo_data->data;
|
||||
|
@ -32,8 +32,8 @@ server_decode_groups (call_frame_t *frame, rpcsvc_request_t *req)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if ((!frame) || (!req))
|
||||
return 0;
|
||||
GF_VALIDATE_OR_GOTO ("server", frame, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", req, out);
|
||||
|
||||
frame->root->ngrps = req->auxgidcount;
|
||||
if (frame->root->ngrps == 0)
|
||||
@ -44,7 +44,7 @@ server_decode_groups (call_frame_t *frame, rpcsvc_request_t *req)
|
||||
|
||||
for (; i < frame->root->ngrps; ++i)
|
||||
frame->root->groups[i] = req->auxgids[i];
|
||||
|
||||
out:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -155,6 +155,11 @@ gf_add_locker (struct _lock_table *table, const char *volume,
|
||||
int32_t ret = -1;
|
||||
struct _locker *new = NULL;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", table, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", volume, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", loc, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", fd, out);
|
||||
|
||||
new = GF_CALLOC (1, sizeof (struct _locker), gf_server_mt_locker_t);
|
||||
if (new == NULL) {
|
||||
gf_log ("server", GF_LOG_ERROR,
|
||||
@ -193,10 +198,15 @@ gf_del_locker (struct _lock_table *table, const char *volume,
|
||||
{
|
||||
struct _locker *locker = NULL;
|
||||
struct _locker *tmp = NULL;
|
||||
int32_t ret = 0;
|
||||
int32_t ret = -1;
|
||||
struct list_head *head = NULL;
|
||||
struct list_head del;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", table, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", volume, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", loc, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", fd, out);
|
||||
|
||||
INIT_LIST_HEAD (&del);
|
||||
|
||||
LOCK (&table->lock);
|
||||
@ -237,6 +247,8 @@ gf_del_locker (struct _lock_table *table, const char *volume,
|
||||
GF_FREE (locker);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -262,14 +274,22 @@ static int
|
||||
server_nop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
int32_t op_ret, int32_t op_errno)
|
||||
{
|
||||
int ret = -1;
|
||||
server_state_t *state = NULL;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", frame, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", cookie, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", this, out);
|
||||
|
||||
state = CALL_STATE(frame);
|
||||
|
||||
if (state)
|
||||
free_state (state);
|
||||
STACK_DESTROY (frame->root);
|
||||
return 0;
|
||||
|
||||
ret = 0;
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
@ -284,6 +304,11 @@ do_lock_table_cleanup (xlator_t *this, server_connection_t *conn,
|
||||
int ret = -1;
|
||||
char *path = NULL;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", this, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", conn, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", frame, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", ltable, out);
|
||||
|
||||
bound_xl = conn->bound_xl;
|
||||
INIT_LIST_HEAD (&inodelk_lockers);
|
||||
INIT_LIST_HEAD (&entrylk_lockers);
|
||||
@ -416,15 +441,23 @@ server_connection_cleanup_flush_cbk (call_frame_t *frame, void *cookie,
|
||||
xlator_t *this, int32_t op_ret,
|
||||
int32_t op_errno)
|
||||
{
|
||||
int32_t ret = -1;
|
||||
fd_t *fd = NULL;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", this, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", cookie, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", frame, out);
|
||||
|
||||
fd = frame->local;
|
||||
|
||||
fd_unref (fd);
|
||||
frame->local = NULL;
|
||||
|
||||
STACK_DESTROY (frame->root);
|
||||
return 0;
|
||||
|
||||
ret = 0;
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -438,6 +471,11 @@ do_fd_cleanup (xlator_t *this, server_connection_t *conn, call_frame_t *frame,
|
||||
xlator_t *bound_xl = NULL;
|
||||
char *path = NULL;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", this, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", conn, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", frame, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", fdentries, out);
|
||||
|
||||
bound_xl = conn->bound_xl;
|
||||
for (i = 0;i < fd_count; i++) {
|
||||
fd = fdentries[i].fd;
|
||||
@ -493,6 +531,11 @@ do_connection_cleanup (xlator_t *this, server_connection_t *conn,
|
||||
call_frame_t *frame = NULL;
|
||||
server_state_t *state = NULL;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", this, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", conn, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", fdentries, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", ltable, out);
|
||||
|
||||
frame = create_frame (this, this->ctx->pool);
|
||||
if (frame == NULL) {
|
||||
gf_log (this->name, GF_LOG_ERROR, "out of memory");
|
||||
@ -529,9 +572,8 @@ server_connection_cleanup (xlator_t *this, server_connection_t *conn)
|
||||
uint32_t fd_count = 0;
|
||||
int ret = 0;
|
||||
|
||||
if (conn == NULL) {
|
||||
goto out;
|
||||
}
|
||||
GF_VALIDATE_OR_GOTO ("server", this, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", conn, out);
|
||||
|
||||
pthread_mutex_lock (&conn->lock);
|
||||
{
|
||||
@ -577,10 +619,8 @@ server_connection_destroy (xlator_t *this, server_connection_t *conn)
|
||||
uint32_t fd_count = 0;
|
||||
char *path = NULL;
|
||||
|
||||
if (conn == NULL) {
|
||||
ret = 0;
|
||||
goto out;
|
||||
}
|
||||
GF_VALIDATE_OR_GOTO ("server", this, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", conn, out);
|
||||
|
||||
bound_xl = (xlator_t *) (conn->bound_xl);
|
||||
|
||||
@ -770,6 +810,9 @@ server_connection_get (xlator_t *this, const char *id)
|
||||
server_connection_t *trav = NULL;
|
||||
server_conf_t *conf = NULL;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", this, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", id, out);
|
||||
|
||||
conf = this->private;
|
||||
|
||||
pthread_mutex_lock (&conf->mutex);
|
||||
@ -801,7 +844,7 @@ server_connection_get (xlator_t *this, const char *id)
|
||||
}
|
||||
unlock:
|
||||
pthread_mutex_unlock (&conf->mutex);
|
||||
|
||||
out:
|
||||
return conn;
|
||||
}
|
||||
|
||||
@ -812,15 +855,11 @@ server_connection_put (xlator_t *this, server_connection_t *conn)
|
||||
server_conf_t *conf = NULL;
|
||||
server_connection_t *todel = NULL;
|
||||
|
||||
if (conn == NULL) {
|
||||
goto out;
|
||||
}
|
||||
GF_VALIDATE_OR_GOTO ("server", this, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", conn, out);
|
||||
|
||||
conf = this->private;
|
||||
|
||||
if (conf == NULL) {
|
||||
goto out;
|
||||
}
|
||||
GF_VALIDATE_OR_GOTO ("server", conf, out);
|
||||
|
||||
pthread_mutex_lock (&conf->mutex);
|
||||
{
|
||||
@ -854,8 +893,7 @@ server_alloc_frame (rpcsvc_request_t *req)
|
||||
GF_VALIDATE_OR_GOTO ("server", req->svc->ctx, out);
|
||||
|
||||
conn = (server_connection_t *)req->trans->xl_private;
|
||||
if (!conn)
|
||||
goto out;
|
||||
GF_VALIDATE_OR_GOTO ("server", conn, out);
|
||||
|
||||
frame = create_frame (conn->this, req->svc->ctx->pool);
|
||||
GF_VALIDATE_OR_GOTO ("server", frame, out);
|
||||
@ -887,9 +925,10 @@ get_frame_from_request (rpcsvc_request_t *req)
|
||||
{
|
||||
call_frame_t *frame = NULL;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", req, out);
|
||||
|
||||
frame = server_alloc_frame (req);
|
||||
if (!frame)
|
||||
goto out;
|
||||
GF_VALIDATE_OR_GOTO ("server", frame, out);
|
||||
|
||||
frame->root->op = req->procnum;
|
||||
frame->root->type = req->type;
|
||||
@ -917,6 +956,9 @@ server_build_config (xlator_t *this, server_conf_t *conf)
|
||||
int ret = -1;
|
||||
struct stat buf = {0,};
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", this, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", conf, out);
|
||||
|
||||
ret = dict_get_int32 (this->options, "inode-lru-limit",
|
||||
&conf->inode_lru_limit);
|
||||
if (ret < 0) {
|
||||
@ -984,7 +1026,12 @@ out:
|
||||
server_connection_t *
|
||||
get_server_conn_state (xlator_t *this, rpc_transport_t *xprt)
|
||||
{
|
||||
GF_VALIDATE_OR_GOTO ("server", this, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", xprt, out);
|
||||
|
||||
return (server_connection_t *)xprt->xl_private;
|
||||
out:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
server_connection_t *
|
||||
@ -993,6 +1040,9 @@ create_server_conn_state (xlator_t *this, rpc_transport_t *xprt)
|
||||
server_connection_t *conn = NULL;
|
||||
int ret = -1;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", this, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", xprt, out);
|
||||
|
||||
conn = GF_CALLOC (1, sizeof (*conn), gf_server_mt_conn_t);
|
||||
if (!conn)
|
||||
goto out;
|
||||
@ -1022,9 +1072,7 @@ out:
|
||||
void
|
||||
destroy_server_conn_state (server_connection_t *conn)
|
||||
{
|
||||
if (!conn) {
|
||||
return;
|
||||
}
|
||||
GF_VALIDATE_OR_GOTO ("server", conn, out);
|
||||
|
||||
if (conn->ltable) {
|
||||
/* TODO */
|
||||
@ -1038,7 +1086,7 @@ destroy_server_conn_state (server_connection_t *conn)
|
||||
pthread_mutex_destroy (&conn->lock);
|
||||
|
||||
GF_FREE (conn);
|
||||
|
||||
out:
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1048,6 +1096,9 @@ print_caller (char *str, int size, call_frame_t *frame)
|
||||
{
|
||||
server_state_t *state = NULL;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", str, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", frame, out);
|
||||
|
||||
state = CALL_STATE (frame);
|
||||
|
||||
snprintf (str, size,
|
||||
@ -1055,6 +1106,7 @@ print_caller (char *str, int size, call_frame_t *frame)
|
||||
frame->root->unique,
|
||||
state->xprt->peerinfo.identifier);
|
||||
|
||||
out:
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1064,6 +1116,8 @@ server_print_resolve (char *str, int size, server_resolve_t *resolve)
|
||||
{
|
||||
int filled = 0;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", str, out);
|
||||
|
||||
if (!resolve) {
|
||||
snprintf (str, size, "<nul>");
|
||||
return;
|
||||
@ -1091,6 +1145,8 @@ server_print_resolve (char *str, int size, server_resolve_t *resolve)
|
||||
"path=%s", resolve->path);
|
||||
|
||||
snprintf (str + filled, size - filled, "}");
|
||||
out:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -1099,6 +1155,8 @@ server_print_loc (char *str, int size, loc_t *loc)
|
||||
{
|
||||
int filled = 0;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", str, out);
|
||||
|
||||
if (!loc) {
|
||||
snprintf (str, size, "<nul>");
|
||||
return;
|
||||
@ -1118,6 +1176,8 @@ server_print_loc (char *str, int size, loc_t *loc)
|
||||
"parent=%p", loc->parent);
|
||||
|
||||
snprintf (str + filled, size - filled, "}");
|
||||
out:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -1126,6 +1186,8 @@ server_print_params (char *str, int size, server_state_t *state)
|
||||
{
|
||||
int filled = 0;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", str, out);
|
||||
|
||||
filled += snprintf (str + filled, size - filled,
|
||||
" Params={");
|
||||
|
||||
@ -1165,6 +1227,8 @@ server_print_params (char *str, int size, server_state_t *state)
|
||||
|
||||
snprintf (str + filled, size - filled,
|
||||
"bound_xl=%s}", state->conn->bound_xl->name);
|
||||
out:
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
@ -1201,11 +1265,13 @@ server_print_reply (call_frame_t *frame, int op_ret, int op_errno)
|
||||
char fdstr[32];
|
||||
char *op = "UNKNOWN";
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", frame, out);
|
||||
|
||||
this = frame->this;
|
||||
conf = this->private;
|
||||
|
||||
if (!conf || !conf->trace)
|
||||
return;
|
||||
GF_VALIDATE_OR_GOTO ("server", conf, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", conf->trace, out);
|
||||
|
||||
state = CALL_STATE (frame);
|
||||
|
||||
@ -1229,6 +1295,8 @@ server_print_reply (call_frame_t *frame, int op_ret, int op_errno)
|
||||
gf_log (this->name, GF_LOG_NORMAL,
|
||||
"%s%s => (%d, %d)%s",
|
||||
op, caller, op_ret, op_errno, fdstr);
|
||||
out:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -1246,11 +1314,13 @@ server_print_request (call_frame_t *frame)
|
||||
char caller[512];
|
||||
char *op = "UNKNOWN";
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", frame, out);
|
||||
|
||||
this = frame->this;
|
||||
conf = this->private;
|
||||
|
||||
if (!conf || !conf->trace)
|
||||
return;
|
||||
GF_VALIDATE_OR_GOTO ("server", conf, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", conf->trace, out);
|
||||
|
||||
state = CALL_STATE (frame);
|
||||
|
||||
@ -1290,6 +1360,8 @@ server_print_request (call_frame_t *frame)
|
||||
"%s%s%s%s%s%s%s",
|
||||
op, caller,
|
||||
resolve_vars, loc_vars, resolve2_vars, loc2_vars, other_vars);
|
||||
out:
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
@ -1300,6 +1372,9 @@ serialize_rsp_direntp (gf_dirent_t *entries, gfs3_readdirp_rsp *rsp)
|
||||
gfs3_dirplist *prev = NULL;
|
||||
int ret = -1;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", entries, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", rsp, out);
|
||||
|
||||
list_for_each_entry (entry, &entries->list, list) {
|
||||
trav = GF_CALLOC (1, sizeof (*trav), gf_server_mt_dirent_rsp_t);
|
||||
if (!trav)
|
||||
@ -1336,6 +1411,9 @@ serialize_rsp_dirent (gf_dirent_t *entries, gfs3_readdir_rsp *rsp)
|
||||
gfs3_dirlist *prev = NULL;
|
||||
int ret = -1;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", entries, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", rsp, out);
|
||||
|
||||
list_for_each_entry (entry, &entries->list, list) {
|
||||
trav = GF_CALLOC (1, sizeof (*trav), gf_server_mt_dirent_rsp_t);
|
||||
if (!trav)
|
||||
|
@ -61,7 +61,6 @@ prepare_components (call_frame_t *frame)
|
||||
int i = 0;
|
||||
char *trav = NULL;
|
||||
|
||||
|
||||
state = CALL_STATE (frame);
|
||||
resolve = state->resolve_now;
|
||||
|
||||
@ -71,8 +70,8 @@ prepare_components (call_frame_t *frame)
|
||||
count = component_count (resolve->path);
|
||||
components = GF_CALLOC (sizeof (*components), count,
|
||||
gf_server_mt_resolv_comp_t);
|
||||
if (!components)
|
||||
goto out;
|
||||
GF_VALIDATE_OR_GOTO ("server", components, out);
|
||||
|
||||
resolve->components = components;
|
||||
|
||||
components[0].basename = "";
|
||||
|
@ -43,6 +43,8 @@ gfs_serialize_reply (rpcsvc_request_t *req, void *arg, gfs_serialize_t sfunc,
|
||||
struct iobuf *iob = NULL;
|
||||
ssize_t retlen = -1;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", req, ret);
|
||||
|
||||
/* First, get the io buffer into which the reply in arg will
|
||||
* be serialized.
|
||||
*/
|
||||
@ -93,9 +95,7 @@ server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg,
|
||||
server_state_t *state = NULL;
|
||||
char new_iobref = 0;
|
||||
|
||||
if (!req) {
|
||||
goto ret;
|
||||
}
|
||||
GF_VALIDATE_OR_GOTO ("server", req, ret);
|
||||
|
||||
if (frame) {
|
||||
state = CALL_STATE (frame);
|
||||
@ -161,14 +161,13 @@ xdr_to_glusterfs_req (rpcsvc_request_t *req, void *arg, gfs_serialize_t sfunc)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
if (!req)
|
||||
return -1;
|
||||
GF_VALIDATE_OR_GOTO ("server", req, out);
|
||||
|
||||
ret = sfunc (req->msg[0], arg);
|
||||
|
||||
if (ret > 0)
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -181,8 +180,7 @@ server_fd (xlator_t *this)
|
||||
int i = 1;
|
||||
int ret = -1;
|
||||
|
||||
if (!this)
|
||||
return -1;
|
||||
GF_VALIDATE_OR_GOTO ("server", this, out);
|
||||
|
||||
conf = this->private;
|
||||
if (!conf) {
|
||||
@ -226,8 +224,9 @@ server_fd (xlator_t *this)
|
||||
}
|
||||
pthread_mutex_unlock (&conf->mutex);
|
||||
|
||||
|
||||
return 0;
|
||||
ret = 0;
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
@ -238,6 +237,9 @@ server_priv (xlator_t *this)
|
||||
char key[GF_DUMP_MAX_BUF_LEN] = {0,};
|
||||
uint64_t total_read = 0;
|
||||
uint64_t total_write = 0;
|
||||
int32_t ret = -1;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", this, out);
|
||||
|
||||
conf = this->private;
|
||||
if (!conf)
|
||||
@ -254,7 +256,9 @@ server_priv (xlator_t *this)
|
||||
gf_proc_dump_build_key(key, "server", "total-bytes-write");
|
||||
gf_proc_dump_write(key, "%"PRIu64, total_write);
|
||||
|
||||
return 0;
|
||||
ret = 0;
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
@ -266,8 +270,7 @@ server_inode (xlator_t *this)
|
||||
int i = 1;
|
||||
int ret = -1;
|
||||
|
||||
if (!this)
|
||||
return -1;
|
||||
GF_VALIDATE_OR_GOTO ("server", this, out);
|
||||
|
||||
conf = this->private;
|
||||
if (!conf) {
|
||||
@ -295,8 +298,9 @@ server_inode (xlator_t *this)
|
||||
}
|
||||
pthread_mutex_unlock (&conf->mutex);
|
||||
|
||||
|
||||
return 0;
|
||||
ret = 0;
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -309,6 +313,10 @@ get_auth_types (dict_t *this, char *key, data_t *value, void *data)
|
||||
char *key_cpy = NULL;
|
||||
int32_t ret = -1;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", this, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", key, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", data, out);
|
||||
|
||||
auth_dict = data;
|
||||
key_cpy = gf_strdup (key);
|
||||
GF_VALIDATE_OR_GOTO("server", key_cpy, out);
|
||||
@ -340,11 +348,14 @@ out:
|
||||
int
|
||||
validate_auth_options (xlator_t *this, dict_t *dict)
|
||||
{
|
||||
int error = 0;
|
||||
int error = -1;
|
||||
xlator_list_t *trav = NULL;
|
||||
data_pair_t *pair = NULL;
|
||||
char *tail = NULL;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("server", this, out);
|
||||
GF_VALIDATE_OR_GOTO ("server", dict, out);
|
||||
|
||||
trav = this->children;
|
||||
while (trav) {
|
||||
error = -1;
|
||||
@ -376,7 +387,7 @@ validate_auth_options (xlator_t *this, dict_t *dict)
|
||||
}
|
||||
trav = trav->next;
|
||||
}
|
||||
|
||||
out:
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -448,8 +459,7 @@ mem_acct_init (xlator_t *this)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
if (!this)
|
||||
return ret;
|
||||
GF_VALIDATE_OR_GOTO ("server", this, out);
|
||||
|
||||
ret = xlator_mem_acct_init (this, gf_server_mt_end + 1);
|
||||
|
||||
@ -458,7 +468,7 @@ mem_acct_init (xlator_t *this)
|
||||
"failed");
|
||||
return ret;
|
||||
}
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -635,8 +645,6 @@ reconfigure (xlator_t *this, dict_t *options)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
out:
|
||||
gf_log ("", GF_LOG_DEBUG, "returning %d", ret);
|
||||
return ret;
|
||||
@ -649,8 +657,7 @@ init (xlator_t *this)
|
||||
server_conf_t *conf = NULL;
|
||||
rpcsvc_listener_t *listener = NULL;
|
||||
|
||||
if (!this)
|
||||
goto out;
|
||||
GF_VALIDATE_OR_GOTO ("init", this, out);
|
||||
|
||||
if (this->children == NULL) {
|
||||
gf_log (this->name, GF_LOG_ERROR,
|
||||
@ -664,7 +671,9 @@ init (xlator_t *this)
|
||||
goto out;
|
||||
}
|
||||
|
||||
conf = GF_CALLOC (1, sizeof (server_conf_t), gf_server_mt_server_conf_t);
|
||||
conf = GF_CALLOC (1, sizeof (server_conf_t),
|
||||
gf_server_mt_server_conf_t);
|
||||
|
||||
GF_VALIDATE_OR_GOTO(this->name, conf, out);
|
||||
|
||||
INIT_LIST_HEAD (&conf->conns);
|
||||
|
@ -4946,8 +4946,7 @@ server_lookup (rpcsvc_request_t *req)
|
||||
gfs3_lookup_req args = {{0,},};
|
||||
int ret = -1;
|
||||
|
||||
if (!req)
|
||||
return ret;
|
||||
GF_VALIDATE_OR_GOTO ("server", req, err);
|
||||
|
||||
conn = req->trans->xl_private;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user