summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-09-07 12:59:07 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-07 11:40:16 -0700
commit171973d18d22e4f0f4117656c188d395bf3ac8a5 (patch)
treec30cd65a61c17fe72b83e8a2104e21855380186f
parent8c8e5b25779f68c646ec00003a7bb2101e55cbc0 (diff)
in case of failures, don't hang fuse mount
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1527 (mount time defunct window with remote volumes) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1527
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c33
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c27
2 files changed, 53 insertions, 7 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index f409386bb4f..a4a7422cfcf 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -174,33 +174,35 @@ mgmt_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count,
ctx = frame->this->ctx;
if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
+ ret = -1;
goto out;
}
ret = xdr_to_getspec_rsp (*iov, &rsp);
if (ret < 0) {
gf_log (frame->this->name, GF_LOG_ERROR, "error");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
+ ret = -1;
goto out;
}
if (-1 == rsp.op_ret) {
gf_log (frame->this->name, GF_LOG_ERROR,
"failed to get the 'volume file' from server");
+ ret = -1;
goto out;
}
+ ret = 0;
size = rsp.op_ret;
if (size == oldvollen && (memcmp (oldvolfile, rsp.spec, size) == 0))
goto out;
tmpfp = tmpfile ();
- if (!tmpfp)
+ if (!tmpfp) {
+ ret = -1;
goto out;
+ }
fwrite (rsp.spec, size, 1, tmpfp);
fflush (tmpfp);
@@ -222,6 +224,12 @@ out:
if (rsp.spec)
free (rsp.spec);
+ if (ret && ctx && ctx->master) {
+ /* Failed to get the volume file, start fuse anyways */
+ xlator_notify (ctx->master,
+ GF_EVENT_CHILD_CONNECTING, NULL);
+
+ }
return 0;
}
@@ -263,12 +271,25 @@ mgmt_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
case RPC_CLNT_CONNECT:
rpc_clnt_set_connected (ctx->mgmt);
- ret = glusterfs_volfile_fetch (ctx);
+ ret = glusterfs_volfile_fetch (ctx);
+ if (ret && ctx && ctx->master) {
+ /* Failed to get the volume file, start fuse anyways */
+ xlator_notify (ctx->master,
+ GF_EVENT_CHILD_CONNECTING, NULL);
+
+ gf_log ("", GF_LOG_WARNING,
+ "failed to fetch volume file");
+ }
if (is_mgmt_rpc_reconnect)
glusterfs_mgmt_pmap_signin (ctx);
break;
default:
+ if (ctx->master)
+ ret = xlator_notify (ctx->master,
+ GF_EVENT_CHILD_CONNECTING, NULL);
+ gf_log ("", GF_LOG_WARNING,
+ "failed to establish mgmt rpc connection (%d)", ret);
break;
}
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 4de9685d13e..18a4d7aee77 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -3290,6 +3290,30 @@ notify (xlator_t *this, int32_t event, void *data, ...)
break;
case GF_EVENT_CHILD_CONNECTING:
+ {
+ if (!private->fuse_thread_started) {
+ private->fuse_thread_started = 1;
+
+ ret = pthread_create (&private->fuse_thread, NULL,
+ fuse_thread_proc, this);
+ if (ret != 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "pthread_create() failed (%s)",
+ strerror (errno));
+ break;
+ }
+ }
+
+ if (data) {
+ graph = data;
+ ret = fuse_graph_setup (this, graph);
+ if (ret)
+ gf_log (this->name, GF_LOG_WARNING,
+ "failed to setup the graph");
+ }
+
+ break;
+ }
case GF_EVENT_CHILD_UP:
{
/* set priv->active_subvol */
@@ -3297,7 +3321,8 @@ notify (xlator_t *this, int32_t event, void *data, ...)
graph = data;
ret = fuse_graph_setup (this, graph);
if (ret)
- break;
+ gf_log (this->name, GF_LOG_WARNING,
+ "failed to setup the graph");
if (!private->fuse_thread_started) {
private->fuse_thread_started = 1;