From 99af7219c54b2264ede898fa619125c629519174 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Wed, 30 Mar 2011 00:03:20 +0000 Subject: log gfid mismatches for the same file in cluster xlator lookup This can help in pin pointing some of the issues resulted in gfid mismatch for the same file, which is harder to find through basic debugging/logging of current codebase. Signed-off-by: Amar Tumballi Signed-off-by: Vijay Bellur BUG: 2346 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2346 --- xlators/cluster/afr/src/afr-common.c | 5 +++++ xlators/cluster/dht/src/dht-common.c | 21 ++++++++++++++++++++- xlators/cluster/stripe/src/stripe.c | 7 +++++++ xlators/protocol/client/src/client3_1-fops.c | 2 +- 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 7e54bfe5b..4091cc2a2 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -628,6 +628,11 @@ afr_lookup_self_heal_check (xlator_t *this, afr_local_t *local, local->self_heal.need_data_self_heal = _gf_true; } + if (uuid_compare (buf->ia_gfid, lookup_buf->ia_gfid)) { + /* mismatching gfid */ + gf_log (this->name, GF_LOG_WARNING, + "%s: gfid different on subvolume", local->loc.path); + } } diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 0220d5e59..10f61cca0 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -170,6 +170,13 @@ dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (!op_ret && uuid_is_null (local->gfid)) memcpy (local->gfid, stbuf->ia_gfid, 16); + /* Check if the gfid is different for file from other node */ + if (!op_ret && uuid_compare (local->gfid, stbuf->ia_gfid)) { + gf_log (this->name, GF_LOG_WARNING, + "%s: gfid different on %s", + local->loc.path, prev->this->name); + } + LOCK (&frame->lock); { /* TODO: assert equal mode on stbuf->st_mode and @@ -662,6 +669,12 @@ dht_lookup_everywhere_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (uuid_is_null (local->gfid)) memcpy (local->gfid, buf->ia_gfid, 16); + if (uuid_compare (local->gfid, buf->ia_gfid)) { + gf_log (this->name, GF_LOG_WARNING, + "%s: gfid differs on subvolume %s", + loc->path, prev->this->name); + } + is_linkfile = check_is_linkfile (inode, buf, xattr); is_dir = check_is_dir (inode, buf, xattr); @@ -873,6 +886,12 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie, goto err; } + if (uuid_compare (local->gfid, stbuf->ia_gfid)) { + gf_log (this->name, GF_LOG_WARNING, + "%s: gfid different on data file on %s", + local->loc.path, subvol->name); + } + if ((stbuf->ia_nlink == 1) && (conf && conf->unhashed_sticky_bit)) { stbuf->ia_prot.sticky = 1; @@ -977,7 +996,7 @@ 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 (local->gfid) && !op_ret) + if (!op_ret && uuid_is_null (local->gfid)) memcpy (local->gfid, stbuf->ia_gfid, 16); if (ENTRY_MISSING (op_ret, op_errno)) { diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index f83be785a..de1602614 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -266,6 +266,13 @@ stripe_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->stbuf_size = buf->ia_size; if (local->postparent_size < postparent->ia_size) local->postparent_size = postparent->ia_size; + + /* Make sure the gfid on all the nodes are same */ + if (uuid_compare (local->stbuf.ia_gfid, buf->ia_gfid)) { + gf_log (this->name, GF_LOG_WARNING, + "%s: gfid different on subvolume", + local->loc.path); + } } } UNLOCK (&frame->lock); diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c index 5c01fb5ab..9d0ed5ace 100644 --- a/xlators/protocol/client/src/client3_1-fops.c +++ b/xlators/protocol/client/src/client3_1-fops.c @@ -2204,7 +2204,7 @@ client3_1_lookup_cbk (struct rpc_req *req, struct iovec *iov, int count, if ((!uuid_is_null (inode->gfid)) && (uuid_compare (stbuf.ia_gfid, inode->gfid) != 0)) { - gf_log (frame->this->name, GF_LOG_WARNING, + gf_log (frame->this->name, GF_LOG_DEBUG, "gfid changed for %s", local->loc.path); rsp.op_ret = -1; rsp.op_errno = ESTALE; -- cgit