summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/stack.h
Commit message (Expand)AuthorAgeFilesLines
* client_t: phase 2, refactor server_ctx and locks_ctx outKaleb S. KEITHLEY2013-10-311-4/+5
* core: increase the auxillary group limit to 65536Anand Avati2013-07-241-2/+31
* libglusterfs/core: dump frame and callstack creation times in statedumpRaghavendra Bhat2013-02-061-34/+23
* core: add STACK_WIND_TAIL for more efficient default_xxx.Jeff Darcy2012-10-251-0/+14
* license: dual license under GPLV2 and LGPLV3+Kaleb KEITHLEY2012-05-101-14/+5
* syncop: Make syntask scalablePranith Kumar K2012-03-091-0/+18
* core: utilize mempool for frame->local allocationsAmar Tumballi2012-02-211-2/+2
* cli: Extend "volume status" with statedump infoKaushal M2012-01-271-1/+2
* core: change lk-owner as a 1k bufferAmar Tumballi2012-01-241-4/+5
* core/stack: perform locked windsAnand Avati2012-01-101-16/+35
* Proactive self heal process implementationPranith Kumar K2011-09-141-0/+1
* mem-pool: Make mem-pool ptr avialable in ptrshishir gowda2011-08-251-2/+2
* Change Copyright current yearPranith Kumar K2011-08-101-1/+1
* LICENSE: s/GNU Affero General Public/GNU General Public/Pranith Kumar K2011-08-061-3/+3
* stack: make process state dump more debug friendlyAnand Avati2011-06-191-0/+14
* spelling errors fixed across the code baseAmar Tumballi2011-03-221-1/+1
* libglusterfs: all header files updatedAmar Tumballi2011-03-171-183/+182
* cluster/afr: Perform self-heal as rootPranith K2011-02-081-0/+16
* features/access-control: skip access-tests if the call is from fusePranith K2011-01-261-0/+3
* Copyright changesVijay Bellur2010-10-111-1/+1
* Change GNU GPL to GNU AGPLPranith K2010-10-041-3/+3
* stack.h: remove the time/latency measurement codeAmar Tumballi2010-09-241-37/+0
* Fix memory corruption in mem poolshishir gowda2010-08-181-4/+4
* Implement mem pool for frame and stackshishir gowda2010-08-061-14/+27
* removed last few remaining 'ERR_ABORT's from codebaseAmar Tumballi2010-07-281-2/+8
* NULL dereference fixes in code base after running with 'clang'Amar Tumballi2010-07-021-1/+8
* dynamic volume changes for graph replacementAnand Avati2010-06-071-4/+4
* frame's 'op', 'type' restructuredAmar Tumballi2010-05-031-4/+3
* structuring of protocolAmar Tumballi2010-05-031-2/+0
* Memory accounting changesVijay Bellur2010-04-231-8/+11
* core: Do internal latency measurement of FOPs.Vikas Gorur2010-04-041-2/+54
* core: Provide helper macro to set [ug]id in frameShehjar Tikoo2010-03-041-0/+9
* protocol/server: Changes in protocol client to include lk_owner in protocol h...Pavan Vilas Sondur2009-12-031-0/+1
* mount/fuse: Use fuse lock_owner field in posix locks.Pavan Vilas Sondur2009-12-031-0/+2
* core, client, server: Support auxiliary group idsShehjar Tikoo2009-12-031-0/+6
* Changed occurrences of Z Research to Gluster.Vijay Bellur2009-10-071-1/+1
* libglusterfs: Add STACK_UNWIND_STRICT macro.Vikas Gorur2009-10-051-0/+18
* TAKE2[PATCH BUG:213 1/1] Support for Process State DumpVijay Bellur2009-08-191-1/+5
* write-behind: check for memory allocation failures and take appropriate actionRaghavendra G2009-06-151-0/+4
* THIS: set appropriately in STACK_* macrosAnand V. Avati2009-05-221-4/+21
* do away with frame->root->{req,rsp}_refs membersAnand V. Avati2009-04-121-2/+0
* updated copyright header to extend copyright upto 2009Basavanagowda Kanur2009-02-261-1/+1
* Added all filesVikas Gorur2009-02-181-0/+266
'>+ goto out;
+ }
+ }
+
+out:
+ if (ret && NULL != *volname) {
+ GF_FREE (*volname);
+ *volname = NULL;
+ }
+ return ret;
+}
+
static size_t
build_volfile_path (const char *volname, char *path,
size_t path_len, char *trusted_str)
{
- struct stat stbuf = {0,};
- int32_t ret = -1;
- glusterd_conf_t *priv = NULL;
- char *vol = NULL;
- char *dup_volname = NULL;
- char *free_ptr = NULL;
- char *save_ptr = NULL;
- char *str_token = NULL;
- char *snapname = NULL;
- char *snap_volname = NULL;
- glusterd_volinfo_t *parent_volinfo = NULL;
- glusterd_volinfo_t *volinfo = NULL;
- glusterd_snap_t *snap = NULL;
- char *server = NULL;
- gf_boolean_t snap_volume = _gf_false;
-
- priv = THIS->private;
+ struct stat stbuf = {0,};
+ int32_t ret = -1;
+ glusterd_conf_t *priv = NULL;
+ char *vol = NULL;
+ char *dup_volname = NULL;
+ char *free_ptr = NULL;
+ char *save_ptr = NULL;
+ char *str_token = NULL;
+ glusterd_volinfo_t *volinfo = NULL;
+ char *server = NULL;
+ const char *volname_ptr = NULL;
+ char path_prefix [PATH_MAX] = {0,};
+ xlator_t *this = NULL;
+
+ this = THIS;
+ GF_ASSERT (this);
+ priv = this->private;
+ GF_ASSERT (priv);
+ GF_ASSERT (volname);
+ GF_ASSERT (path);
if (strstr (volname, "gluster/")) {
server = strchr (volname, '/') + 1;
@@ -67,53 +179,21 @@ build_volfile_path (const char *volname, char *path,
ret = 1;
goto out;
} else if ((str_token = strstr (volname, "/snaps/"))) {
- /* Input volname will have below formats:
- /snaps/<snapname>/<volname>.<hostname>
- or
- /snaps/<snapname>/<parent-volname>
- We need to extract snapname and parent_volname */
-
- snap_volume = _gf_true;
-
- /*split string by "/" */
- str_token = strtok_r(str_token, "/", &save_ptr);
- snapname = strtok_r(NULL, "/", &save_ptr);
- if (!snapname) {
- gf_log(THIS->name, GF_LOG_ERROR, "Invalid path: %s",
- volname);
+ ret = get_snap_volname_and_volinfo (str_token, &dup_volname,
+ &volinfo);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to get snap"
+ " volinfo from path (%s)", volname);
ret = -1;
goto out;
}
- snap_volname = strtok_r(NULL, "/", &save_ptr);
- if (!snap_volname) {
- gf_log(THIS->name, GF_LOG_ERROR, "Invalid path: %s",
- volname);
- ret = -1;
- goto out;
- }
+ snprintf (path_prefix, sizeof (path_prefix), "%s/snaps/%s",
+ priv->workdir, volinfo->snapshot->snapname);
- snap = glusterd_find_snap_by_name (snapname);
- if (!snap) {
- gf_log(THIS->name, GF_LOG_ERROR, "Failed to "
- "fetch snap %s", snapname);
- ret = -1;
- goto out;
- }
- ret = glusterd_volinfo_find (snap_volname,
- &parent_volinfo);
- if (ret) {
- dup_volname = gf_strdup (snap_volname);
- } else {
- ret = glusterd_snap_volinfo_find_from_parent_volname
- (snap_volname, snap, &volinfo);
- if (ret) {
- gf_log(THIS->name, GF_LOG_ERROR, "Failed to "
- "fetch snap volume from parent volname");
- goto out;
- }
- dup_volname = gf_strdup (volinfo->volname);
- }
+ free_ptr = dup_volname;
+ volname_ptr = dup_volname;
+ goto gotvolinfo;
} else if (volname[0] != '/') {
/* Normal behavior */
dup_volname = gf_strdup (volname);
@@ -130,15 +210,12 @@ build_volfile_path (const char *volname, char *path,
goto out;
}
free_ptr = dup_volname;
+ volname_ptr = volname;
- if (!snap_volume) {
- ret = glusterd_volinfo_find (dup_volname, &volinfo);
- } else {
- ret = 0;
- if (!volinfo)
- ret = glusterd_snap_volinfo_find (dup_volname, snap,
- &volinfo);
- }
+ snprintf (path_prefix, sizeof (path_prefix), "%s/vols",
+ priv->workdir);
+
+ ret = glusterd_volinfo_find (dup_volname, &volinfo);
if (ret) {
/* Split the volume name */
@@ -146,57 +223,34 @@ build_volfile_path (const char *volname, char *path,
if (!vol)
goto out;
- if (!snap_volume) {
- ret = glusterd_volinfo_find (vol, &volinfo);
- } else {
- ret = glusterd_snap_volinfo_find (dup_volname, snap,
- &volinfo);
- }
-
+ ret = glusterd_volinfo_find (vol, &volinfo);
if (ret)
goto out;
}
+gotvolinfo:
if (!glusterd_auth_get_username (volinfo))
trusted_str = NULL;
- if (!snap_volume)
- ret = snprintf (path, path_len, "%s/vols/%s/%s.vol",
- priv->workdir, volinfo->volname, volname);
- else
- ret = snprintf (path, path_len, "%s/snaps/%s/%s/%s.vol",
- priv->workdir, volinfo->snapshot->snapname,
- volinfo->volname, snap_volname);
-
+ ret = snprintf (path, path_len, "%s/%s/%s.vol", path_prefix,
+ volinfo->volname, volname_ptr);
if (ret == -1)
goto out;
ret = stat (path, &stbuf);
if ((ret == -1) && (errno == ENOENT)) {
- if (!snap_volume)
- snprintf (path, path_len, "%s/vols/%s/%s%s-fuse.vol",
- priv->workdir, volinfo->volname,
- (trusted_str ? trusted_str : ""),
- dup_volname);
- else
- snprintf (path, path_len,
- "%s/snaps/%s/%s/%s%s-fuse.vol", priv->workdir,
- volinfo->snapshot->snapname, volinfo->volname,
- (trusted_str ? trusted_str:""), dup_volname);
+ snprintf (path, path_len, "%s/%s/%s%s-fuse.vol",
+ path_prefix, volinfo->volname,
+ (trusted_str ? trusted_str : ""),
+ dup_volname);
ret = stat (path, &stbuf);
}
if ((ret == -1) && (errno == ENOENT)) {
- if (!snap_volume)
- snprintf (path, path_len, "%s/vols/%s/%s-tcp.vol",
- priv->workdir, volinfo->volname, volname);
- else
- snprintf (path, path_len,
- "%s/snaps/%s/%s/%s-tcp.vol",
- priv->workdir, volinfo->snapshot->snapname,
- volinfo->volname, snap_volname);
+ snprintf (path, path_len, "%s/%s/%s-tcp.vol",
+ path_prefix, volinfo->volname, volname_ptr);
}
ret = 1;
@@ -1113,12 +1167,6 @@ glusterd_set_clnt_mgmt_program (glusterd_peerinfo_t *peerinfo,
ret = 0;
}
- if ((gd_mgmt_v3_prog.prognum == trav->prognum) &&
- (gd_mgmt_v3_prog.progver == trav->progver)) {
- peerinfo->mgmt_v3 = &gd_mgmt_v3_prog;
- ret = 0;
- }
-
if (ret) {
gf_log ("", GF_LOG_DEBUG,
"%s (%"PRId64":%"PRId64") not supported",
diff --git a/xlators/mgmt/glusterd/src/glusterd-locks.c b/xlators/mgmt/glusterd/src/glusterd-locks.c
index 36da3273f..0af2a186f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-locks.c
+++ b/xlators/mgmt/glusterd/src/glusterd-locks.c
@@ -26,9 +26,9 @@
#include <signal.h>
-#define MAX_LOCKING_ENTITIES 2
+#define GF_MAX_LOCKING_ENTITIES 2
-/* Valid entities that the mgt_v3 lock can hold locks upon *
+/* Valid entities that the mgmt_v3 lock can hold locks upon *
* To add newer entities to be locked, we can just add more *
* entries to this table along with the type and default value */
valid_entities valid_types[] = {
@@ -128,12 +128,11 @@ glusterd_release_multiple_locks_per_entity (dict_t *dict, uuid_t uuid,
int32_t ret = -1;
xlator_t *this = NULL;
- GF_ASSERT(THIS);
+ this = THIS;
+ GF_ASSERT(this);
GF_ASSERT (dict);
GF_ASSERT (type);
- this = THIS;
-
if (locked_count == 0) {
gf_log (this->name, GF_LOG_DEBUG,
"No %s locked as part of this transaction",
@@ -186,12 +185,11 @@ glusterd_acquire_multiple_locks_per_entity (dict_t *dict, uuid_t uuid,
int32_t locked_count = 0;
xlator_t *this = NULL;
- GF_ASSERT(THIS);
+ this = THIS;
+ GF_ASSERT(this);
GF_ASSERT (dict);
GF_ASSERT (type);
- this = THIS;
-
/* Locking one element after other */
for (i = 0; i < count; i++) {
snprintf (name_buf, sizeof(name_buf),
@@ -255,12 +253,11 @@ glusterd_mgmt_v3_unlock_entity (dict_t *dict, uuid_t uuid, char *type,
gf_boolean_t hold_locks = _gf_false;
xlator_t *this = NULL;
- GF_ASSERT(THIS);
+ this = THIS;
+ GF_ASSERT(this);
GF_ASSERT (dict);
GF_ASSERT (type);
- this = THIS;
-
snprintf (name_buf, sizeof(name_buf), "hold_%s_locks", type);
hold_locks = dict_get_str_boolean (dict, name_buf, default_value);
@@ -328,12 +325,11 @@ glusterd_mgmt_v3_lock_entity (dict_t *dict, uuid_t uuid, char *type,
gf_boolean_t hold_locks = _gf_false;
xlator_t *this = NULL;
- GF_ASSERT(THIS);
+ this = THIS;
+ GF_ASSERT(this);
GF_ASSERT (dict);
GF_ASSERT (type);
- this = THIS;
-
snprintf (name_buf, sizeof(name_buf), "hold_%s_locks", type);
hold_locks = dict_get_str_boolean (dict, name_buf, default_value);
@@ -395,8 +391,8 @@ glusterd_multiple_mgmt_v3_unlock (dict_t *dict, uuid_t uuid)
int32_t op_ret = 0;
xlator_t *this = NULL;
- GF_ASSERT(THIS);
this = THIS;
+ GF_ASSERT(this);
if (!dict) {
gf_log (this->name, GF_LOG_ERROR, "dict is null.");
@@ -433,8 +429,8 @@ glusterd_multiple_mgmt_v3_lock (dict_t *dict, uuid_t uuid)
int32_t locked_count = 0;
xlator_t *this = NULL;
- GF_ASSERT(THIS);
this = THIS;
+ GF_ASSERT(this);
if (!dict) {
gf_log (this->name, GF_LOG_ERROR, "dict is null.");
@@ -449,14 +445,15 @@ glusterd_multiple_mgmt_v3_lock (dict_t *dict, uuid_t uuid)
valid_types[i].type,
valid_types[i].default_value);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to lock all %s",
+ gf_log (this->name, GF_LOG_ERROR,
+ "Unable to lock all %s",
valid_types[i].type);
break;
}
locked_count++;
}
- if (locked_count == MAX_LOCKING_ENTITIES) {
+ if (locked_count == GF_MAX_LOCKING_ENTITIES) {
/* If all locking ops went successfuly, return as success */
ret = 0;
goto out;
diff --git a/xlators/mgmt/glusterd/src/glusterd-mem-types.h b/xlators/mgmt/glusterd/src/glusterd-mem-types.h
index c1009d66f..e6f6a0333 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mem-types.h
+++ b/xlators/mgmt/glusterd/src/glusterd-mem-types.h
@@ -68,7 +68,7 @@ typedef enum gf_gld_mem_types_ {
gf_gld_mt_mop_commit_req_t = gf_common_mt_end + 52,
gf_gld_mt_int = gf_common_mt_end + 53,
gf_gld_mt_snap_t = gf_common_mt_end + 54,
- gf_gld_mt_snap_cg_t = gf_common_mt_end + 55,
+ gf_gld_mt_missed_snapinfo_t = gf_common_mt_end + 55,
gf_gld_mt_end = gf_common_mt_end + 56,
} gf_gld_mem_types_t;
#endif
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
index a2546ca94..a5f38ce9c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
@@ -100,8 +100,6 @@ glusterd_op_state_machine_mgmt_v3_lock (rpcsvc_request_t *req,
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"Unable to set transaction's opinfo");
- if (ctx->dict)
- dict_unref (ctx->dict);
goto out;
}
@@ -188,11 +186,13 @@ out:
if (ret) {
if (ctx->dict)
- dict_destroy (ctx->dict);
+ dict_unref (ctx->dict);
if (ctx)
GF_FREE (ctx);
}
+ free (lock_req.dict.dict_val);
+
gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -254,7 +254,8 @@ glusterd_handle_pre_validate_fn (rpcsvc_request_t *req)
ret = xdr_to_generic (req->msg[0], &op_req,
(xdrproc_t)xdr_gd1_mgmt_v3_pre_val_req);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to decode pre validation "
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to decode pre validation "
"request received from peer");
req->rpc_err = GARBAGE_ARGS;
goto out;
@@ -294,7 +295,6 @@ glusterd_handle_pre_validate_fn (rpcsvc_request_t *req)
gf_log (this->name, GF_LOG_ERROR,
"Pre Validation failed on operation %s",
gd_op_list[op_req.op]);
- goto out;
}
ret = glusterd_mgmt_v3_pre_validate_send_resp (req, op_req.op,
@@ -314,6 +314,9 @@ out:
free (op_req.dict.dict_val);
+ if (dict)
+ dict_unref (dict);
+
if (rsp_dict)
dict_unref (rsp_dict);
@@ -418,7 +421,6 @@ glusterd_handle_brick_op_fn (rpcsvc_request_t *req)
gf_log (this->name, GF_LOG_ERROR,
"Brick Op failed on operation %s",
gd_op_list[op_req.op]);
- goto out;
}
ret = glusterd_mgmt_v3_brick_op_send_resp (req, op_req.op,
@@ -438,6 +440,9 @@ out:
free (op_req.dict.dict_val);
+ if (dict)
+ dict_unref (dict);
+
if (rsp_dict)
dict_unref (rsp_dict);
@@ -541,7 +546,6 @@ glusterd_handle_commit_fn (rpcsvc_request_t *req)
gf_log (this->name, GF_LOG_ERROR,
"commit failed on operation %s",
gd_op_list[op_req.op]);
- goto out;
}
ret = glusterd_mgmt_v3_commit_send_resp (req, op_req.op,
@@ -561,6 +565,9 @@ out:
free (op_req.dict.dict_val);
+ if (dict)
+ dict_unref (dict);
+
if (rsp_dict)
dict_unref (rsp_dict);
@@ -666,7 +673,6 @@ glusterd_handle_post_validate_fn (rpcsvc_request_t *req)
gf_log (this->name, GF_LOG_ERROR,
"Post Validation failed on operation %s",
gd_op_list[op_req.op]);
- goto out;
}
ret = glusterd_mgmt_v3_post_validate_send_resp (req, op_req.op,
@@ -686,6 +692,9 @@ out:
free (op_req.dict.dict_val);
+ if (dict)
+ dict_unref (dict);
+
if (rsp_dict)
dict_unref (rsp_dict);
@@ -842,11 +851,13 @@ out:
if (ret) {
if (ctx->dict)
- dict_destroy (ctx->dict);
+ dict_unref (ctx->dict);
if (ctx)
GF_FREE (ctx);
}
+ free (lock_req.dict.dict_val);
+
gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
index e24faa0be..d52532e54 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
@@ -25,13 +25,19 @@ extern struct rpc_clnt_program gd_mgmt_v3_prog;
static void
gd_mgmt_v3_collate_errors (struct syncargs *args, int op_ret, int op_errno,
- char *op_errstr, int op_code,
- glusterd_peerinfo_t *peerinfo, u_char *uuid)
+ char *op_errstr, int op_code,
+ glusterd_peerinfo_t *peerinfo, u_char *uuid)
{
- char err_str[PATH_MAX] = "Please check log file for details.";
- char op_err[PATH_MAX] = "";
- int len = -1;
- char *peer_str = NULL;
+ char *peer_str = NULL;
+ char err_str[PATH_MAX] = "Please check log file for details.";
+ char op_err[PATH_MAX] = "";
+ int32_t len = -1;
+ xlator_t *this = NULL