diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2013-05-22 14:40:22 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-06-06 11:53:39 -0700 |
commit | b7ac8e415961c9e203ed3f56b4115b7eb215ab94 (patch) | |
tree | db71b2c7bfedb31f8762cd63dd1c63f7c04effa0 /xlators | |
parent | fbdbe06a1df2f983f2ec7a3103db932f40653650 (diff) |
cluster/afr: Avoid order mismatch in blocking entrylks
Problem:
When taking blocking entrylks, afr orders the entrylks based on
uuid_compare of gfids of parent dirs, if they are equal then it orders
them based on the basenames. While this approach works fine, the
implementation assumes loc->gfids to be populated at the time of
the comparison, but loc may have gfid in loc->inode->gfid instead
of loc->gfid which was leading to order mismatches and dead-locks.
Fix:
Implemented loc_gfid which gives gfid by checking both loc->gfid,
loc->inode->gfid. Used this for ordering the blocking entrylks.
Change-Id: I2743fcaff3d670fbeb6b8e0a496f106a3585dde1
BUG: 965987
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/5063
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/afr/src/afr-lk-common.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/xlators/cluster/afr/src/afr-lk-common.c b/xlators/cluster/afr/src/afr-lk-common.c index e091a7939fe..812609819f5 100644 --- a/xlators/cluster/afr/src/afr-lk-common.c +++ b/xlators/cluster/afr/src/afr-lk-common.c @@ -57,11 +57,15 @@ int afr_entry_lockee_cmp (const void *l1, const void *l2) { - const afr_entry_lockee_t *r1 = l1; - const afr_entry_lockee_t *r2 = l2; - int ret = 0; - - ret = uuid_compare (r1->loc.gfid, r2->loc.gfid); + const afr_entry_lockee_t *r1 = l1; + const afr_entry_lockee_t *r2 = l2; + int ret = 0; + uuid_t gfid1 = {0}; + uuid_t gfid2 = {0}; + + loc_gfid ((loc_t*)&r1->loc, gfid1); + loc_gfid ((loc_t*)&r2->loc, gfid2); + ret = uuid_compare (gfid1, gfid2); /*Entrylks with NULL basename are the 'smallest'*/ if (ret == 0) { if (!r1->basename) @@ -75,7 +79,6 @@ afr_entry_lockee_cmp (const void *l1, const void *l2) return -1; else return 1; - } int afr_lock_blocking (call_frame_t *frame, xlator_t *this, int child_index); |