diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2013-05-22 11:59:27 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-06-05 05:22:52 -0700 |
commit | 7413ed951f9b5615dc63f94a8e702cb8f6a8bd98 (patch) | |
tree | f1960bb62fdd21912919b95e1a6498b15f2ac28c /libglusterfs/src/xlator.c | |
parent | 5c1710ed60ccb151ccd7a2890b24bb99518d36da (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: Ib0db36bbaf0df09fa87c3c3bb6a834db74fc2154
BUG: 965987
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/5062
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'libglusterfs/src/xlator.c')
-rw-r--r-- | libglusterfs/src/xlator.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index d8997bc7d..f9e5db671 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); } |