diff options
Diffstat (limited to 'xlators/cluster/afr/src')
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-algorithm.c | 2 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-common.h | 2 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-data.c | 18 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr.h | 1 |
4 files changed, 15 insertions, 8 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-algorithm.c b/xlators/cluster/afr/src/afr-self-heal-algorithm.c index e03e1cc45f0..1721fd270dc 100644 --- a/xlators/cluster/afr/src/afr-self-heal-algorithm.c +++ b/xlators/cluster/afr/src/afr-self-heal-algorithm.c @@ -273,7 +273,7 @@ sh_loop_start (call_frame_t *sh_frame, xlator_t *this, off_t offset, new_loop_sh->offset = offset; new_loop_sh->block_size = sh->block_size; afr_sh_data_lock (new_loop_frame, this, offset, new_loop_sh->block_size, - sh_loop_lock_success, sh_loop_lock_failure); + _gf_true, sh_loop_lock_success, sh_loop_lock_failure); return 0; out: sh->op_failed = 1; diff --git a/xlators/cluster/afr/src/afr-self-heal-common.h b/xlators/cluster/afr/src/afr-self-heal-common.h index 6eabd1766c0..1c83289a950 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.h +++ b/xlators/cluster/afr/src/afr-self-heal-common.h @@ -100,7 +100,7 @@ afr_local_t * afr_local_copy (afr_local_t *l, xlator_t *this); int afr_sh_data_lock (call_frame_t *frame, xlator_t *this, - off_t start, off_t len, + off_t start, off_t len, gf_boolean_t block, afr_lock_cbk_t success_handler, afr_lock_cbk_t failure_handler); void diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c index 5e1e6fe9f6d..bf20d8652bc 100644 --- a/xlators/cluster/afr/src/afr-self-heal-data.c +++ b/xlators/cluster/afr/src/afr-self-heal-data.c @@ -389,7 +389,7 @@ afr_sh_data_erase_pending_cbk (call_frame_t *frame, void *cookie, goto out; } GF_ASSERT (sh->old_loop_frame); - afr_sh_data_lock (frame, this, 0, 0, + afr_sh_data_lock (frame, this, 0, 0, _gf_true, afr_post_sh_big_lock_success, afr_post_sh_big_lock_failure); } @@ -1131,8 +1131,13 @@ afr_sh_data_post_nonblocking_inodelk_cbk (call_frame_t *frame, xlator_t *this) "failed for %s. by %s", local->loc.path, lkowner_utoa (&frame->root->lk_owner)); - int_lock->lock_cbk = afr_sh_data_post_blocking_inodelk_cbk; - afr_blocking_lock (frame, this); + if (!sh->data_lock_block) { + sh->data_lock_failure_handler(frame, this); + } else { + int_lock->lock_cbk = + afr_sh_data_post_blocking_inodelk_cbk; + afr_blocking_lock (frame, this); + } } else { gf_log (this->name, GF_LOG_DEBUG, "Non Blocking data inodelks " @@ -1205,7 +1210,7 @@ afr_post_sh_big_lock_failure (call_frame_t *frame, xlator_t *this) int afr_sh_data_lock (call_frame_t *frame, xlator_t *this, - off_t start, off_t len, + off_t start, off_t len, gf_boolean_t block, afr_lock_cbk_t success_handler, afr_lock_cbk_t failure_handler) { @@ -1217,6 +1222,7 @@ afr_sh_data_lock (call_frame_t *frame, xlator_t *this, sh->data_lock_success_handler = success_handler; sh->data_lock_failure_handler = failure_handler; + sh->data_lock_block = block; return afr_sh_data_lock_rec (frame, this, start, len); } @@ -1270,7 +1276,7 @@ afr_sh_data_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "fd for %s opened, commencing sync", local->loc.path); - afr_sh_data_lock (frame, this, 0, 0, + afr_sh_data_lock (frame, this, 0, 0, _gf_true, afr_sh_data_big_lock_success, afr_sh_data_fail); } @@ -1395,7 +1401,7 @@ afr_self_heal_data (call_frame_t *frame, xlator_t *this) if (IA_ISREG (sh->type)) { afr_sh_data_open (frame, this); } else { - afr_sh_data_lock (frame, this, 0, 0, + afr_sh_data_lock (frame, this, 0, 0, _gf_true, afr_sh_non_reg_lock_success, afr_sh_data_fail); } diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index 7de8d82436c..d22daf51bba 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -266,6 +266,7 @@ typedef struct { struct afr_sh_algorithm *algo; afr_lock_cbk_t data_lock_success_handler; afr_lock_cbk_t data_lock_failure_handler; + gf_boolean_t data_lock_block; int (*completion_cbk) (call_frame_t *frame, xlator_t *this); int (*sh_data_algo_start) (call_frame_t *frame, xlator_t *this); int (*algo_completion_cbk) (call_frame_t *frame, xlator_t *this); |