summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/marker/src/marker-common.c2
-rw-r--r--xlators/features/marker/src/marker-quota-helper.c18
-rw-r--r--xlators/features/marker/src/marker-quota.c40
-rw-r--r--xlators/features/marker/src/marker-quota.h2
4 files changed, 35 insertions, 27 deletions
diff --git a/xlators/features/marker/src/marker-common.c b/xlators/features/marker/src/marker-common.c
index 855fb9936..a9431b628 100644
--- a/xlators/features/marker/src/marker-common.c
+++ b/xlators/features/marker/src/marker-common.c
@@ -43,7 +43,7 @@ marker_force_inode_ctx_get (inode_t *inode, xlator_t *this,
marker_inode_ctx_t **ctx)
{
int32_t ret = -1;
- uint64_t ctx_int;
+ uint64_t ctx_int = 0;
LOCK (&inode->lock);
{
diff --git a/xlators/features/marker/src/marker-quota-helper.c b/xlators/features/marker/src/marker-quota-helper.c
index b6a87698e..d7afd40a6 100644
--- a/xlators/features/marker/src/marker-quota-helper.c
+++ b/xlators/features/marker/src/marker-quota-helper.c
@@ -190,7 +190,7 @@ add_new_contribution_node (xlator_t *this, quota_inode_ctx_t *ctx, loc_t *loc)
{
inode_contribution_t *contribution = NULL;
- if (ctx == NULL || loc == NULL)
+ if ((ctx == NULL) || (loc == NULL))
return NULL;
if (strcmp (loc->path, "/") == 0)
@@ -213,6 +213,10 @@ dict_set_contribution (xlator_t *this, dict_t *dict,
int32_t ret = -1;
char contri_key [512] = {0, };
+ GF_VALIDATE_OR_GOTO ("marker", this, out);
+ GF_VALIDATE_OR_GOTO ("marker", dict, out);
+ GF_VALIDATE_OR_GOTO ("marker", loc, out);
+
GET_CONTRI_KEY (contri_key, loc->parent->gfid, ret);
if (ret < 0) {
ret = -1;
@@ -222,7 +226,8 @@ dict_set_contribution (xlator_t *this, dict_t *dict,
ret = dict_set_int64 (dict, contri_key, 0);
if (ret < 0) {
gf_log (this->name, GF_LOG_WARNING,
- "unable to set dict value.");
+ "unable to set dict value on %s.",
+ loc->path);
goto out;
}
@@ -251,7 +256,7 @@ quota_inode_ctx_get (inode_t *inode, xlator_t *this,
goto out;
}
- mark_ctx = (marker_inode_ctx_t *) ctx_int;
+ mark_ctx = (marker_inode_ctx_t *) (unsigned long)ctx_int;
if (mark_ctx->quota_ctx == NULL) {
ret = -1;
goto out;
@@ -289,13 +294,14 @@ __quota_inode_ctx_new (inode_t *inode, xlator_t *this)
goto unlock;
}
mark_ctx->quota_ctx = quota_ctx;
- } else
+ } else {
quota_ctx = mark_ctx->quota_ctx;
+ }
ret = 0;
}
-unlock: UNLOCK (&inode->lock);
-
+unlock:
+ UNLOCK (&inode->lock);
out:
return quota_ctx;
}
diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c
index 0e457e58b..e2cb6ba67 100644
--- a/xlators/features/marker/src/marker-quota.c
+++ b/xlators/features/marker/src/marker-quota.c
@@ -31,12 +31,17 @@
#include "marker-quota-helper.h"
int32_t
-loc_fill_from_name (xlator_t *this, loc_t *newloc, loc_t *oldloc, uint64_t ino, char *name)
+loc_fill_from_name (xlator_t *this, loc_t *newloc, loc_t *oldloc,
+ uint64_t ino, char *name)
{
- int32_t ret = 0;
+ int32_t ret = -1;
int32_t len = 0;
char *path = NULL;
+ GF_VALIDATE_OR_GOTO ("marker", this, out);
+ GF_VALIDATE_OR_GOTO ("marker", newloc, out);
+ GF_VALIDATE_OR_GOTO ("marker", oldloc, out);
+ GF_VALIDATE_OR_GOTO ("marker", name, out);
newloc->ino = ino;
@@ -68,7 +73,8 @@ loc_fill_from_name (xlator_t *this, loc_t *newloc, loc_t *oldloc, uint64_t ino,
if (newloc->name)
newloc->name++;
- gf_log (this->name, GF_LOG_INFO, "path = %s name =%s",newloc->path, newloc->name);
+ gf_log (this->name, GF_LOG_DEBUG, "path = %s name =%s",
+ newloc->path, newloc->name);
out:
return ret;
}
@@ -199,12 +205,20 @@ update_size_xattr (call_frame_t *frame, void *cookie, xlator_t *this,
priv = this->private;
- if (!dict)
+ if (dict == NULL) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "Dict is null while updating the size xattr %s",
+ local->loc.path?local->loc.path:"");
goto err;
+ }
ret = dict_get_bin (dict, QUOTA_SIZE_KEY, (void **) &size);
- if (!size)
+ if (!size) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "failed to get the size, %s",
+ local->loc.path?local->loc.path:"");
goto err;
+ }
QUOTA_ALLOC_OR_GOTO (delta, int64_t, ret, err);
@@ -380,10 +394,10 @@ quota_readdir_cbk (call_frame_t *frame,
local->dentry_child_count = 0;
list_for_each_entry (entry, (&entries->list), list) {
- gf_log (this->name, GF_LOG_INFO, "entry = %s", entry->d_name);
+ gf_log (this->name, GF_LOG_DEBUG, "entry = %s", entry->d_name);
if ((!strcmp (entry->d_name, ".")) || (!strcmp (entry->d_name, ".."))) {
- gf_log (this->name, GF_LOG_INFO, "entry = %s", entry->d_name);
+ gf_log (this->name, GF_LOG_DEBUG, "entry = %s", entry->d_name);
continue;
}
count++;
@@ -921,8 +935,6 @@ quota_release_parent_lock (call_frame_t *frame, void *cookie,
quota_local_t *local = NULL;
quota_inode_ctx_t *ctx = NULL;
- trap ();
-
local = frame->local;
ret = quota_inode_ctx_get (local->parent_loc.inode, this, &ctx);
@@ -968,8 +980,6 @@ quota_mark_undirty (call_frame_t *frame,
quota_inode_ctx_t *ctx = NULL;
marker_conf_t *priv = NULL;
- trap ();
-
local = frame->local;
if (op_ret == -1) {
@@ -1047,8 +1057,6 @@ quota_update_parent_size (call_frame_t *frame,
quota_local_t *local = NULL;
quota_inode_ctx_t *ctx = NULL;
- trap ();
-
local = frame->local;
if (op_ret == -1) {
@@ -1124,8 +1132,6 @@ quota_update_inode_contribution (call_frame_t *frame, void *cookie,
marker_conf_t *priv = NULL;
inode_contribution_t *contribution = NULL;
- trap ();
-
local = frame->local;
if (op_ret == -1) {
@@ -1224,8 +1230,6 @@ quota_fetch_child_size_and_contri (call_frame_t *frame, void *cookie,
marker_conf_t *priv = NULL;
quota_inode_ctx_t *ctx = NULL;
- trap ();
-
local = frame->local;
if (op_ret == -1) {
@@ -1426,8 +1430,6 @@ initiate_quota_txn (xlator_t *this, loc_t *loc)
quota_inode_ctx_t *ctx = NULL;
inode_contribution_t *contribution = NULL;
- trap ();
-
VALIDATE_OR_GOTO (loc, out);
ret = quota_inode_ctx_get (loc->inode, this, &ctx);
diff --git a/xlators/features/marker/src/marker-quota.h b/xlators/features/marker/src/marker-quota.h
index e709bcac2..c6ca5bbab 100644
--- a/xlators/features/marker/src/marker-quota.h
+++ b/xlators/features/marker/src/marker-quota.h
@@ -51,6 +51,7 @@ char volname [40];
#define QUOTA_ALLOC(var, type, ret) \
do { \
+ ret = 0; \
var = GF_CALLOC (sizeof (type), 1, \
gf_marker_mt_##type); \
if (!var) { \
@@ -58,7 +59,6 @@ char volname [40];
"out of memory"); \
ret = -1; \
} \
- ret = 0; \
} while (0);
#define QUOTA_ALLOC_OR_GOTO(var, type, ret, label) \