[Ocfs2-commits] khackel commits r2259 - trunk/fs/ocfs2/dlm
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Tue May 17 14:10:10 CDT 2005
Author: khackel
Signed-off-by: mfasheh
Date: 2005-05-17 14:10:08 -0500 (Tue, 17 May 2005)
New Revision: 2259
Modified:
trunk/fs/ocfs2/dlm/dlmast.c
Log:
* fixes a crash which occurs when mounting a third node
* eliminates sending of a BAST in certain cases where a new AST obsoletes it
Signed-off-by: mfasheh
Modified: trunk/fs/ocfs2/dlm/dlmast.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmast.c 2005-05-17 05:48:02 UTC (rev 2258)
+++ trunk/fs/ocfs2/dlm/dlmast.c 2005-05-17 19:10:08 UTC (rev 2259)
@@ -52,7 +52,44 @@
static void dlm_update_lvb(dlm_ctxt *dlm, dlm_lock_resource *res,
dlm_lock *lock);
+static int dlm_should_cancel_bast(dlm_ctxt *dlm, dlm_lock *lock);
+/* Should be called as an ast gets queued to see if the new
+ * lock level will obsolete a pending bast.
+ * For example, if dlm_thread queued a bast for an EX lock that
+ * was blocking another EX, but before sending the bast the
+ * lock owner downconverted to NL, the bast is now obsolete.
+ * Only the ast should be sent.
+ * This is needed because the lock and convert paths can queue
+ * asts out-of-band (not waiting for dlm_thread) in order to
+ * allow for LKM_NOQUEUE to get immediate responses. */
+static int dlm_should_cancel_bast(dlm_ctxt *dlm, dlm_lock *lock)
+{
+ assert_spin_locked(&dlm->ast_lock);
+ assert_spin_locked(&lock->spinlock);
+
+ if (lock->ml.highest_blocked == LKM_IVMODE)
+ return 0;
+ DLM_ASSERT(lock->ml.highest_blocked != LKM_NLMODE);
+
+ if (lock->bast_pending &&
+ list_empty(&lock->bast_list))
+ /* old bast already sent, ok */
+ return 0;
+
+ if (lock->ml.type == LKM_EXMODE)
+ /* EX blocks anything left, any bast still valid */
+ return 0;
+ else if (lock->ml.type == LKM_NLMODE)
+ /* NL blocks nothing, no reason to send any bast, cancel it */
+ return 1;
+ else if (lock->ml.highest_blocked != LKM_EXMODE)
+ /* PR only blocks EX */
+ return 1;
+
+ return 0;
+}
+
void __dlm_queue_ast(dlm_ctxt *dlm, dlm_lock *lock)
{
mlog_entry_void();
@@ -68,6 +105,13 @@
/* putting lock on list, add a ref */
dlm_lock_get(lock);
spin_lock(&lock->spinlock);
+
+ /* check to see if this ast obsoletes the bast */
+ if (dlm_should_cancel_bast(dlm, lock)) {
+ lock->bast_pending = 0;
+ list_del_init(&lock->bast_list);
+ lock->ml.highest_blocked = LKM_IVMODE;
+ }
list_add_tail(&lock->ast_list, &dlm->pending_asts);
lock->ast_pending = 1;
spin_unlock(&lock->spinlock);
More information about the Ocfs2-commits
mailing list