From 7413ed951f9b5615dc63f94a8e702cb8f6a8bd98 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Wed, 22 May 2013 11:59:27 +0530 Subject: 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: Ib0db36bbaf0df09fa87c3c3bb6a834db74fc2154 BUG: 965987 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/5062 Reviewed-by: Krishnan Parthasarathi Reviewed-by: Jeff Darcy Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- libglusterfs/src/xlator.c | 16 +++++++++++++--- libglusterfs/src/xlator.h | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index d8997bc7..f9e5db67 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -618,10 +618,12 @@ out: return ret; } -char* -loc_gfid_utoa (loc_t *loc) +void +loc_gfid (loc_t *loc, uuid_t gfid) { - uuid_t gfid={0}; + if (!gfid) + goto out; + uuid_clear (gfid); if (!loc) goto out; @@ -630,6 +632,14 @@ loc_gfid_utoa (loc_t *loc) else if (loc->inode && (!uuid_is_null (loc->inode->gfid))) uuid_copy (gfid, loc->inode->gfid); out: + return; +} + +char* +loc_gfid_utoa (loc_t *loc) +{ + uuid_t gfid; + loc_gfid (loc, gfid); return uuid_utoa (gfid); } diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index 071a4bdb..43fd0638 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -886,6 +886,7 @@ int loc_copy (loc_t *dst, loc_t *src); #define loc_dup(src, dst) loc_copy(dst, src) void loc_wipe (loc_t *loc); int loc_path (loc_t *loc, const char *bname); +void loc_gfid (loc_t *loc, uuid_t gfid); char* loc_gfid_utoa (loc_t *loc); int xlator_mem_acct_init (xlator_t *xl, int num_types); int is_gf_log_command (xlator_t *trans, const char *name, char *value); -- cgit