summaryrefslogtreecommitdiffstats
path: root/xlators/features/marker
diff options
context:
space:
mode:
authorvmallika <vmallika@redhat.com>2015-05-28 12:03:22 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2015-05-28 23:24:36 -0700
commite3408108e36dac08d217f558b5cc69dff71bbcbf (patch)
tree3e8603583b6e2475abed9ac30934e96f27f642d8 /xlators/features/marker
parent02e53c084953399a5f73905085a109b61d9606c8 (diff)
quota: fix for spurious failure
This is a backport of http://review.gluster.org/#/c/10918/ > During ancestry build, loc path was set to invalid > path. path was set to one of its child instead > of itself. Because of this quota accounting was > going wrong > > This patch fix the issue > > Below mentioned tests removed from bad test list > as part of patch# 10930 > ./tests/basic/ec/quota.t > ./tests/basic/quota-nfs.t > ./tests/bugs/quota/bug-1035576.t > > Change-Id: Iaa65b2d968c04c9abcd476d0e9f588cb7fd39294 > BUG: 1223798 > Signed-off-by: vmallika <vmallika@redhat.com> > Reviewed-on: http://review.gluster.org/10918 > Tested-by: NetBSD Build System > Reviewed-by: Vijay Bellur <vbellur@redhat.com> Change-Id: I2986d18c111790bef8f2a7a1df5e43f46755e85e BUG: 1224894 Signed-off-by: vmallika <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/10958 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/features/marker')
-rw-r--r--xlators/features/marker/src/marker.c51
1 files changed, 31 insertions, 20 deletions
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c
index a465723..9e064ef 100644
--- a/xlators/features/marker/src/marker.c
+++ b/xlators/features/marker/src/marker.c
@@ -95,27 +95,33 @@ loc_wipe:
}
int
-marker_inode_loc_fill (inode_t *inode, char *name, loc_t *loc)
+_marker_inode_loc_fill (inode_t *inode, inode_t *parent, char *name, loc_t *loc)
{
char *resolvedpath = NULL;
int ret = -1;
- inode_t *parent = NULL;
+ gf_boolean_t free_parent = _gf_false;
if ((!inode) || (!loc))
return ret;
- parent = inode_parent (inode, NULL, NULL);
-
- ret = inode_path (inode, name, &resolvedpath);
+ if (parent && name)
+ ret = inode_path (parent, name, &resolvedpath);
+ else
+ ret = inode_path (inode, NULL, &resolvedpath);
if (ret < 0)
goto err;
+ if (parent == NULL) {
+ parent = inode_parent (inode, NULL, NULL);
+ free_parent = _gf_true;
+ }
+
ret = marker_loc_fill (loc, inode, parent, resolvedpath);
if (ret < 0)
goto err;
err:
- if (parent)
+ if (free_parent)
inode_unref (parent);
GF_FREE (resolvedpath);
@@ -123,6 +129,12 @@ err:
return ret;
}
+int
+marker_inode_loc_fill (inode_t *inode, loc_t *loc)
+{
+ return _marker_inode_loc_fill (inode, NULL, NULL, loc);
+}
+
int32_t
marker_trav_parent (marker_local_t *local)
{
@@ -138,7 +150,7 @@ marker_trav_parent (marker_local_t *local)
} else
parent = local->loc.parent;
- ret = marker_inode_loc_fill (parent, NULL, &loc);
+ ret = marker_inode_loc_fill (parent, &loc);
if (ret < 0) {
ret = -1;
@@ -789,7 +801,7 @@ marker_writev (call_frame_t *frame,
MARKER_INIT_LOCAL (frame, local);
- ret = marker_inode_loc_fill (fd->inode, NULL, &local->loc);
+ ret = marker_inode_loc_fill (fd->inode, &local->loc);
if (ret == -1)
goto err;
@@ -1728,7 +1740,7 @@ marker_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
MARKER_INIT_LOCAL (frame, local);
- ret = marker_inode_loc_fill (fd->inode, NULL, &local->loc);
+ ret = marker_inode_loc_fill (fd->inode, &local->loc);
if (ret == -1)
goto err;
@@ -1946,7 +1958,7 @@ marker_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode,
MARKER_INIT_LOCAL (frame, local);
- ret = marker_inode_loc_fill (fd->inode, NULL, &local->loc);
+ ret = marker_inode_loc_fill (fd->inode, &local->loc);
if (ret == -1)
goto err;
@@ -2015,7 +2027,7 @@ marker_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
MARKER_INIT_LOCAL (frame, local);
- ret = marker_inode_loc_fill (fd->inode, NULL, &local->loc);
+ ret = marker_inode_loc_fill (fd->inode, &local->loc);
if (ret == -1)
goto err;
@@ -2082,7 +2094,7 @@ marker_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
MARKER_INIT_LOCAL (frame, local);
- ret = marker_inode_loc_fill (fd->inode, NULL, &local->loc);
+ ret = marker_inode_loc_fill (fd->inode, &local->loc);
if (ret == -1)
goto err;
@@ -2412,7 +2424,7 @@ marker_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict,
MARKER_INIT_LOCAL (frame, local);
- ret = marker_inode_loc_fill (fd->inode, NULL, &local->loc);
+ ret = marker_inode_loc_fill (fd->inode, &local->loc);
if (ret == -1)
goto err;
@@ -2478,7 +2490,7 @@ marker_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
MARKER_INIT_LOCAL (frame, local);
- ret = marker_inode_loc_fill (fd->inode, NULL, &local->loc);
+ ret = marker_inode_loc_fill (fd->inode, &local->loc);
if (ret == -1)
goto err;
@@ -2749,12 +2761,11 @@ marker_build_ancestry_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
parent = NULL;
}
- if (parent) {
- ret = marker_inode_loc_fill (parent,
- entry->d_name, &loc);
- } else {
- ret = marker_inode_loc_fill (entry->inode, NULL, &loc);
- }
+ if (parent)
+ _marker_inode_loc_fill (entry->inode, parent,
+ entry->d_name, &loc);
+ else
+ ret = marker_inode_loc_fill (entry->inode, &loc);
if (ret) {
gf_log (this->name, GF_LOG_WARNING, "Couldn't build "