summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/bugs/bug-1111490.t32
-rw-r--r--xlators/features/gfid-access/src/gfid-access.c8
2 files changed, 39 insertions, 1 deletions
diff --git a/tests/bugs/bug-1111490.t b/tests/bugs/bug-1111490.t
new file mode 100644
index 00000000000..39aa0f9a69e
--- /dev/null
+++ b/tests/bugs/bug-1111490.t
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../volume.rc
+
+cleanup;
+
+TEST glusterd
+TEST pidof glusterd
+
+TEST $CLI volume create $V0 $H0:$B0/${V0}0
+TEST $CLI volume start $V0
+
+# mount with auxillary gfid mount
+TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 --aux-gfid-mount
+
+# create file with specific gfid
+uuid=`uuidgen`
+EXPECT "File creation OK" python2 $(dirname $0)/../utils/gfid-access.py $M0 ROOT file0 $uuid file
+
+# check gfid
+EXPECT "$uuid" getfattr -m . --only-values -n glusterfs.gfid.string $M0/file0
+
+# unmount and mount again so as to start with a fresh inode table
+# or use another mount...
+TEST umount $M0
+TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 --aux-gfid-mount
+
+# touch the file again (gfid-access.py handles errno)
+EXPECT "File creation OK" python2 $(dirname $0)/../utils/gfid-access.py $M0 ROOT file0 $uuid file
+
+cleanup;
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;