summaryrefslogtreecommitdiffstats
path: root/xlators/features/marker/src/marker-quota.c
diff options
context:
space:
mode:
authorJunaid <junaid@gluster.com>2011-04-12 05:06:03 +0000
committerAnand Avati <avati@gluster.com>2011-04-12 21:50:05 -0700
commit1fd570380ba5def514ff42e81008a7ddd588348f (patch)
treedb72f86b960449968d88e723cff0fa51d05d32ed /xlators/features/marker/src/marker-quota.c
parent9c26fbc70ab797eea7967bc77857e73eca9aeffe (diff)
features/marker: Adding NULL checks.
Signed-off-by: Junaid <junaid@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2473 (Support for volume and directory level quota) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2473
Diffstat (limited to 'xlators/features/marker/src/marker-quota.c')
-rw-r--r--xlators/features/marker/src/marker-quota.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c
index 0e457e58bbc..e2cb6ba67be 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);