From bca2449cb59727196d328462c912a1be20117b9d Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Mon, 13 May 2013 09:51:49 +0530 Subject: cluster/dht: Do migration inprog/complete check only if ENOENT Additionally, update op_errno to the lasted failure. If failures found in complete_check, error returned would be EUCLEAN instead of the right failure (in this case ENOENT) Change-Id: Ib813867f4b817af651627b9ea07b0b09fa2b26ce BUG: 966852 Signed-off-by: shishir gowda Reviewed-on: http://review.gluster.org/4989 Reviewed-by: Amar Tumballi Reviewed-by: Vijay Bellur Tested-by: Gluster Build System --- xlators/cluster/dht/src/dht-inode-read.c | 6 +++++- xlators/cluster/dht/src/dht-inode-write.c | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/xlators/cluster/dht/src/dht-inode-read.c b/xlators/cluster/dht/src/dht-inode-read.c index f17cb73b9..d9b311fe2 100644 --- a/xlators/cluster/dht/src/dht-inode-read.c +++ b/xlators/cluster/dht/src/dht-inode-read.c @@ -154,6 +154,7 @@ dht_file_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (local->call_cnt != 1) goto out; + local->op_errno = op_errno; /* Check if the rebalance phase2 is true */ if ((op_ret == -1) || IS_DHT_MIGRATION_PHASE2 (stbuf)) { if (local->fd) @@ -396,6 +397,7 @@ dht_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if ((op_ret == -1) && (op_errno != ENOENT)) goto out; + local->op_errno = op_errno; if ((op_ret == -1) || IS_DHT_MIGRATION_PHASE2 (stbuf)) { /* File would be migrated to other node */ ret = fd_ctx_get (local->fd, this, NULL); @@ -517,6 +519,7 @@ dht_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } if ((op_ret == -1) && (op_errno == ENOENT)) { /* File would be migrated to other node */ + local->op_errno = op_errno; local->rebalance.target_op_fn = dht_access2; ret = dht_rebalance_complete_check (frame->this, frame); if (!ret) @@ -706,7 +709,7 @@ dht_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, prev = cookie; local->op_errno = op_errno; - if (op_ret == -1) { + if (op_ret == -1 && (op_errno != ENOENT)) { gf_log (this->name, GF_LOG_DEBUG, "subvolume %s returned -1 (%s)", prev->this->name, strerror (op_errno)); @@ -721,6 +724,7 @@ dht_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, goto out; } + local->op_errno = op_errno; ret = fd_ctx_get (local->fd, this, NULL); if (ret) { local->rebalance.target_op_fn = dht_fsync2; diff --git a/xlators/cluster/dht/src/dht-inode-write.c b/xlators/cluster/dht/src/dht-inode-write.c index d4a3ecc39..b23434cdf 100644 --- a/xlators/cluster/dht/src/dht-inode-write.c +++ b/xlators/cluster/dht/src/dht-inode-write.c @@ -28,7 +28,7 @@ dht_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, dht_local_t *local = NULL; int ret = -1; - if (op_ret == -1) { + if (op_ret == -1 && (op_errno != ENOENT)) { goto out; } @@ -50,6 +50,7 @@ dht_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->rebalance.target_op_fn = dht_writev2; + local->op_errno = op_errno; /* Phase 2 of migration */ if (IS_DHT_MIGRATION_PHASE2 (postbuf)) { ret = dht_rebalance_complete_check (this, frame); @@ -198,6 +199,7 @@ dht_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->rebalance.target_op_fn = dht_truncate2; + local->op_errno = op_errno; /* Phase 2 of migration */ if ((op_ret == -1) || IS_DHT_MIGRATION_PHASE2 (postbuf)) { ret = dht_rebalance_complete_check (this, frame); -- cgit