summaryrefslogtreecommitdiffstats
path: root/xlators/features/marker/src/marker-quota-helper.c
diff options
context:
space:
mode:
authorvmallika <vmallika@redhat.com>2016-03-16 13:31:10 +0530
committerRaghavendra G <rgowdapp@redhat.com>2016-03-21 23:28:56 -0700
commit68665d0fc4a827e9933b94da8c4a2977b1a5cee6 (patch)
tree8c8966b8c8d23f0c363ac764d42262cf1b105b5e /xlators/features/marker/src/marker-quota-helper.c
parent8eaa3506ead4f11b81b146a9e56575c79f3aad7b (diff)
marker: set inode ctx before lookup unwind
When a file is unlinked before it was accounted by the marker, then we may see error "ctx for the node ... is NULL" at many places. This is actually not an error and can be ignored. It is better to set the inode ctx before lookup/create is unwind back to protocol server Change-Id: I462b5542951f2fc2964f59af7a31978979dab1de BUG: 1318158 Signed-off-by: vmallika <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/13748 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/features/marker/src/marker-quota-helper.c')
-rw-r--r--xlators/features/marker/src/marker-quota-helper.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/xlators/features/marker/src/marker-quota-helper.c b/xlators/features/marker/src/marker-quota-helper.c
index d1fabccf18e..ce8280234ac 100644
--- a/xlators/features/marker/src/marker-quota-helper.c
+++ b/xlators/features/marker/src/marker-quota-helper.c
@@ -60,9 +60,13 @@ out:
int32_t
mq_inode_loc_fill (const char *parent_gfid, inode_t *inode, loc_t *loc)
{
- char *resolvedpath = NULL;
- inode_t *parent = NULL;
- int ret = -1;
+ char *resolvedpath = NULL;
+ inode_t *parent = NULL;
+ quota_inode_ctx_t *ctx = NULL;
+ xlator_t *this = NULL;
+ int ret = -1;
+
+ this = THIS;
if ((!inode) || (!loc))
return ret;
@@ -96,6 +100,17 @@ ignore_parent:
if (ret < 0)
goto err;
+ ret = mq_inode_ctx_get (inode, this, &ctx);
+ if (ret < 0 || ctx == NULL)
+ ctx = mq_inode_ctx_new (inode, this);
+ if (ctx == NULL) {
+ gf_log (this->name, GF_LOG_WARNING, "mq_inode_ctx_new "
+ "failed for %s", uuid_utoa (inode->gfid));
+ ret = -1;
+ goto err;
+ }
+ ret = 0;
+
err:
if (parent)
inode_unref (parent);