summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2013-01-28 12:55:17 +0530
committerAnand Avati <avati@redhat.com>2013-01-28 00:20:46 -0800
commit99e63168c498cf57f3f8fabab1d2b86a4ea639ce (patch)
tree51da917d93b3832a92d0851afc6c0f4f16511231
parentc950d3f0e104fc7b78e493ad7ca0005a600b00f9 (diff)
cluster/afr: before checking lock_count of internal lock make sure its not
entrylk when the expected lock count is equal to the attempted lock count, then before deciding that lock is failed on all the nodes, make sure the lock type is checked properly. Change-Id: I1f362d54320cb6ec5654c5c69915c0f61c91d8c7 BUG: 765564 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.org/4436 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r--tests/bugs/bug-765564.t3
-rw-r--r--xlators/cluster/afr/src/afr-lk-common.c25
2 files changed, 16 insertions, 12 deletions
diff --git a/tests/bugs/bug-765564.t b/tests/bugs/bug-765564.t
index cf00f520f14..c1f29d92e09 100644
--- a/tests/bugs/bug-765564.t
+++ b/tests/bugs/bug-765564.t
@@ -63,6 +63,9 @@ function rm_mv_correctness () {
return $ret
}
+TEST touch a;
+TEST mv a b;
+
TEST rm_mv_correctness;
TEST umount $M0;
cleanup;
diff --git a/xlators/cluster/afr/src/afr-lk-common.c b/xlators/cluster/afr/src/afr-lk-common.c
index 802f91f5fa7..265330d115b 100644
--- a/xlators/cluster/afr/src/afr-lk-common.c
+++ b/xlators/cluster/afr/src/afr-lk-common.c
@@ -1030,6 +1030,7 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int cookie)
int ret = 0;
int child_index = 0;
int lockee_no = 0;
+ gf_boolean_t is_entrylk = _gf_false;
local = frame->local;
int_lock = &local->internal_lock;
@@ -1074,23 +1075,23 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int cookie)
child_index++;
}
- if ((int_lock->lk_expected_count == int_lock->lk_attempted_count) &&
- ((afr_is_entrylk (int_lock, local->transaction.type) &&
- int_lock->entrylk_lock_count == 0) ||
- (int_lock->lock_count == 0))){
-
- gf_log (this->name, GF_LOG_INFO,
- "unable to lock on even one child");
+ if (int_lock->lk_expected_count == int_lock->lk_attempted_count) {
+ is_entrylk = afr_is_entrylk (int_lock, local->transaction.type);
- local->op_ret = -1;
- int_lock->lock_op_ret = -1;
+ if ((is_entrylk && int_lock->entrylk_lock_count == 0) ||
+ (!is_entrylk && int_lock->lock_count == 0)) {
+ gf_log (this->name, GF_LOG_INFO,
+ "unable to lock on even one child");
- afr_copy_locked_nodes (frame, this);
+ local->op_ret = -1;
+ int_lock->lock_op_ret = -1;
- afr_unlock(frame, this);
+ afr_copy_locked_nodes (frame, this);
- return 0;
+ afr_unlock(frame, this);
+ return 0;
+ }
}
if (int_lock->lk_expected_count == int_lock->lk_attempted_count) {