diff options
author | Jeff Darcy <jdarcy@redhat.com> | 2014-03-04 14:42:40 +0000 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2014-03-04 14:42:40 +0000 |
commit | 0de07f4189cbd191a765c60ed3d7c72f72112e68 (patch) | |
tree | 83781a0df06c9110c6f3db12caad23ea00832b53 /api | |
parent | c28972ea53cc7cdb91c7aac01754dd7f0b66e1a7 (diff) | |
parent | 9f45d0f6212d6d5c96dafc4aba73d9d12b39c3d6 (diff) |
Merge branch 'upstream' into merge
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Conflicts:
api/src/glfs-fops.c
libglusterfs/src/syncop.c
libglusterfs/src/syncop.h
Change-Id: I8c3fa7a20fb167d9e6bc2749e177c0c8b366827b
Diffstat (limited to 'api')
-rw-r--r-- | api/src/glfs-mgmt.c | 48 | ||||
-rw-r--r-- | api/src/glfs-resolve.c | 4 | ||||
-rw-r--r-- | api/src/glfs.c | 14 |
3 files changed, 47 insertions, 19 deletions
diff --git a/api/src/glfs-mgmt.c b/api/src/glfs-mgmt.c index 6843e9cb3..afb351da0 100644 --- a/api/src/glfs-mgmt.c +++ b/api/src/glfs-mgmt.c @@ -236,11 +236,19 @@ mgmt_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count, int ret = 0; ssize_t size = 0; FILE *tmpfp = NULL; - int need_retry = 0; + int need_retry = 0; struct glfs *fs = NULL; frame = myframe; ctx = frame->this->ctx; + + if (!ctx) { + gf_log (frame->this->name, GF_LOG_ERROR, "NULL context"); + errno = EINVAL; + ret = -1; + goto out; + } + fs = ((xlator_t *)ctx->master)->private; if (-1 == req->rpc_status) { @@ -260,7 +268,7 @@ mgmt_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count, gf_log (frame->this->name, GF_LOG_ERROR, "failed to get the 'volume file' from server"); ret = -1; - errno = rsp.op_errno; + errno = rsp.op_errno; goto out; } @@ -296,7 +304,7 @@ mgmt_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count, */ ret = glusterfs_volfile_reconfigure (fs->oldvollen, tmpfp, fs->ctx, - fs->oldvolfile); + fs->oldvolfile); if (ret == 0) { gf_log ("glusterfsd-mgmt", GF_LOG_DEBUG, "No need to re-load volfile, reconfigure done"); @@ -323,13 +331,13 @@ out: if (rsp.spec) free (rsp.spec); - // Stop if server is running at an unsupported op-version - if (ENOTSUP == ret) { - gf_log ("mgmt", GF_LOG_ERROR, "Server is operating at an " - "op-version which is not supported"); - errno = ENOTSUP; - glfs_init_done (fs, -1); - } + // Stop if server is running at an unsupported op-version + if (ENOTSUP == ret) { + gf_log ("mgmt", GF_LOG_ERROR, "Server is operating at an " + "op-version which is not supported"); + errno = ENOTSUP; + glfs_init_done (fs, -1); + } if (ret && ctx && !ctx->active) { /* Do it only for the first time */ @@ -339,10 +347,10 @@ out: "failed to fetch volume file (key:%s)", ctx->cmd_args.volfile_id); if (!need_retry) { - if (!errno) - errno = EINVAL; + if (!errno) + errno = EINVAL; glfs_init_done (fs, -1); - } + } } if (tmpfp) @@ -420,6 +428,10 @@ mgmt_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, this = mydata; ctx = this->ctx; + + if (!ctx) + goto out; + fs = ((xlator_t *)ctx->master)->private; cmd_args = &ctx->cmd_args; @@ -434,22 +446,22 @@ mgmt_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, "%d connect attempts left", cmd_args->max_connect_attempts); if (0 >= cmd_args->max_connect_attempts) { - errno = ENOTCONN; + errno = ENOTCONN; glfs_init_done (fs, -1); - } + } } break; case RPC_CLNT_CONNECT: rpc_clnt_set_connected (&((struct rpc_clnt*)ctx->mgmt)->conn); ret = glfs_volfile_fetch (fs); - if (ret && ctx && (ctx->active == NULL)) { + if (ret && (ctx->active == NULL)) { /* Do it only for the first time */ /* Exit the process.. there are some wrong options */ gf_log ("glfs-mgmt", GF_LOG_ERROR, "failed to fetch volume file (key:%s)", ctx->cmd_args.volfile_id); - errno = EINVAL; + errno = EINVAL; glfs_init_done (fs, -1); } @@ -457,7 +469,7 @@ mgmt_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, default: break; } - +out: return 0; } diff --git a/api/src/glfs-resolve.c b/api/src/glfs-resolve.c index 0ad9ce723..7cd1e47bc 100644 --- a/api/src/glfs-resolve.c +++ b/api/src/glfs-resolve.c @@ -450,7 +450,9 @@ glfs_resolve_at (struct glfs *fs, xlator_t *subvol, inode_t *at, ret = 0; } - ret = glfs_loc_touchup (loc); + if (glfs_loc_touchup (loc) < 0) { + ret = -1; + } out: GF_FREE (path); diff --git a/api/src/glfs.c b/api/src/glfs.c index 174076e39..ea10fb55c 100644 --- a/api/src/glfs.c +++ b/api/src/glfs.c @@ -589,6 +589,13 @@ glfs_init_async (struct glfs *fs, glfs_init_cbk cbk) { int ret = -1; + if (!fs || !fs->ctx) { + gf_log ("glfs", GF_LOG_ERROR, + "fs is not properly initialized."); + errno = EINVAL; + return ret; + } + fs->init_cbk = cbk; ret = glfs_init_common (fs); @@ -602,6 +609,13 @@ glfs_init (struct glfs *fs) { int ret = -1; + if (!fs || !fs->ctx) { + gf_log ("glfs", GF_LOG_ERROR, + "fs is not properly initialized."); + errno = EINVAL; + return ret; + } + ret = glfs_init_common (fs); if (ret) return ret; |