[Ocfs2-commits] zab commits r1763 - trunk/cluster
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Wed Jan 12 19:01:14 CST 2005
Author: zab
Date: 2005-01-12 19:01:12 -0600 (Wed, 12 Jan 2005)
New Revision: 1763
Modified:
trunk/cluster/dlmmod.c
Log:
o fix double-unlocks and lock-free list_for_each in unlock paths.
Modified: trunk/cluster/dlmmod.c
===================================================================
--- trunk/cluster/dlmmod.c 2005-01-13 00:59:40 UTC (rev 1762)
+++ trunk/cluster/dlmmod.c 2005-01-13 01:01:12 UTC (rev 1763)
@@ -675,6 +675,7 @@
EXPORT_SYMBOL(dlmunlock);
+/* called holding both res->spinlock and lock->spinlock */
dlm_status dlmunlock_local(dlm_ctxt *dlm, dlm_lock_resource *res, dlm_lock *lock, dlm_lockstatus *lksb, int flags, int *call_ast)
{
dlm_status status;
@@ -938,14 +939,16 @@
status = DLM_IVLOCKID;
res = dlm_lookup_lock(dlm, &lockname);
if (res) {
- spin_lock(&res->spinlock);
queue = &res->granted;
again:
+ found = 0;
+ spin_lock(&res->spinlock);
list_for_each(iter, queue) {
lock = list_entry(iter, dlm_lock, list);
if (lock->cookie == unlock->cookie &&
lock->node == unlock->node_idx) {
found = 1;
+ spin_lock(&lock->spinlock);
lksb = lock->lksb;
/* unlockast only called on originating node */
if (flags & LKM_PUT_LVB) {
@@ -958,6 +961,8 @@
break;
}
}
+ if (!found)
+ spin_unlock(&res->spinlock);
if (queue == &res->granted) {
queue = &res->converting;
goto again;
@@ -965,7 +970,6 @@
queue = &res->blocked;
goto again;
}
- spin_unlock(&res->spinlock);
}
if (!found)
dlmprintk("failed to find lock to unlock! cookie=%llu\n", unlock->cookie);
@@ -1785,7 +1789,9 @@
break;
}
}
- spin_unlock(&res->spinlock);
+ /* dlmconvert_lock released res->spinlock! */
+ if (!found)
+ spin_unlock(&res->spinlock);
}
if (!found)
dlmprintk("failed to find lock to convert on grant queue! cookie=%llu\n", convert->cookie);
More information about the Ocfs2-commits
mailing list