summaryrefslogtreecommitdiffstats
path: root/xlators/features/marker/src/marker-quota.c
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2011-07-14 01:41:48 +0000
committerAnand Avati <avati@gluster.com>2011-08-03 22:33:29 -0700
commit3778cb5f668149d893ff6ae09d73878afc957133 (patch)
tree89746448f6b3210dafff45d36f8ca791cf240f98 /xlators/features/marker/src/marker-quota.c
parent03aa9ecde933269282ca1043a16378e0d1e5cb49 (diff)
features/marker: log failures due to file not being present during quota updation transaction in DEBUG.
Change-Id: I6733586ba56ed4fdc2abbef63c38b8c491f89819 BUG: 3143 Signed-off-by: Raghavendra G <raghavendra@gluster.com> Reviewed-on: http://review.gluster.com/32 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Mohammed Junaid <junaid@gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'xlators/features/marker/src/marker-quota.c')
-rw-r--r--xlators/features/marker/src/marker-quota.c96
1 files changed, 69 insertions, 27 deletions
diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c
index 7aa33cfaf33..4978cd7767a 100644
--- a/xlators/features/marker/src/marker-quota.c
+++ b/xlators/features/marker/src/marker-quota.c
@@ -1085,8 +1085,12 @@ quota_inodelk_cbk (call_frame_t *frame, void *cookie,
local = frame->local;
if (op_ret == -1 || local->err) {
- gf_log (this->name, GF_LOG_DEBUG,
- "lock setting failed (%s)", strerror (op_errno));
+ if (op_ret == -1) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "unlocking failed on path (%s)(%s)",
+ local->parent_loc.path, strerror (op_errno));
+ }
+
xattr_updation_done (frame, NULL, this, 0, 0, NULL);
return 0;
@@ -1125,6 +1129,15 @@ quota_release_parent_lock (call_frame_t *frame, void *cookie,
local = frame->local;
+ if (local->err != 0) {
+ gf_log_callingfn (this->name,
+ (local->err == ENOENT) ? GF_LOG_DEBUG
+ : GF_LOG_WARNING,
+ "An operation during quota updation "
+ "of path (%s) failed (%s)", local->loc.path,
+ strerror (local->err));
+ }
+
ret = quota_inode_ctx_get (local->parent_loc.inode, this, &ctx);
if (ret < 0)
goto wind;
@@ -1183,12 +1196,16 @@ quota_mark_undirty (call_frame_t *frame,
//update the size of the parent inode
if (dict != NULL) {
ret = quota_inode_ctx_get (local->parent_loc.inode, this, &ctx);
- if (ret < 0)
+ if (ret < 0) {
+ op_errno = EINVAL;
goto err;
+ }
ret = dict_get_bin (dict, QUOTA_SIZE_KEY, (void **) &size);
- if (ret < 0)
+ if (ret < 0) {
+ op_errno = EINVAL;
goto err;
+ }
LOCK (&ctx->lock);
{
@@ -1201,13 +1218,17 @@ quota_mark_undirty (call_frame_t *frame,
}
newdict = dict_new ();
- if (!newdict)
+ if (!newdict) {
+ op_errno = ENOMEM;
goto err;
+ }
ret = dict_set_int8 (newdict, QUOTA_DIRTY_KEY, 0);
- if (ret == -1)
+ if (ret == -1) {
+ op_errno = -ret;
goto err;
+ }
STACK_WIND (frame, quota_release_parent_lock,
FIRST_CHILD(this),
@@ -1217,7 +1238,7 @@ quota_mark_undirty (call_frame_t *frame,
ret = 0;
err:
if (op_ret == -1 || ret == -1) {
- local->err = 1;
+ local->err = op_errno;
quota_release_parent_lock (frame, NULL, this, 0, 0);
}
@@ -1248,7 +1269,7 @@ quota_update_parent_size (call_frame_t *frame,
if (op_ret == -1) {
gf_log (this->name, ((op_errno == ENOENT) ? GF_LOG_DEBUG :
- GF_LOG_ERROR),
+ GF_LOG_WARNING),
"xattrop call failed: %s", strerror (op_errno));
goto err;
@@ -1266,15 +1287,20 @@ quota_update_parent_size (call_frame_t *frame,
priv = this->private;
- if (dict == NULL)
+ if (dict == NULL) {
+ op_errno = EINVAL;
goto err;
+ }
ret = quota_inode_ctx_get (local->parent_loc.inode, this, &ctx);
- if (ret < 0)
+ if (ret < 0) {
+ op_errno = EINVAL;
goto err;
+ }
newdict = dict_new ();
if (!newdict) {
+ op_errno = ENOMEM;
ret = -1;
goto err;
}
@@ -1284,8 +1310,10 @@ quota_update_parent_size (call_frame_t *frame,
*size = hton64 (local->delta);
ret = dict_set_bin (newdict, QUOTA_SIZE_KEY, size, 8);
- if (ret < 0)
+ if (ret < 0) {
+ op_errno = -ret;
goto err;
+ }
STACK_WIND (frame,
quota_mark_undirty,
@@ -1297,7 +1325,7 @@ quota_update_parent_size (call_frame_t *frame,
ret = 0;
err:
if (op_ret == -1 || ret < 0) {
- local->err = 1;
+ local->err = op_errno;
quota_release_parent_lock (frame, NULL, this, 0, 0);
}
@@ -1330,8 +1358,8 @@ quota_update_inode_contribution (call_frame_t *frame, void *cookie,
if (op_ret == -1) {
gf_log (this->name, ((op_errno == ENOENT) ? GF_LOG_DEBUG :
GF_LOG_WARNING),
- "failed to get size and contribution with %s error",
- strerror (op_errno));
+ "failed to get size and contribution of path (%s)(%s)",
+ local->loc.path, strerror (op_errno));
goto err;
}
@@ -1342,16 +1370,20 @@ quota_update_inode_contribution (call_frame_t *frame, void *cookie,
//prepare to update size & contribution of the inode
GET_CONTRI_KEY (contri_key, contribution->gfid, ret);
- if (ret == -1)
+ if (ret == -1) {
+ op_errno = ENOMEM;
goto err;
+ }
LOCK (&ctx->lock);
{
if (local->loc.inode->ia_type == IA_IFDIR ) {
ret = dict_get_bin (dict, QUOTA_SIZE_KEY,
(void **) &size);
- if (ret < 0)
+ if (ret < 0) {
+ op_errno = EINVAL;
goto unlock;
+ }
ctx->size = ntoh64 (*size);
} else
@@ -1391,6 +1423,7 @@ unlock:
newdict = dict_new ();
if (newdict == NULL) {
+ op_errno = ENOMEM;
ret = -1;
goto err;
}
@@ -1401,6 +1434,7 @@ unlock:
ret = dict_set_bin (newdict, contri_key, delta, 8);
if (ret < 0) {
+ op_errno = -ret;
ret = -1;
goto err;
}
@@ -1416,7 +1450,7 @@ unlock:
err:
if (op_ret == -1 || ret < 0) {
- local->err = 1;
+ local->err = op_errno;
quota_release_parent_lock (frame, NULL, this, 0, 0);
}
@@ -1442,8 +1476,10 @@ quota_fetch_child_size_and_contri (call_frame_t *frame, void *cookie,
local = frame->local;
if (op_ret == -1) {
- gf_log (this->name, GF_LOG_ERROR,
- "%s couldnt mark dirty", local->parent_loc.path);
+ gf_log (this->name, (op_errno == ENOENT) ? GF_LOG_DEBUG
+ : GF_LOG_WARNING,
+ "couldnt mark inode corresponding to path (%s) dirty "
+ "(%s)", local->parent_loc.path, strerror (op_errno));
goto err;
}
@@ -1456,8 +1492,10 @@ quota_fetch_child_size_and_contri (call_frame_t *frame, void *cookie,
//update parent ctx
ret = quota_inode_ctx_get (local->parent_loc.inode, this, &ctx);
- if (ret == -1)
+ if (ret == -1) {
+ op_errno = EINVAL;
goto err;
+ }
LOCK (&ctx->lock);
{
@@ -1466,16 +1504,20 @@ quota_fetch_child_size_and_contri (call_frame_t *frame, void *cookie,
UNLOCK (&ctx->lock);
newdict = dict_new ();
- if (newdict == NULL)
+ if (newdict == NULL) {
+ op_errno = ENOMEM;
goto err;
+ }
if (local->loc.inode->ia_type == IA_IFDIR) {
ret = dict_set_int64 (newdict, QUOTA_SIZE_KEY, 0);
}
GET_CONTRI_KEY (contri_key, local->contri->gfid, ret);
- if (ret < 0)
+ if (ret < 0) {
+ op_errno = ENOMEM;
goto err;
+ }
ret = dict_set_int64 (newdict, contri_key, 0);
@@ -1485,8 +1527,8 @@ quota_fetch_child_size_and_contri (call_frame_t *frame, void *cookie,
ret = 0;
err:
- if (op_ret == -1 || ret == -1) {
- local->err = 1;
+ if ((op_ret == -1) || (ret == -1)) {
+ local->err = op_errno;
quota_release_parent_lock (frame, NULL, this, 0, 0);
}
@@ -1509,11 +1551,11 @@ quota_markdirty (call_frame_t *frame, void *cookie,
local = frame->local;
if (op_ret == -1){
- gf_log (this->name, GF_LOG_ERROR,
- "lock setting failed on %s (%s)",
+ gf_log (this->name, (op_errno == ENOENT) ? GF_LOG_DEBUG
+ : GF_LOG_WARNING, "acquiring locks failed on %s (%s)",
local->parent_loc.path, strerror (op_errno));
- local->err = 1;
+ local->err = op_errno;
quota_inodelk_cbk (frame, NULL, this, 0, 0);