From 66b1613efdae3ba2740241ee325e5f0b0634424d Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Wed, 22 Sep 2010 08:50:23 +0000 Subject: distribute: while selfhealing directory, send proper gfid in dict * this was the root cause for having layout mismatches in case of add-brick, because the gfid of directories on newly added brick was always mismatching, which caused many operation on that particular brick fail. Signed-off-by: Amar Tumballi Signed-off-by: Vijay Bellur BUG: 1629 (files missing during add-brick) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1629 --- xlators/cluster/dht/src/dht-common.c | 9 +++++---- xlators/cluster/dht/src/dht-layout.c | 12 ++++++------ xlators/cluster/dht/src/dht-selfheal.c | 19 ++++++++++++++++--- 3 files changed, 27 insertions(+), 13 deletions(-) (limited to 'xlators/cluster') diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index bec412c4188..8fb1537af55 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -225,7 +225,7 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if ((op_errno != ENOTCONN) && (op_errno != ENOENT) && (op_errno != ESTALE)) { - gf_log (this->name, GF_LOG_DEBUG, + gf_log (this->name, GF_LOG_INFO, "subvolume %s returned -1 (%s)", prev->this->name, strerror (op_errno)); } @@ -241,7 +241,7 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } if (stbuf->ia_type != local->inode->ia_type) { - gf_log (this->name, GF_LOG_DEBUG, + gf_log (this->name, GF_LOG_INFO, "mismatching filetypes 0%o v/s 0%o for %s", (stbuf->ia_type), (local->inode->ia_type), local->loc.path); @@ -258,7 +258,7 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, is_linkfile = check_is_linkfile (inode, stbuf, xattr); if (is_linkfile) { - gf_log (this->name, GF_LOG_DEBUG, + gf_log (this->name, GF_LOG_INFO, "linkfile found in revalidate for %s", local->loc.path); local->layout_mismatch = 1; @@ -271,7 +271,7 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, prev->this, &local->loc, xattr); if (ret != 0) { - gf_log (this->name, GF_LOG_DEBUG, + gf_log (this->name, GF_LOG_INFO, "mismatching layouts for %s", local->loc.path); @@ -1755,6 +1755,7 @@ dht_getxattr (call_frame_t *frame, xlator_t *this, goto err; } local->layout = layout; + //layout = dht_layout_new (this, conf->subvolume_cnt); dht_selfheal_new_directory (frame, dht_fix_layout_cbk, layout); diff --git a/xlators/cluster/dht/src/dht-layout.c b/xlators/cluster/dht/src/dht-layout.c index 5ff2bdbe80a..20c77b2a18c 100644 --- a/xlators/cluster/dht/src/dht-layout.c +++ b/xlators/cluster/dht/src/dht-layout.c @@ -558,7 +558,7 @@ dht_layout_normalize (xlator_t *this, loc_t *loc, dht_layout_t *layout) &holes, &overlaps, &missing, &down, &misc); if (ret == -1) { - gf_log (this->name, GF_LOG_DEBUG, + gf_log (this->name, GF_LOG_WARNING, "error while finding anomalies in %s -- not good news", loc->path); goto out; @@ -570,7 +570,7 @@ dht_layout_normalize (xlator_t *this, loc_t *loc, dht_layout_t *layout) "directory %s looked up first time", loc->path); } else { - gf_log (this->name, GF_LOG_DEBUG, + gf_log (this->name, GF_LOG_INFO, "found anomalies in %s. holes=%d overlaps=%d", loc->path, holes, overlaps); } @@ -665,12 +665,12 @@ dht_layout_dir_mismatch (xlator_t *this, dht_layout_t *layout, xlator_t *subvol, start_off = ntoh32 (disk_layout[2]); stop_off = ntoh32 (disk_layout[3]); - + if ((layout->list[pos].start != start_off) || (layout->list[pos].stop != stop_off)) { - gf_log (this->name, GF_LOG_DEBUG, - "subvol: %s; inode layout - %"PRId32" - %"PRId32"; " - "disk layout - %"PRId32" - %"PRId32, + gf_log (this->name, GF_LOG_INFO, + "subvol: %s; inode layout - %"PRIu32" - %"PRIu32"; " + "disk layout - %"PRIu32" - %"PRIu32, layout->list[pos].xlator->name, layout->list[pos].start, layout->list[pos].stop, start_off, stop_off); diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c index 6b3e13b1afc..e2dde3cd565 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -247,10 +247,11 @@ dht_selfheal_dir_mkdir (call_frame_t *frame, loc_t *loc, dht_layout_t *layout, int force) { int missing_dirs = 0; - int i = 0; + int i = 0; + int ret = -1; dht_local_t *local = NULL; xlator_t *this = NULL; - + dict_t *dict = NULL; local = frame->local; this = frame->this; @@ -266,6 +267,15 @@ dht_selfheal_dir_mkdir (call_frame_t *frame, loc_t *loc, } local->call_cnt = missing_dirs; + dict = dict_new (); + if (!dict) + return -1; + + 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"); + for (i = 0; i < layout->cnt; i++) { if (layout->list[i].err == ENOENT || force) { gf_log (this->name, GF_LOG_TRACE, @@ -278,10 +288,13 @@ dht_selfheal_dir_mkdir (call_frame_t *frame, loc_t *loc, loc, st_mode_from_ia (local->stbuf.ia_prot, local->stbuf.ia_type), - NULL); + dict); } } + if (dict) + dict_unref (dict); + return 0; } -- cgit