diff options
| author | Ravishankar N <ravishankar@redhat.com> | 2015-07-23 12:09:14 +0530 | 
|---|---|---|
| committer | Raghavendra G <rgowdapp@redhat.com> | 2015-07-24 00:22:15 -0700 | 
| commit | d8e3fedf2a2c41ad0ec468ce44ef03a558abfe4a (patch) | |
| tree | e84874f7622a7a8bd8544c5fd679f144c48be567 | |
| parent | 64727ecddb48f6cb8e497c28276ea78a0fb97991 (diff) | |
dht: send lookup even for fd based operations during rebalance
Backport of http://review.gluster.org/11713
Problem:
dht_rebalance_inprogress_task() was not sending lookups to the
destination subvolume for a file undergoing writes during rebalance. Due to
this, afr was not able to populate the read_subvol and failed the write
with EIO.
Fix:
Send lookup for fd based operations as well.
Thanks to Raghavendra G for helping with the RCA.
Change-Id: Iaa427666328109bbdf228876e62c13b75b7df88e
BUG: 1245934
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: http://review.gluster.org/11744
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: N Balachandran <nbalacha@redhat.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
| -rw-r--r-- | xlators/cluster/dht/src/dht-helper.c | 52 | 
1 files changed, 30 insertions, 22 deletions
diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c index 4fc77f886a6..d7f2058e47f 100644 --- a/xlators/cluster/dht/src/dht-helper.c +++ b/xlators/cluster/dht/src/dht-helper.c @@ -990,7 +990,8 @@ dht_migration_complete_check_task (void *data)          if (ret) {                  gf_log (this->name, GF_LOG_ERROR,                          "%s: failed to lookup the file on %s (%s)", -                        tmp_loc.path, this->name, strerror (-ret)); +                        tmp_loc.path ? tmp_loc.path : uuid_utoa (tmp_loc.gfid), +                        this->name, strerror (-ret));                  local->op_errno = -ret;                  ret = -1;                  goto out; @@ -1008,7 +1009,8 @@ dht_migration_complete_check_task (void *data)                  gf_msg (this->name, GF_LOG_ERROR, 0,                          DHT_MSG_GFID_MISMATCH,                          "%s: gfid different on the target file on %s", -                        tmp_loc.path, dst_node->name); +                        tmp_loc.path ? tmp_loc.path : uuid_utoa (tmp_loc.gfid), +                        dst_node->name);                  ret = -1;                  local->op_errno = EIO;                  goto out; @@ -1185,25 +1187,32 @@ dht_rebalance_inprogress_task (void *data)          local->rebalance.target_node = dst_node;          if (local->loc.inode) { -                /* lookup on dst */ -                ret = syncop_lookup (dst_node, &local->loc, &stbuf, NULL, -                                     NULL, NULL); -                if (ret) { -                        gf_log (this->name, GF_LOG_ERROR, -                                "%s: failed to lookup the file on %s", -                                local->loc.path, dst_node->name); -                        ret = -1; -                        goto out; -                } +                loc_copy (&tmp_loc, &local->loc); +        } else { +                tmp_loc.inode = inode_ref (inode); +                gf_uuid_copy (tmp_loc.gfid, inode->gfid); +        } -                if (gf_uuid_compare (stbuf.ia_gfid, local->loc.inode->gfid)) { -                        gf_msg (this->name, GF_LOG_ERROR, 0, -                                DHT_MSG_GFID_MISMATCH, -                                "%s: gfid different on the target file on %s", -                                local->loc.path, dst_node->name); -                        ret = -1; -                        goto out; -                } +        /* lookup on dst */ +        ret = syncop_lookup (dst_node, &tmp_loc, &stbuf, NULL, +                             NULL, NULL); +        if (ret) { +                gf_log (this->name, GF_LOG_ERROR, +                        "%s: failed to lookup the file on %s", +                        tmp_loc.path ? tmp_loc.path : uuid_utoa (tmp_loc.gfid), +                        dst_node->name); +                ret = -1; +                goto out; +        } + +        if (gf_uuid_compare (stbuf.ia_gfid, tmp_loc.inode->gfid)) { +                gf_msg (this->name, GF_LOG_ERROR, 0, +                        DHT_MSG_GFID_MISMATCH, +                        "%s: gfid different on the target file on %s", +                        tmp_loc.path ? tmp_loc.path : uuid_utoa (tmp_loc.gfid), +                        dst_node->name); +                ret = -1; +                goto out;          }          ret = 0; @@ -1216,7 +1225,6 @@ dht_rebalance_inprogress_task (void *data)           */          SYNCTASK_SETID (0, 0); -        tmp_loc.inode = inode;          inode_path (inode, NULL, &path);          if (path)                  tmp_loc.path = path; @@ -1240,7 +1248,6 @@ dht_rebalance_inprogress_task (void *data)                          open_failed = 1;                  }          } -        GF_FREE (path);          SYNCTASK_SETID (frame->root->uid, frame->root->gid); @@ -1260,6 +1267,7 @@ done:          ret = 0;  out: +        loc_wipe (&tmp_loc);          return ret;  }  | 
