From fb9f485db2b4a92c16c0683cf3d5cfcd07054d71 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Tue, 17 Apr 2012 13:20:43 +0530 Subject: features/locks: Find parent-entrylk presence in lookup Change-Id: I8fc85676827f26b07bf578ea1152d3e251adb4af BUG: 765551 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.com/3177 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/features/locks/src/entrylk.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'xlators/features/locks/src/entrylk.c') diff --git a/xlators/features/locks/src/entrylk.c b/xlators/features/locks/src/entrylk.c index e034c37b3..2a47657db 100644 --- a/xlators/features/locks/src/entrylk.c +++ b/xlators/features/locks/src/entrylk.c @@ -441,6 +441,32 @@ out: return ret_lock; } +uint32_t +check_entrylk_on_basename (xlator_t *this, inode_t *parent, char *basename) +{ + uint32_t entrylk = 0; + pl_inode_t *pinode = 0; + pl_dom_list_t *dom = NULL; + pl_entry_lock_t *conf = NULL; + + pinode = pl_inode_get (this, parent); + if (!pinode) + goto out; + pthread_mutex_lock (&pinode->mutex); + { + list_for_each_entry (dom, &pinode->dom_list, inode_list) { + conf = __lock_grantable (dom, basename, ENTRYLK_WRLCK); + if (conf && conf->basename) { + entrylk = 1; + break; + } + } + } + pthread_mutex_unlock (&pinode->mutex); + +out: + return entrylk; +} void __grant_blocked_entry_locks (xlator_t *this, pl_inode_t *pl_inode, -- cgit