summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client/src
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-07-28 04:23:57 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-07-28 03:34:58 -0700
commit550cdfbcf2a5300c926f87403e12f19424bffeac (patch)
tree21322ead4b1cbb9564e37c96deb7930009e0197d /xlators/protocol/client/src
parent927aedbb556ee07250248181f52642eeb6de9e58 (diff)
fix all clang errors in xlator/protocol
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1092 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1092
Diffstat (limited to 'xlators/protocol/client/src')
-rw-r--r--xlators/protocol/client/src/client-handshake.c45
-rw-r--r--xlators/protocol/client/src/client.c13
-rw-r--r--xlators/protocol/client/src/client3_1-fops.c62
3 files changed, 68 insertions, 52 deletions
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index 1cd25424f5f..9a806f7e9dd 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -126,13 +126,11 @@ client_start_ping (void *data)
struct timeval timeout = {0, };
call_frame_t *frame = NULL;
int frame_count = 0;
- rpc_transport_t *trans = NULL;
this = data;
conf = this->private;
conn = &conf->rpc->conn;
- trans = conn->trans;
if (conf->opt.ping_timeout == 0)
return;
@@ -256,15 +254,14 @@ out:
int
-client3_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count, void *myframe)
+client3_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
gf_getspec_rsp rsp = {0,};
call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
int ret = 0;
frame = myframe;
- conf = frame->this->private;
if (-1 == req->rpc_status) {
rsp.op_ret = -1;
@@ -385,12 +382,10 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m
char *process_uuid = NULL;
char *remote_error = NULL;
char *remote_subvol = NULL;
- rpc_transport_t *peer_trans = NULL;
gf_setvolume_rsp rsp = {0,};
- uint64_t peertrans_int = 0;
int ret = 0;
- int op_ret = 0;
- int op_errno = 0;
+ int32_t op_ret = 0;
+ int32_t op_errno = 0;
frame = myframe;
this = frame->this;
@@ -398,14 +393,12 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m
if (-1 == req->rpc_status) {
op_ret = -1;
- op_errno = EINVAL;
goto out;
}
ret = xdr_to_setvolume_rsp (*iov, &rsp);
if (ret < 0) {
gf_log ("", GF_LOG_ERROR, "error");
- op_errno = EINVAL;
op_ret = -1;
goto out;
}
@@ -460,25 +453,30 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m
}
ret = dict_get_str (this->options, "remote-subvolume",
&remote_subvol);
- if (!remote_subvol)
+ if (ret || !remote_subvol)
goto out;
- if (process_uuid &&
+ /* TODO: currently setpeer path is broken */
+ /*
+ if (process_uuid && req->conn &&
!strcmp (this->ctx->process_uuid, process_uuid)) {
+ rpc_transport_t *peer_trans = NULL;
+ uint64_t peertrans_int = 0;
+
ret = dict_get_uint64 (reply, "transport-ptr",
&peertrans_int);
-
- peer_trans = (void *) (long) (peertrans_int);
+ if (ret)
+ goto out;
gf_log (this->name, GF_LOG_WARNING,
"attaching to the local volume '%s'",
remote_subvol);
- if (req->conn) {
- /* TODO: Some issues with this logic at present */
- //rpc_transport_setpeer (req->conn->trans, peer_trans);
- }
+ peer_trans = (void *) (long) (peertrans_int);
+
+ rpc_transport_setpeer (req->conn->trans, peer_trans);
}
+ */
gf_log (this->name, GF_LOG_NORMAL,
"Connected to %s, attached to remote volume '%s'.",
@@ -572,11 +570,18 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc)
}
if (this->ctx->cmd_args.volfile_server) {
- if (this->ctx->cmd_args.volfile_id)
+ if (this->ctx->cmd_args.volfile_id) {
ret = dict_set_str (options, "volfile-key",
this->ctx->cmd_args.volfile_id);
+ if (ret)
+ gf_log (this->name, GF_LOG_ERROR,
+ "failed to set 'volfile-key'");
+ }
ret = dict_set_uint32 (options, "volfile-checksum",
this->graph->volfile_checksum);
+ if (ret)
+ gf_log (this->name, GF_LOG_ERROR,
+ "failed to set 'volfile-checksum'");
}
req.dict.dict_len = dict_serialized_length (options);
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index 97d9644342e..383f52bc972 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -154,6 +154,9 @@ client_releasedir (xlator_t *this, fd_t *fd)
ret = proc->fn (frame, this, &args);
}
out:
+ if (ret)
+ gf_log (this->name, GF_LOG_TRACE,
+ "releasedir fop failed");
return 0;
}
@@ -180,6 +183,9 @@ client_release (xlator_t *this, fd_t *fd)
ret = proc->fn (frame, this, &args);
}
out:
+ if (ret)
+ gf_log (this->name, GF_LOG_TRACE,
+ "release fop failed");
return 0;
}
@@ -1394,10 +1400,15 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
if ((ret < 0) || (strcasecmp (handshake, "on"))) {
ret = client_handshake (this, conf->rpc);
-
+ if (ret)
+ gf_log (this->name, GF_LOG_DEBUG,
+ "handshake msg returned %d", ret);
} else {
//conf->rpc->connected = 1;
ret = default_notify (this, GF_EVENT_CHILD_UP, NULL);
+ if (ret)
+ gf_log (this->name, GF_LOG_DEBUG,
+ "default notify failed");
}
break;
}
diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c
index a007803b7c3..136f84bf560 100644
--- a/xlators/protocol/client/src/client3_1-fops.c
+++ b/xlators/protocol/client/src/client3_1-fops.c
@@ -1194,7 +1194,8 @@ client3_1_xattrop_cbk (struct rpc_req *req, struct iovec *iov, int count,
goto out;
}
- op_ret = rsp.op_ret;
+ op_errno = rsp.op_errno;
+ op_ret = rsp.op_ret;
if (-1 != op_ret) {
op_ret = -1;
dict_len = rsp.dict.dict_len;
@@ -1221,7 +1222,7 @@ client3_1_xattrop_cbk (struct rpc_req *req, struct iovec *iov, int count,
out:
STACK_UNWIND_STRICT (xattrop, frame, op_ret,
- gf_error_to_errno (rsp.op_errno), dict);
+ gf_error_to_errno (op_errno), dict);
if (rsp.dict.dict_val) {
/* don't use GF_FREE, this memory was allocated by libc
@@ -1267,8 +1268,8 @@ client3_1_fxattrop_cbk (struct rpc_req *req, struct iovec *iov, int count,
gf_log ("", GF_LOG_ERROR, "error");
goto out;
}
-
- op_ret = rsp.op_ret;
+ op_errno = rsp.op_errno;
+ op_ret = rsp.op_ret;
if (-1 != op_ret) {
op_ret = -1;
dict_len = rsp.dict.dict_len;
@@ -1295,7 +1296,7 @@ client3_1_fxattrop_cbk (struct rpc_req *req, struct iovec *iov, int count,
out:
STACK_UNWIND_STRICT (fxattrop, frame, op_ret,
- gf_error_to_errno (rsp.op_errno), dict);
+ gf_error_to_errno (op_errno), dict);
if (rsp.dict.dict_val) {
/* don't use GF_FREE, this memory was allocated by libc
@@ -1895,33 +1896,32 @@ client3_1_lookup_cbk (struct rpc_req *req, struct iovec *iov, int count,
gf_stat_to_iatt (&rsp.stat, &stbuf);
ret = inode_ctx_get2 (inode, frame->this, &oldino, &oldgen);
- if (oldino != stbuf.ia_ino || oldgen != stbuf.ia_gen) {
- if (oldino) {
- gf_log (frame->this->name, GF_LOG_DEBUG,
- "LOOKUP %"PRId64"/%s (%s): "
- "inode number changed from "
- "{%"PRId64",%"PRId64"} to {%"PRId64",%"PRId64"}",
- local->loc.parent ?
- local->loc.parent->ino : (uint64_t) 0,
- local->loc.name,
- local->loc.path,
- oldgen, oldino, stbuf.ia_gen, stbuf.ia_ino);
- op_errno = ESTALE;
- goto out;
- }
+ if ((!ret) && ((oldino != stbuf.ia_ino) ||
+ (oldgen != stbuf.ia_gen))) {
+ gf_log (frame->this->name, GF_LOG_DEBUG,
+ "LOOKUP %"PRId64"/%s (%s): "
+ "inode number changed from "
+ "{%"PRId64",%"PRId64"} to {%"PRId64",%"PRId64"}",
+ local->loc.parent ?
+ local->loc.parent->ino : (uint64_t) 0,
+ local->loc.name,
+ local->loc.path,
+ oldgen, oldino, stbuf.ia_gen, stbuf.ia_ino);
+ op_errno = ESTALE;
+ goto out;
+ }
- ret = inode_ctx_put2 (inode, frame->this,
- stbuf.ia_ino, stbuf.ia_gen);
- if (ret < 0) {
- gf_log (frame->this->name, GF_LOG_DEBUG,
- "LOOKUP %"PRId64"/%s (%s) : "
- "failed to set remote inode "
- "number to inode ctx",
- local->loc.parent ?
- local->loc.parent->ino : (uint64_t) 0,
- local->loc.name,
- local->loc.path);
- }
+ ret = inode_ctx_put2 (inode, frame->this,
+ stbuf.ia_ino, stbuf.ia_gen);
+ if (ret < 0) {
+ gf_log (frame->this->name, GF_LOG_DEBUG,
+ "LOOKUP %"PRId64"/%s (%s) : "
+ "failed to set remote inode "
+ "number to inode ctx",
+ local->loc.parent ?
+ local->loc.parent->ino : (uint64_t) 0,
+ local->loc.name,
+ local->loc.path);
}
if (rsp.dict.dict_len > 0) {