summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2013-12-16 23:55:47 +0530
committerVijay Bellur <vbellur@redhat.com>2014-01-27 07:50:48 -0800
commiteb9a5f3d20bac697d1f1fca50dd4d0b98179e9fb (patch)
treea392c0ed57c5a21f87229f318dbe9da50c21a699
parent0d739e788dddd591a015921991c3112400f3d3a1 (diff)
gfid-access: fix the issue of entry creation with wrong gfid
* dict_set was happening with a string instead of 'uuid_t' causing entry creations to happen with wrong gfid * revalidate was causing excessive ESTALE logs as lookup was happening on '.gfid/' path itself causing server to become clueless Change-Id: I3b76ce7fdec9c2ff785be21f506f859f489f80f0 BUG: 1054199 Signed-off-by: Amar Tumballi <amarts@redhat.com> Reviewed-on: http://review.gluster.org/6520 Reviewed-by: Anand Avati <avati@redhat.com> Tested-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.org/6805 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--xlators/features/gfid-access/src/gfid-access.c45
1 files changed, 39 insertions, 6 deletions
diff --git a/xlators/features/gfid-access/src/gfid-access.c b/xlators/features/gfid-access/src/gfid-access.c
index 1566278efe3..25ef9369709 100644
--- a/xlators/features/gfid-access/src/gfid-access.c
+++ b/xlators/features/gfid-access/src/gfid-access.c
@@ -252,7 +252,7 @@ err:
}
static int32_t
-ga_fill_tmp_loc (loc_t *loc, xlator_t *this, char *gfid,
+ga_fill_tmp_loc (loc_t *loc, xlator_t *this, uuid_t gfid,
char *bname, dict_t *xdata, loc_t *new_loc)
{
int ret = -1;
@@ -421,15 +421,20 @@ ga_new_entry (call_frame_t *frame, xlator_t *this, loc_t *loc, data_t *data,
call_frame_t *new_frame = NULL;
mode_t mode = 0;
ga_local_t *local = NULL;
+ uuid_t gfid = {0,};
args = ga_newfile_parse_args (this, data);
if (!args)
goto out;
+ ret = uuid_parse (args->gfid, gfid);
+ if (ret)
+ goto out;
+
if (!xdata)
xdata = dict_new ();
- ret = ga_fill_tmp_loc (loc, this, args->gfid,
+ ret = ga_fill_tmp_loc (loc, this, gfid,
args->bname, xdata, &tmp_loc);
if (ret)
goto out;
@@ -485,15 +490,20 @@ ga_heal_entry (call_frame_t *frame, xlator_t *this, loc_t *loc, data_t *data,
ga_heal_args_t *args = NULL;
loc_t tmp_loc = {0,};
call_frame_t *new_frame = NULL;
+ uuid_t gfid = {0,};
args = ga_heal_parse_args (this, data);
if (!args)
goto out;
+ ret = uuid_parse (args->gfid, gfid);
+ if (ret)
+ goto out;
+
if (!xdata)
xdata = dict_new ();
- ret = ga_fill_tmp_loc (loc, this, args->gfid, args->bname,
+ ret = ga_fill_tmp_loc (loc, this, gfid, args->bname,
xdata, &tmp_loc);
if (ret)
goto out;
@@ -708,8 +718,30 @@ ga_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
/* if its revalidate, and inode is not of type directory,
proceed with 'wind' */
if (loc->inode && loc->inode->ia_type &&
- !IA_ISDIR (loc->inode->ia_type))
+ !IA_ISDIR (loc->inode->ia_type)) {
+
+ /* a revalidate on ".gfid/<dentry>" is possible, check for it */
+ if (((loc->parent &&
+ __is_gfid_access_dir (loc->parent->gfid)) ||
+ __is_gfid_access_dir (loc->pargfid))) {
+
+ /* here, just send 'loc->gfid' and 'loc->inode' */
+ tmp_loc.inode = inode_ref (loc->inode);
+ uuid_copy (tmp_loc.gfid, loc->inode->gfid);
+
+ STACK_WIND (frame, default_lookup_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->lookup,
+ &tmp_loc, xdata);
+
+ inode_unref (tmp_loc.inode);
+
+ return 0;
+ }
+
+ /* not something to bother, continue the flow */
goto wind;
+ }
priv = this->private;
@@ -729,8 +761,9 @@ ga_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
/* now, check if the lookup() is on an existing entry,
but on gfid-path */
if (!((loc->parent && __is_gfid_access_dir (loc->parent->gfid)) ||
- __is_gfid_access_dir (loc->pargfid)))
- goto wind;
+ __is_gfid_access_dir (loc->pargfid))) {
+ goto wind;
+ }
/* make sure the 'basename' is actually a 'canonical-gfid',
otherwise, return error */