summaryrefslogtreecommitdiffstats
path: root/xlators/features/locks/src
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2011-10-22 09:48:17 +0530
committerVijay Bellur <vijay@gluster.com>2011-10-30 22:43:29 -0700
commit0aa270282f0f0a7649d5e07f7d128cef5996cf70 (patch)
tree01d6f633d52dab0aa075b24c807b89bf5a80c8a2 /xlators/features/locks/src
parent262c665845753fa870465eb62a3a9f927a071034 (diff)
locks: perform inode_ref of pl_update_refkeeper outside locked region
Performing inode_ref inside the critical section of pl_update_refkeeper (around pl_inode_t->mutex) causes a deadlock with inode_table_t->lock. The other thread (process state dump) holds the inode_table_t->lock first to loop over inodes and then while dumping an inode's lock context, tries to acquire pl_inode_t->mutex thereby completing the deadlock. The fix is to perform inode_ref outside the critical section in pl_update_refkeeper Change-Id: I689ab4a9b46b36287740279fdec6159182c86119 BUG: 3753 Reviewed-on: http://review.gluster.com/630 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/features/locks/src')
-rw-r--r--xlators/features/locks/src/common.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c
index c957b974c..bf22183ed 100644
--- a/xlators/features/locks/src/common.c
+++ b/xlators/features/locks/src/common.c
@@ -391,6 +391,7 @@ pl_update_refkeeper (xlator_t *this, inode_t *inode)
pl_inode_t *pl_inode = NULL;
int is_empty = 0;
int need_unref = 0;
+ int need_ref = 0;
pl_inode = pl_inode_get (this, inode);
@@ -404,13 +405,17 @@ pl_update_refkeeper (xlator_t *this, inode_t *inode)
}
if (!is_empty && !pl_inode->refkeeper) {
- pl_inode->refkeeper = inode_ref (inode);
+ need_ref = 1;
+ pl_inode->refkeeper = inode;
}
}
pthread_mutex_unlock (&pl_inode->mutex);
if (need_unref)
inode_unref (inode);
+
+ if (need_ref)
+ inode_ref (inode);
}