diff options
author | Raghavendra G <rgowdapp@redhat.com> | 2013-11-04 16:21:14 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-01-28 08:46:43 -0800 |
commit | 0483c68e0d05f1285baff22609f2ec6be65a5306 (patch) | |
tree | 0cbf4bddad907a4ea90cf3f76005d420f5169dcd | |
parent | 58392991ad3b00565124d947522fd14f54d1a901 (diff) |
cluster/dht: set op_errno correctly during migration.
Change-Id: I65acedf92c1003975a584a2ac54527e9a2a1e52f
BUG: 1010241
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-on: http://review.gluster.org/6219
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/6817
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r-- | xlators/cluster/dht/src/dht-helper.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c index 00a98f1cfa5..eb6cd67c981 100644 --- a/xlators/cluster/dht/src/dht-helper.c +++ b/xlators/cluster/dht/src/dht-helper.c @@ -739,6 +739,7 @@ dht_migration_complete_check_task (void *data) fd_t *iter_fd = NULL; uint64_t tmp_subvol = 0; int open_failed = 0; + int32_t op_errno = EINVAL; this = THIS; frame = data; @@ -747,8 +748,10 @@ dht_migration_complete_check_task (void *data) src_node = local->cached_subvol; - if (!local->loc.inode && !local->fd) + if (!local->loc.inode && !local->fd) { + local->op_errno = EINVAL; goto out; + } inode = (!local->fd) ? local->loc.inode : local->fd->inode; @@ -770,16 +773,21 @@ dht_migration_complete_check_task (void *data) if (ret) { if (!dht_inode_missing(errno) || (!local->loc.inode)) { + local->op_errno = errno; gf_log (this->name, GF_LOG_ERROR, "%s: failed to get the 'linkto' xattr %s", local->loc.path, strerror (errno)); goto out; } + /* Need to do lookup on hashed subvol, then get the file */ ret = syncop_lookup (this, &local->loc, NULL, &stbuf, NULL, NULL); - if (ret) + if (ret) { + local->op_errno = op_errno; goto out; + } + dst_node = dht_subvol_get_cached (this, local->loc.inode); } @@ -788,17 +796,21 @@ dht_migration_complete_check_task (void *data) "%s: failed to get the destination node", local->loc.path); ret = -1; + local->op_errno = EINVAL; goto out; } /* lookup on dst */ if (local->loc.inode) { - ret = syncop_lookup (dst_node, &local->loc, NULL, &stbuf, NULL, NULL); + ret = syncop_lookup (dst_node, &local->loc, NULL, &stbuf, 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); + + local->op_errno = errno; goto out; } @@ -807,6 +819,7 @@ dht_migration_complete_check_task (void *data) "%s: gfid different on the target file on %s", local->loc.path, dst_node->name); ret = -1; + local->op_errno = EIO; goto out; } } @@ -820,6 +833,7 @@ dht_migration_complete_check_task (void *data) "%s: could not set preset layout for subvol %s", local->loc.path, dst_node->name); ret = -1; + local->op_errno = EINVAL; goto out; } @@ -829,6 +843,7 @@ dht_migration_complete_check_task (void *data) "%s: no pre-set layout for subvolume %s", local->loc.path, dst_node ? dst_node->name : "<nil>"); ret = -1; + local->op_errno = EINVAL; goto out; } @@ -837,6 +852,7 @@ dht_migration_complete_check_task (void *data) gf_log (this->name, GF_LOG_ERROR, "%s: failed to set the new layout", local->loc.path); + local->op_errno = EINVAL; goto out; } @@ -874,11 +890,14 @@ dht_migration_complete_check_task (void *data) "the fd (%p, flags=0%o) on file %s @ %s", iter_fd, iter_fd->flags, path, dst_node->name); open_failed = 1; + local->op_errno = -ret; + ret = -1; } } GF_FREE (path); SYNCTASK_SETID (frame->root->uid, frame->root->gid); + if (open_failed) { ret = -1; goto out; |