summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-06-10 02:50:18 +0000
committerAnand Avati <avati@gluster.com>2011-06-14 00:13:51 -0700
commit5522ac20241436be6a005058b6360f4339eb678c (patch)
treecbf9e466418d97e8f46cfdd1121a8ad86fc70aca /xlators/cluster
parentc5321286e540153ff04d189b20c2957776e2b7d5 (diff)
loc_t: add 'gfid' and 'pargfid' fields
these fields are used mainly in case of selfheal path, where 'inode->gfid'||'parent->gfid' is not yet set. These fields in 'loc' will have lower precedence than 'inode->gfid' in client protocol. also contains 'Pranith <pranithk@gluster.com>'s patch to set proper loc->gfid during afr selfheal Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2346 (Log message enhancements in GlusterFS - phase 1) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2346
Diffstat (limited to 'xlators/cluster')
-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/cluster/dht/src/dht-linkfile.c3
6 files changed, 33 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index ef070a188f7..aa88d609837 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -509,6 +509,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)
@@ -906,6 +916,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);
@@ -935,6 +949,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 06559ede08e..30fcf92b60a 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 8f7133b9730..e9e8a329e38 100644
--- a/xlators/cluster/afr/src/afr-self-heal-entry.c
+++ b/xlators/cluster/afr/src/afr-self-heal-entry.c
@@ -1591,6 +1591,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 b806a524320..aaf3dbcc89d 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 113c7a18d8e..267ef8f6afa 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -4028,7 +4028,8 @@ dht_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (prev->this == dht_first_up_subvol (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);
@@ -4086,6 +4087,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/cluster/dht/src/dht-linkfile.c b/xlators/cluster/dht/src/dht-linkfile.c
index 23314c1a5d7..82419a68bc1 100644
--- a/xlators/cluster/dht/src/dht-linkfile.c
+++ b/xlators/cluster/dht/src/dht-linkfile.c
@@ -92,6 +92,9 @@ dht_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
local->linkfile.stbuf = *stbuf;
+ if (uuid_is_null (local->linkfile.loc.inode->gfid))
+ uuid_copy (local->linkfile.loc.gfid, stbuf->ia_gfid);
+
STACK_WIND (frame, dht_linkfile_xattr_cbk,
prev->this, prev->this->fops->setxattr,
&local->linkfile.loc, local->linkfile.xattr, 0);