summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/afr/src/afr-common.c18
-rw-r--r--xlators/cluster/afr/src/afr-dir-write.c3
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-entry.c2
-rw-r--r--xlators/cluster/afr/src/afr.h3
-rw-r--r--xlators/cluster/dht/src/dht-common.c5
-rw-r--r--xlators/protocol/client/src/client-handshake.c4
-rw-r--r--xlators/protocol/client/src/client3_1-fops.c159
7 files changed, 161 insertions, 33 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 5c8a8105d30..2b24522f5d9 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -492,6 +492,16 @@ afr_up_children_count (int child_count, unsigned char *child_up)
return ret;
}
+void
+afr_update_loc_gfids (loc_t *loc, struct iatt *buf, struct iatt *postparent)
+{
+ GF_ASSERT (loc);
+ GF_ASSERT (buf);
+
+ uuid_copy (loc->gfid, buf->ia_gfid);
+ if (postparent)
+ uuid_copy (loc->pargfid, postparent->ia_gfid);
+}
ino64_t
afr_itransform (ino64_t ino, int child_count, int child_index)
@@ -887,6 +897,10 @@ afr_fresh_lookup_cbk (call_frame_t *frame, void *cookie,
*lookup_buf = *buf;
+ uuid_copy (local->loc.gfid, buf->ia_gfid);
+ uuid_copy (local->loc.pargfid,
+ postparent->ia_gfid);
+
lookup_buf->ia_ino = afr_itransform (buf->ia_ino,
priv->child_count,
child_index);
@@ -916,6 +930,10 @@ afr_fresh_lookup_cbk (call_frame_t *frame, void *cookie,
local->cont.lookup.postparent = *postparent;
*lookup_buf = *buf;
+
+ uuid_copy (local->loc.gfid, buf->ia_gfid);
+ uuid_copy (local->loc.pargfid,
+ postparent->ia_gfid);
}
}
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c
index af42e7e06a0..1f2b58f4d25 100644
--- a/xlators/cluster/afr/src/afr-dir-write.c
+++ b/xlators/cluster/afr/src/afr-dir-write.c
@@ -69,6 +69,9 @@ afr_build_parent_loc (loc_t *parent, loc_t *child)
parent->inode = inode_ref (child->parent);
parent->parent = inode_parent (parent->inode, 0, NULL);
parent->ino = parent->inode->ino;
+
+ if (!uuid_is_null (child->pargfid))
+ uuid_copy (parent->gfid, child->pargfid);
}
/* {{{ create */
diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c
index 0c9fca49572..818f688e558 100644
--- a/xlators/cluster/afr/src/afr-self-heal-entry.c
+++ b/xlators/cluster/afr/src/afr-self-heal-entry.c
@@ -1574,6 +1574,8 @@ afr_sh_entry_impunge_recreate_lookup_cbk (call_frame_t *impunge_frame,
impunge_sh->parentbuf = *postparent;
impunge_local->cont.lookup.buf = *buf;
+ afr_update_loc_gfids (&impunge_local->loc, buf, postparent);
+
type = buf->ia_type;
switch (type) {
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
index 7bd24e0ac6e..e4205ae9172 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -735,6 +735,9 @@ afr_build_parent_loc (loc_t *parent, loc_t *child);
int
afr_up_children_count (int child_count, unsigned char *child_up);
+void
+afr_update_loc_gfids (loc_t *loc, struct iatt *buf, struct iatt *postparent);
+
int
afr_locked_nodes_count (unsigned char *locked_nodes, int child_count);
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index e101b2b0900..112d4231dc3 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -149,7 +149,6 @@ dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
(prev->this == dht_first_up_subvol (this))) {
local->ia_ino = local->stbuf.ia_ino;
}
-
}
unlock:
UNLOCK (&frame->lock);
@@ -3771,6 +3770,8 @@ dht_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
local->ia_ino = local->stbuf.ia_ino;
}
+ if (uuid_is_null (local->loc.gfid) && !op_ret)
+ uuid_copy (local->loc.gfid, stbuf->ia_gfid);
}
unlock:
UNLOCK (&frame->lock);
@@ -3828,6 +3829,8 @@ dht_mkdir_hashed_cbk (call_frame_t *frame, void *cookie,
local->call_cnt = conf->subvolume_cnt - 1;
if (local->call_cnt == 0) {
+ if (uuid_is_null (local->loc.gfid) && !op_ret)
+ uuid_copy (local->loc.gfid, stbuf->ia_gfid);
dht_selfheal_directory (frame, dht_mkdir_selfheal_cbk,
&local->loc, layout);
}
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index 5aabe57e041..265c053c00e 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -572,7 +572,7 @@ protocol_client_reopendir (xlator_t *this, clnt_fd_ctx_t *fdctx)
goto out;
}
- memcpy (req.gfid, inode->gfid, 16);
+ memcpy (req.gfid, inode->gfid, 16);
req.path = (char *)local->loc.path;
gf_log (frame->this->name, GF_LOG_DEBUG,
@@ -648,7 +648,7 @@ protocol_client_reopen (xlator_t *this, clnt_fd_ctx_t *fdctx)
path = NULL;
frame->local = local;
- memcpy (req.gfid, inode->gfid, 16);
+ memcpy (req.gfid, inode->gfid, 16);
req.flags = gf_flags_from_flags (fdctx->flags);
req.wbflags = fdctx->wbflags;
req.path = (char *)local->loc.path;
diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c
index 6f7808ebb1b..f0b8c0bb52d 100644
--- a/xlators/protocol/client/src/client3_1-fops.c
+++ b/xlators/protocol/client/src/client3_1-fops.c
@@ -2234,10 +2234,17 @@ client3_1_lookup (call_frame_t *frame, xlator_t *this,
loc_copy (&local->loc, args->loc);
frame->local = local;
- if (args->loc->parent)
- memcpy (req.pargfid, args->loc->parent->gfid, 16);
- else
- memcpy (req.gfid, args->loc->inode->gfid, 16);
+ if (args->loc->parent) {
+ if (!uuid_is_null (args->loc->parent->gfid))
+ memcpy (req.pargfid, args->loc->parent->gfid, 16);
+ else
+ memcpy (req.pargfid, args->loc->pargfid, 16);
+ } else {
+ if (!uuid_is_null (args->loc->inode->gfid))
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
+ else
+ memcpy (req.gfid, args->loc->gfid, 16);
+ }
if (args->dict) {
content = dict_get (args->dict, GF_CONTENT_KEY);
@@ -2346,7 +2353,11 @@ client3_1_stat (call_frame_t *frame, xlator_t *this,
if (!(args->loc && args->loc->inode))
goto unwind;
- memcpy (req.gfid, args->loc->inode->gfid, 16);
+ if (!uuid_is_null (args->loc->inode->gfid))
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
+ else
+ memcpy (req.gfid, args->loc->gfid, 16);
+
req.path = (char *)args->loc->path;
conf = this->private;
@@ -2383,7 +2394,11 @@ client3_1_truncate (call_frame_t *frame, xlator_t *this,
if (!(args->loc && args->loc->inode))
goto unwind;
- memcpy (req.gfid, args->loc->inode->gfid, 16);
+ if (!uuid_is_null (args->loc->inode->gfid))
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
+ else
+ memcpy (req.gfid, args->loc->gfid, 16);
+
req.path = (char *)args->loc->path;
req.offset = args->offset;
@@ -2482,7 +2497,11 @@ client3_1_access (call_frame_t *frame, xlator_t *this,
if (!(args->loc && args->loc->inode))
goto unwind;
- memcpy (req.gfid, args->loc->inode->gfid, 16);
+ if (!uuid_is_null (args->loc->inode->gfid))
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
+ else
+ memcpy (req.gfid, args->loc->gfid, 16);
+
req.path = (char *)args->loc->path;
req.mask = args->mask;
@@ -2522,7 +2541,11 @@ client3_1_readlink (call_frame_t *frame, xlator_t *this,
if (!(args->loc && args->loc->inode))
goto unwind;
- memcpy (req.gfid, args->loc->inode->gfid, 16);
+ if (!uuid_is_null (args->loc->inode->gfid))
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
+ else
+ memcpy (req.gfid, args->loc->gfid, 16);
+
req.path = (char *)args->loc->path;
req.size = args->size;
conf = this->private;
@@ -2564,7 +2587,11 @@ client3_1_unlink (call_frame_t *frame, xlator_t *this,
if (!(args->loc && args->loc->parent))
goto unwind;
- memcpy (req.pargfid, args->loc->parent->gfid, 16);
+ if (!uuid_is_null (args->loc->parent->gfid))
+ memcpy (req.pargfid, args->loc->parent->gfid, 16);
+ else
+ memcpy (req.pargfid, args->loc->pargfid, 16);
+
req.path = (char *)args->loc->path;
req.bname = (char *)args->loc->name;
conf = this->private;
@@ -2604,7 +2631,11 @@ client3_1_rmdir (call_frame_t *frame, xlator_t *this,
if (!(args->loc && args->loc->parent))
goto unwind;
- memcpy (req.pargfid, args->loc->parent->gfid, 16);
+ if (!uuid_is_null (args->loc->parent->gfid))
+ memcpy (req.pargfid, args->loc->parent->gfid, 16);
+ else
+ memcpy (req.pargfid, args->loc->pargfid, 16);
+
req.path = (char *)args->loc->path;
req.bname = (char *)args->loc->name;
req.flags = args->flags;
@@ -2654,7 +2685,11 @@ client3_1_symlink (call_frame_t *frame, xlator_t *this,
loc_copy (&local->loc, args->loc);
frame->local = local;
- memcpy (req.pargfid, args->loc->parent->gfid, 16);
+ if (!uuid_is_null (args->loc->parent->gfid))
+ memcpy (req.pargfid, args->loc->parent->gfid, 16);
+ else
+ memcpy (req.pargfid, args->loc->pargfid, 16);
+
req.path = (char *)args->loc->path;
req.linkname = (char *)args->linkname;
req.bname = (char *)args->loc->name;
@@ -2720,8 +2755,15 @@ client3_1_rename (call_frame_t *frame, xlator_t *this,
args->newloc->parent))
goto unwind;
- memcpy (req.oldgfid, args->oldloc->parent->gfid, 16);
- memcpy (req.newgfid, args->newloc->parent->gfid, 16);
+ if (!uuid_is_null (args->oldloc->parent->gfid))
+ memcpy (req.oldgfid, args->oldloc->parent->gfid, 16);
+ else
+ memcpy (req.oldgfid, args->oldloc->pargfid, 16);
+
+ if (!uuid_is_null (args->newloc->parent->gfid))
+ memcpy (req.newgfid, args->newloc->parent->gfid, 16);
+ else
+ memcpy (req.newgfid, args->newloc->pargfid, 16);
req.oldpath = (char *)args->oldloc->path;
req.oldbname = (char *)args->oldloc->name;
@@ -2765,8 +2807,15 @@ client3_1_link (call_frame_t *frame, xlator_t *this,
args->newloc->parent))
goto unwind;
- memcpy (req.oldgfid, args->oldloc->inode->gfid, 16);
- memcpy (req.newgfid, args->newloc->parent->gfid, 16);
+ if (!uuid_is_null (args->oldloc->inode->gfid))
+ memcpy (req.oldgfid, args->oldloc->inode->gfid, 16);
+ else
+ memcpy (req.oldgfid, args->oldloc->gfid, 16);
+
+ if (!uuid_is_null (args->newloc->parent->gfid))
+ memcpy (req.newgfid, args->newloc->parent->gfid, 16);
+ else
+ memcpy (req.newgfid, args->newloc->pargfid, 16);
local = GF_CALLOC (1, sizeof (*local), gf_client_mt_clnt_local_t);
if (!local) {
@@ -2826,7 +2875,11 @@ client3_1_mknod (call_frame_t *frame, xlator_t *this,
loc_copy (&local->loc, args->loc);
frame->local = local;
- memcpy (req.pargfid, args->loc->parent->gfid, 16);
+ if (!uuid_is_null (args->loc->parent->gfid))
+ memcpy (req.pargfid, args->loc->parent->gfid, 16);
+ else
+ memcpy (req.pargfid, args->loc->pargfid, 16);
+
req.path = (char *)args->loc->path;
req.bname = (char *)args->loc->name;
req.mode = args->mode;
@@ -2903,7 +2956,11 @@ client3_1_mkdir (call_frame_t *frame, xlator_t *this,
loc_copy (&local->loc, args->loc);
frame->local = local;
- memcpy (req.pargfid, args->loc->parent->gfid, 16);
+ if (!uuid_is_null (args->loc->parent->gfid))
+ memcpy (req.pargfid, args->loc->parent->gfid, 16);
+ else
+ memcpy (req.pargfid, args->loc->pargfid, 16);
+
req.path = (char *)args->loc->path;
req.bname = (char *)args->loc->name;
req.mode = args->mode;
@@ -2980,7 +3037,11 @@ client3_1_create (call_frame_t *frame, xlator_t *this,
loc_copy (&local->loc, args->loc);
frame->local = local;
- memcpy (req.pargfid, args->loc->parent->gfid, 16);
+ if (!uuid_is_null (args->loc->parent->gfid))
+ memcpy (req.pargfid, args->loc->parent->gfid, 16);
+ else
+ memcpy (req.pargfid, args->loc->pargfid, 16);
+
req.path = (char *)args->loc->path;
req.bname = (char *)args->loc->name;
req.mode = args->mode;
@@ -3058,7 +3119,11 @@ client3_1_open (call_frame_t *frame, xlator_t *this,
loc_copy (&local->loc, args->loc);
frame->local = local;
- memcpy (req.gfid, args->loc->inode->gfid, 16);
+ if (!uuid_is_null (args->loc->inode->gfid))
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
+ else
+ memcpy (req.gfid, args->loc->gfid, 16);
+
req.flags = gf_flags_from_flags (args->flags);
req.wbflags = args->wbflags;
req.path = (char *)args->loc->path;
@@ -3466,7 +3531,11 @@ client3_1_opendir (call_frame_t *frame, xlator_t *this,
loc_copy (&local->loc, args->loc);
frame->local = local;
- memcpy (req.gfid, args->loc->inode->gfid, 16);
+ if (!uuid_is_null (args->loc->inode->gfid))
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
+ else
+ memcpy (req.gfid, args->loc->gfid, 16);
+
req.path = (char *)args->loc->path;
conf = this->private;
@@ -3567,9 +3636,12 @@ client3_1_statfs (call_frame_t *frame, xlator_t *this,
if (!args->loc)
goto unwind;
- if (args->loc->inode)
- memcpy (req.gfid, args->loc->inode->gfid, 16);
- else
+ if (args->loc->inode) {
+ if (!uuid_is_null (args->loc->inode->gfid))
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
+ else
+ memcpy (req.gfid, args->loc->gfid, 16);
+ } else
req.gfid[15] = 1;
req.path = (char *)args->loc->path;
@@ -3611,7 +3683,11 @@ client3_1_setxattr (call_frame_t *frame, xlator_t *this,
if (!(args->loc && args->loc->inode))
goto unwind;
- memcpy (req.gfid, args->loc->inode->gfid, 16);
+ if (!uuid_is_null (args->loc->inode->gfid))
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
+ else
+ memcpy (req.gfid, args->loc->gfid, 16);
+
if (args->dict) {
ret = dict_allocate_and_serialize (args->dict,
&req.dict.dict_val,
@@ -3922,7 +3998,10 @@ client3_1_getxattr (call_frame_t *frame, xlator_t *this,
local->iobref = rsp_iobref;
rsp_iobref = NULL;
- memcpy (req.gfid, args->loc->inode->gfid, 16);
+ if (!uuid_is_null (args->loc->inode->gfid))
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
+ else
+ memcpy (req.gfid, args->loc->gfid, 16);
req.namelen = 1; /* Use it as a flag */
req.path = (char *)args->loc->path;
req.name = (char *)args->name;
@@ -4046,7 +4125,11 @@ client3_1_xattrop (call_frame_t *frame, xlator_t *this,
local->iobref = rsp_iobref;
rsp_iobref = NULL;
- memcpy (req.gfid, args->loc->inode->gfid, 16);
+ if (!uuid_is_null (args->loc->inode->gfid))
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
+ else
+ memcpy (req.gfid, args->loc->gfid, 16);
+
if (args->dict) {
ret = dict_allocate_and_serialize (args->dict,
&req.dict.dict_val,
@@ -4258,7 +4341,11 @@ client3_1_removexattr (call_frame_t *frame, xlator_t *this,
if (!(args->loc && args->loc->inode))
goto unwind;
- memcpy (req.gfid, args->loc->inode->gfid, 16);
+ if (!uuid_is_null (args->loc->inode->gfid))
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
+ else
+ memcpy (req.gfid, args->loc->gfid, 16);
+
req.path = (char *)args->loc->path;
req.name = (char *)args->name;
@@ -4392,7 +4479,11 @@ client3_1_inodelk (call_frame_t *frame, xlator_t *this,
if (!(args->loc && args->loc->inode))
goto unwind;
- memcpy (req.gfid, args->loc->inode->gfid, 16);
+ if (!uuid_is_null (args->loc->inode->gfid))
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
+ else
+ memcpy (req.gfid, args->loc->gfid, 16);
+
if (args->cmd == F_GETLK || args->cmd == F_GETLK64)
gf_cmd = GF_LK_GETLK;
else if (args->cmd == F_SETLK || args->cmd == F_SETLK64)
@@ -4549,7 +4640,11 @@ client3_1_entrylk (call_frame_t *frame, xlator_t *this,
if (!(args->loc && args->loc->inode))
goto unwind;
- memcpy (req.gfid, args->loc->inode->gfid, 16);
+ if (!uuid_is_null (args->loc->inode->gfid))
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
+ else
+ memcpy (req.gfid, args->loc->gfid, 16);
+
req.path = (char *)args->loc->path;
req.cmd = args->cmd_entrylk;
req.type = args->type;
@@ -4966,7 +5061,11 @@ client3_1_setattr (call_frame_t *frame, xlator_t *this,
if (!(args->loc && args->loc->inode))
goto unwind;
- memcpy (req.gfid, args->loc->inode->gfid, 16);
+ if (!uuid_is_null (args->loc->inode->gfid))
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
+ else
+ memcpy (req.gfid, args->loc->gfid, 16);
+
req.path = (char *)args->loc->path;
req.valid = args->valid;
gf_stat_from_iatt (&req.stbuf, args->stbuf);