summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/cluster/dht/src/dht-helper.c25
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 00a98f1cf..eb6cd67c9 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;