diff options
author | Amar Tumballi <amar@gluster.com> | 2010-09-10 05:53:59 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-09-10 06:13:57 -0700 |
commit | 5bec5e4fd6b0cae5e7a5e4d0a72090f4d613b94e (patch) | |
tree | d59d335fa51f224e9f02dc8779816cd60f043d91 /glusterfsd/src | |
parent | 4aada05a7a2b21d4c5275812a6e8f838e3a10512 (diff) |
glusterfsd: exit process instead of starting fuse in case of failures
Signed-off-by: Amar Tumballi <amar@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1586 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1586
Diffstat (limited to 'glusterfsd/src')
-rw-r--r-- | glusterfsd/src/glusterfsd-mgmt.c | 34 | ||||
-rw-r--r-- | glusterfsd/src/glusterfsd.c | 2 | ||||
-rw-r--r-- | glusterfsd/src/glusterfsd.h | 2 |
3 files changed, 19 insertions, 19 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c index a4a7422cfcf..c674533e492 100644 --- a/glusterfsd/src/glusterfsd-mgmt.c +++ b/glusterfsd/src/glusterfsd-mgmt.c @@ -38,6 +38,8 @@ #include "glusterfs3.h" #include "portmap.h" +#include "glusterfsd.h" + static char is_mgmt_rpc_reconnect; typedef ssize_t (*mgmt_serialize_t) (struct iovec outmsg, void *args); @@ -224,11 +226,14 @@ 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); - + if (ret && ctx && !ctx->active) { + /* Do it only for the first time */ + /* Failed to get the volume file, something wrong, + restart the process */ + gf_log ("mgmt", GF_LOG_ERROR, + "failed to fetch volume file (key:%s)", + ctx->cmd_args.volfile_id); + cleanup_and_exit (0); } return 0; } @@ -272,24 +277,19 @@ mgmt_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, rpc_clnt_set_connected (ctx->mgmt); 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 (ret && ctx && (ctx->active == NULL)) { + /* Do it only for the first time */ + /* Exit the process.. there is some wrong options */ + gf_log ("mgmt", GF_LOG_ERROR, + "failed to fetch volume file (key:%s)", + ctx->cmd_args.volfile_id); + cleanup_and_exit (0); } 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/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 36fc86af4c1..bd2d704b800 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -633,7 +633,7 @@ parse_opts (int key, char *arg, struct argp_state *state) } -static void +void cleanup_and_exit (int signum) { glusterfs_ctx_t *ctx = NULL; diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h index c0789b6d202..9584c19b24a 100644 --- a/glusterfsd/src/glusterfsd.h +++ b/glusterfsd/src/glusterfsd.h @@ -80,6 +80,6 @@ enum argp_option_keys { int glusterfs_mgmt_pmap_signout (glusterfs_ctx_t *ctx); int glusterfs_mgmt_pmap_signin (glusterfs_ctx_t *ctx); int glusterfs_volfile_fetch (glusterfs_ctx_t *ctx); - +void cleanup_and_exit (int signum); #endif /* __GLUSTERFSD_H__ */ |