diff options
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/gfid-access/src/gfid-access.c | 45 |
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 */ |