summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-09-23 06:30:43 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-23 07:51:06 -0700
commitfa3ca3c61fbd7ad95f57f0522624396b8f05ecf6 (patch)
tree56a7c29fc49401544d8c9ac74cb213d36ed83347
parenta2e35ea0166c42435f860990c9476dda470843c8 (diff)
distribute: don't update the inode's gfid directly
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1680 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1680
-rw-r--r--xlators/cluster/dht/src/dht-common.c11
-rw-r--r--xlators/cluster/dht/src/dht-common.h3
-rw-r--r--xlators/cluster/dht/src/dht-linkfile.c10
-rw-r--r--xlators/cluster/dht/src/dht-rename.c1
-rw-r--r--xlators/cluster/dht/src/dht-selfheal.c23
5 files changed, 37 insertions, 11 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 8424d461bbe..f57e5538bcf 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -100,6 +100,10 @@ dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
layout = local->layout;
+ if (!op_ret && uuid_is_null (local->gfid) &&
+ uuid_is_null (local->inode->gfid))
+ memcpy (local->gfid, stbuf->ia_gfid, 16);
+
LOCK (&frame->lock);
{
/* TODO: assert equal mode on stbuf->st_mode and
@@ -544,6 +548,8 @@ dht_lookup_everywhere_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
local->op_errno = op_errno;
goto unlock;
}
+ if (uuid_is_null (local->gfid))
+ memcpy (local->gfid, buf->ia_gfid, 16);
is_linkfile = check_is_linkfile (inode, buf, xattr);
is_dir = check_is_dir (inode, buf, xattr);
@@ -830,8 +836,8 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
/* This is required for handling stale linkfile deletion,
* or any more call which happens from this 'loc'.
*/
- if (uuid_is_null (loc->inode->gfid) && !op_ret)
- memcpy (loc->inode->gfid, stbuf->ia_gfid, 16);
+ if (uuid_is_null (local->gfid) && !op_ret)
+ memcpy (local->gfid, stbuf->ia_gfid, 16);
if (ENTRY_MISSING (op_ret, op_errno)) {
if (conf->search_unhashed == GF_DHT_LOOKUP_UNHASHED_ON) {
@@ -3314,6 +3320,7 @@ dht_link (call_frame_t *frame, xlator_t *this,
}
if (hashed_subvol != cached_subvol) {
+ memcpy (local->gfid, oldloc->inode->gfid, 16);
dht_linkfile_create (frame, dht_link_linkfile_cbk,
cached_subvol, hashed_subvol, newloc);
} else {
diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h
index 918eb566b19..bf3f93d95ef 100644
--- a/xlators/cluster/dht/src/dht-common.h
+++ b/xlators/cluster/dht/src/dht-common.h
@@ -125,6 +125,9 @@ struct dht_local {
char *key;
char *newpath;
+
+ /* gfid related */
+ uuid_t gfid;
};
typedef struct dht_local dht_local_t;
diff --git a/xlators/cluster/dht/src/dht-linkfile.c b/xlators/cluster/dht/src/dht-linkfile.c
index fa84ea29e1a..23f3a880424 100644
--- a/xlators/cluster/dht/src/dht-linkfile.c
+++ b/xlators/cluster/dht/src/dht-linkfile.c
@@ -123,21 +123,27 @@ dht_linkfile_create (call_frame_t *frame, fop_mknod_cbk_t linkfile_cbk,
local->linkfile.srcvol = tovol;
loc_copy (&local->linkfile.loc, loc);
- if (!uuid_is_null (loc->inode->gfid)) {
+ if (!uuid_is_null (local->gfid)) {
dict = dict_new ();
if (!dict)
goto out;
- ret = dict_set_static_bin (dict, "gfid-req", loc->inode->gfid, 16);
+ ret = dict_set_static_bin (dict, "gfid-req", local->gfid, 16);
if (ret)
gf_log ("dht-linkfile", GF_LOG_DEBUG, "gfid set failed");
} else if (local->params) {
dict = dict_ref (local->params);
}
+ if (!dict)
+ gf_log ("", GF_LOG_DEBUG,
+ "dict is NULL, need to make sure gfid's are same");
STACK_WIND (frame, dht_linkfile_create_cbk,
fromvol, fromvol->fops->mknod, loc,
S_IFREG | DHT_LINKFILE_MODE, 0, dict);
+ if (dict)
+ dict_unref (dict);
+
return 0;
out:
local->linkfile.linkfile_cbk (frame, NULL, frame->this, -1, ENOMEM,
diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c
index d88fc74450a..08a548c4d7c 100644
--- a/xlators/cluster/dht/src/dht-rename.c
+++ b/xlators/cluster/dht/src/dht-rename.c
@@ -590,6 +590,7 @@ dht_rename_create_links (call_frame_t *frame)
gf_log (this->name, GF_LOG_TRACE,
"linkfile %s @ %s => %s",
local->loc.path, dst_hashed->name, src_cached->name);
+ memcpy (local->gfid, local->loc.inode->gfid, 16);
dht_linkfile_create (frame, dht_rename_links_cbk,
src_cached, dst_hashed, &local->loc);
}
diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c
index e2dde3cd565..23a39d48ade 100644
--- a/xlators/cluster/dht/src/dht-selfheal.c
+++ b/xlators/cluster/dht/src/dht-selfheal.c
@@ -267,14 +267,23 @@ dht_selfheal_dir_mkdir (call_frame_t *frame, loc_t *loc,
}
local->call_cnt = missing_dirs;
- dict = dict_new ();
- if (!dict)
- return -1;
+ if (!uuid_is_null (local->gfid)) {
+ dict = dict_new ();
+ if (!dict)
+ return -1;
+
+ ret = dict_set_static_bin (dict, "gfid-req", local->gfid, 16);
+ if (ret)
+ gf_log (this->name, GF_LOG_INFO,
+ "failed to set gfid in dict");
+ } else if (local->params) {
+ /* Send the dictionary from higher layers directly */
+ dict = dict_ref (local->params);
+ }
- ret = dict_set_static_bin (dict, "gfid-req", loc->inode->gfid, 16);
- if (ret)
- gf_log (this->name, GF_LOG_INFO,
- "failed to set gfid in dict");
+ if (!dict)
+ gf_log (this->name, GF_LOG_DEBUG,
+ "dict is NULL, need to make sure gfid's are same");
for (i = 0; i < layout->cnt; i++) {
if (layout->list[i].err == ENOENT || force) {