summaryrefslogtreecommitdiffstats
path: root/xlators/features/gfid-access/src/gfid-access.c
diff options
context:
space:
mode:
authorVenky Shankar <vshankar@redhat.com>2014-07-08 13:05:15 +0530
committerVijay Bellur <vbellur@redhat.com>2014-07-14 06:26:55 -0700
commiteeab758c7c7e7670f86fc1d8c3785a1ecb7208b4 (patch)
treeb342682cf5ac9e77cea33db0dfcec52fd5f042f5 /xlators/features/gfid-access/src/gfid-access.c
parent23455c034a95df2be900f0f83515f2a22c5dea8e (diff)
features/gfid-access: error handling for entry creation
Proceed with setattr() only on a successfull entry creation. Winding a setattr() using a freshlyOC initiated inode would most likely fail in one translator or the other (e.g. DHT expecting the layout information to be set in the inode context), which is the case if the inode was not looked up. Therefore, gfid-access handles failure entry creations and passes the _correct_ errno back to the client instead of continuing with setattr() call and probably returning back incorrect errno. Also, filling up inode->gfid is required as the new inode is not looked up and ->gfid would be certainely required for inode operations. Change-Id: Ie92f5647a89bf558c07710ab0400bce69d59fc31 BUG: 1111490 Signed-off-by: Venky Shankar <vshankar@redhat.com> Reviewed-on: http://review.gluster.org/8260 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kotresh HR <khiremat@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/features/gfid-access/src/gfid-access.c')
-rw-r--r--xlators/features/gfid-access/src/gfid-access.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/xlators/features/gfid-access/src/gfid-access.c b/xlators/features/gfid-access/src/gfid-access.c
index 52c137c342f..a5869f82187 100644
--- a/xlators/features/gfid-access/src/gfid-access.c
+++ b/xlators/features/gfid-access/src/gfid-access.c
@@ -313,8 +313,10 @@ ga_fill_tmp_loc (loc_t *loc, xlator_t *this, uuid_t gfid,
new_loc->parent = inode_ref (parent);
new_loc->inode = inode_grep (parent->table, parent, bname);
- if (!new_loc->inode)
+ if (!new_loc->inode) {
new_loc->inode = inode_new (parent->table);
+ uuid_copy (new_loc->inode->gfid, gfid);
+ }
loc_path (new_loc, bname);
if (new_loc->path) {
@@ -434,6 +436,10 @@ ga_newentry_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
local = frame->local;
+ /* no need to proceed if things don't look good here */
+ if (op_ret == -1)
+ goto done;
+
if (!local->uid && !local->gid)
goto done;