summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client/src
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2012-02-21 15:02:39 +0530
committerVijay Bellur <vijay@gluster.com>2012-02-21 01:42:42 -0800
commitbca46fd46b1a1a28daeb9ea3f47cef9bbacecd6d (patch)
tree161737d7de86c7310c5cba84900b64867005e740 /xlators/protocol/client/src
parent7197111677619da96c80572a09331d6e28c1015b (diff)
rpc/clnt: handle PARENT_DOWN event appropriately
Change-Id: I4644e944bad4d240d16de47786b9fa277333dba4 BUG: 767862 Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Amar Tumballi <amarts@redhat.com> Reviewed-on: http://review.gluster.com/2735 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/protocol/client/src')
-rw-r--r--xlators/protocol/client/src/client.c18
-rw-r--r--xlators/protocol/client/src/client.h2
-rw-r--r--xlators/protocol/client/src/client3_1-fops.c90
3 files changed, 83 insertions, 27 deletions
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index 8955e237d..acbc4829b 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -2062,7 +2062,7 @@ out:
int
notify (xlator_t *this, int32_t event, void *data, ...)
{
- clnt_conf_t *conf = NULL;
+ clnt_conf_t *conf = NULL;
conf = this->private;
if (!conf)
@@ -2076,8 +2076,22 @@ notify (xlator_t *this, int32_t event, void *data, ...)
"on transport");
rpc_clnt_start (conf->rpc);
+ break;
}
- break;
+
+ case GF_EVENT_PARENT_DOWN:
+ gf_log (this->name, GF_LOG_INFO,
+ "current graph is no longer active, destroying "
+ "rpc_client ");
+
+ pthread_mutex_lock (&conf->lock);
+ {
+ conf->parent_down = 1;
+ }
+ pthread_mutex_unlock (&conf->lock);
+
+ rpc_clnt_disable (conf->rpc);
+ break;
default:
gf_log (this->name, GF_LOG_DEBUG,
diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h
index 00addf34c..f7267b44a 100644
--- a/xlators/protocol/client/src/client.h
+++ b/xlators/protocol/client/src/client.h
@@ -98,6 +98,8 @@ typedef struct clnt_conf {
performing lock healing */
struct timeval grace_tv;
gf_timer_t *grace_timer;
+
+ char parent_down;
} clnt_conf_t;
typedef struct _client_fd_ctx {
diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c
index 4d6d57528..0bc91527a 100644
--- a/xlators/protocol/client/src/client3_1-fops.c
+++ b/xlators/protocol/client/src/client3_1-fops.c
@@ -31,6 +31,7 @@ int32_t client3_getspec (call_frame_t *frame, xlator_t *this, void *data);
void client_start_ping (void *data);
rpc_clnt_prog_t clnt3_1_fop_prog;
+
int
client_submit_vec_request (xlator_t *this, void *req, call_frame_t *frame,
rpc_clnt_prog_t *prog, int procnum, fop_cbk_fn_t cbk,
@@ -1838,8 +1839,9 @@ client3_1_readdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
gf_log (this->name, GF_LOG_WARNING,
- "remote operation failed: %s",
- strerror (gf_error_to_errno (rsp.op_errno)));
+ "remote operation failed: %s remote_fd = %d",
+ strerror (gf_error_to_errno (rsp.op_errno)),
+ local->cmd);
}
STACK_UNWIND_STRICT (readdir, frame, rsp.op_ret,
gf_error_to_errno (rsp.op_errno), &entries);
@@ -2343,12 +2345,13 @@ int32_t
client3_1_releasedir (call_frame_t *frame, xlator_t *this,
void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- clnt_args_t *args = NULL;
- gfs3_releasedir_req req = {{0,},};
- int64_t remote_fd = -1;
- int ret = 0;
+ clnt_conf_t *conf = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_releasedir_req req = {{0,},};
+ int64_t remote_fd = -1;
+ int ret = 0;
+ char parent_down = 0;
if (!frame || !this || !data)
goto unwind;
@@ -2376,12 +2379,29 @@ client3_1_releasedir (call_frame_t *frame, xlator_t *this,
pthread_mutex_unlock (&conf->lock);
if (remote_fd != -1) {
- req.fd = remote_fd;
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_RELEASEDIR,
- client3_1_releasedir_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_releasedir_req);
+ pthread_mutex_lock (&conf->lock);
+ {
+ parent_down = conf->parent_down;
+ if (!parent_down) {
+ rpc_clnt_ref (conf->rpc);
+ }
+ }
+ pthread_mutex_unlock (&conf->lock);
+
+ if (!parent_down) {
+ req.fd = remote_fd;
+
+ ret = client_submit_request (this, &req, frame,
+ conf->fops,
+ GFS3_OP_RELEASEDIR,
+ client3_1_releasedir_cbk,
+ NULL, NULL, 0, NULL, 0,
+ NULL,
+ (xdrproc_t)xdr_gfs3_releasedir_req);
+
+ rpc_clnt_unref (conf->rpc);
+ }
+
inode_unref (fdctx->inode);
GF_FREE (fdctx);
}
@@ -2397,12 +2417,13 @@ int32_t
client3_1_release (call_frame_t *frame, xlator_t *this,
void *data)
{
- int64_t remote_fd = -1;
- clnt_conf_t *conf = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- clnt_args_t *args = NULL;
- gfs3_release_req req = {{0,},};
- int ret = 0;
+ int64_t remote_fd = -1;
+ clnt_conf_t *conf = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_release_req req = {{0,},};
+ int ret = 0;
+ char parent_down = 0;
if (!frame || !this || !data)
goto unwind;
@@ -2434,11 +2455,26 @@ client3_1_release (call_frame_t *frame, xlator_t *this,
delete_granted_locks_fd (fdctx);
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_RELEASE,
- client3_1_release_cbk, NULL, NULL,
- 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_release_req);
+ pthread_mutex_lock (&conf->lock);
+ {
+ parent_down = conf->parent_down;
+ if (!parent_down) {
+ rpc_clnt_ref (conf->rpc);
+ }
+ }
+ pthread_mutex_unlock (&conf->lock);
+
+ if (!parent_down) {
+ ret = client_submit_request (this, &req, frame,
+ conf->fops,
+ GFS3_OP_RELEASE,
+ client3_1_release_cbk,
+ NULL, NULL,
+ 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_release_req);
+ rpc_clnt_unref (conf->rpc);
+ }
+
inode_unref (fdctx->inode);
GF_FREE (fdctx);
}
@@ -3612,6 +3648,7 @@ client3_1_fsync (call_frame_t *frame, xlator_t *this,
req.data = args->flags;
memcpy (req.gfid, args->fd->inode->gfid, 16);
+
ret = client_submit_request (this, &req, frame, conf->fops,
GFS3_OP_FSYNC, client3_1_fsync_cbk, NULL,
NULL, 0, NULL, 0,
@@ -4916,6 +4953,9 @@ client3_1_readdir (call_frame_t *frame, xlator_t *this,
req.size = args->size;
req.offset = args->offset;
req.fd = remote_fd;
+
+ local->cmd = remote_fd;
+
memcpy (req.gfid, args->fd->inode->gfid, 16);
ret = client_submit_request (this, &req, frame, conf->fops,