Skip to contentSkip to conversation

ocfs2 fixes

PATCH New Mark Fasheh 1 participant 1 message Jun 19, 2006 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ocfs2 fixes

Please pull from 'upstream-linus' branch of
git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2.git

to receive the following updates:

 fs/ocfs2/dlm/dlmast.c      |   12 
 fs/ocfs2/dlm/dlmcommon.h   |   63 ++++
 fs/ocfs2/dlm/dlmconvert.c  |   24 +
 fs/ocfs2/dlm/dlmdebug.c    |    6 
 fs/ocfs2/dlm/dlmdebug.h    |   30 --
 fs/ocfs2/dlm/dlmdomain.c   |  101 +++++--
 fs/ocfs2/dlm/dlmfs.c       |    6 
 fs/ocfs2/dlm/dlmlock.c     |   68 ++++-
 fs/ocfs2/dlm/dlmmaster.c   |  448 +++++++++++++++++++++++-----------
 fs/ocfs2/dlm/dlmrecovery.c |  580 ++++++++++++++++++++++++++++++++++-----------
 fs/ocfs2/dlm/dlmthread.c   |   68 ++++-
 fs/ocfs2/dlm/dlmunlock.c   |   10 
 fs/ocfs2/dlm/userdlm.c     |    2 
 13 files changed, 1045 insertions(+), 373 deletions(-)

Adrian Bunk:
fs/ocfs2/dlm/: cleanups

Daniel Phillips:
Clean up ocfs2 hash probe and make it faster
ocfs2: allocate lockres hash pages in an array

Joel Becker:
ocfs2: Alloc at least a page for the DLM hash

Kurt Hackel:
ocfs2: add a small delay after a failed migration
ocfs2: recheck lockres master before sending an unlock request.
ocfs2: fix inverted logic in dlm_is_node_dead
ocfs2: Fix empty lvb check
ocfs2: Better tracking for recovery state changes
ocfs2: only recover one dead node at a time
ocfs2: handle network errors during recovery
ocfs2: clean up recovery related messages
ocfs2: better mle debugging
ocfs2: mle ref counting fixes
ocfs2: detach mle from heartbeat events
ocfs2: properly initialize the mle structure
ocfs2: take mle reference during migration
ocfs2: allow for an assert message during lock mastery
ocfs2: mle ref count debugging
ocfs2: dump lockres info before we BUG() on a bad reference
ocfs2: better error handling during assert master message
ocfs2: dlm recovery / lockres reference count fix
ocfs2: make dlm recovery finalization 2 stage
ocfs2: dump mismatching migrated lvbs before BUG()
ocfs2: purge lockres' sooner
ocfs2: do not send master requests to localhost
ocfs2: update lvb immediately during recovery
ocfs2: gracefully handle stale create_lock messages.
ocfs2: teach dlm_restart_lock_mastery() to wait on recovery
ocfs2: give the dlm dirty list a reference on the lockres
ocfs2: have dlm_pre_master_reco_lockres() ignore dead nodes
ocfs2: increase backoff before waiting for recovery
ocfs2: do not unconditionally purge the lockres in dlmlock_remote()
ocfs2: temporarily disable automatic lock migration
ocfs2: pending mastery asserts and migrations should block each other
ocfs2: special case recovery lock in dlmlock_remote()
ocfs2: dlm_remaster_locks() should never exit without completing
ocfs2: remove unneccesary spin_unlock() in dlm_remaster_locks()
ocfs2: continue recovery when a dead node is encountered
ocfs2: wait for recovery when starting lock mastery
ocfs2: use GFP_NOFS in some dlm operations
ocfs2: use cond_resched() in dlm_thread()
ocfs2: retry operations when a lock is marked in recovery
ocfs2: mlog in dlm_convert_lock_handler() should be ML_ERROR
ocfs2: display message before waiting for recovery to complete
ocfs2: tune down some noisy messages during dlm recovery
ocfs2: fix incorrect error returns
ocfs2: move dlm work to a private work queue
ocfs2: remove whitespace in dlmunlock.c

Mark Fasheh:
ocfs2: move lockres qstr next to hlist_node structure
ocfs2: calculate lockid hash values outside of the spinlock
ocfs2: inline dlm_lockres_get()
ocfs2: silence a compile warning in dlm_alloc_pagevec()
ocfs2: do LVB puts in place
ocfs2: dlm_print_one_mle() needs to be defined
ocfs2: fix compiler warnings in dlm_convert_lock_handler()

fs/ocfs2/dlm/dlmast.c +7 -5
index 355593d..90ce915 100644
@@ -197,12 +197,14 @@ static void dlm_update_lvb(struct dlm_ct
 				  lock->ml.node == dlm->node_num ? "master" :
 				  "remote");
 			memcpy(lksb->lvb, res->lvb, DLM_LVB_LEN);
-		} else if (lksb->flags & DLM_LKSB_PUT_LVB) {
-			mlog(0, "setting lvb from lockres for %s node\n",
-				  lock->ml.node == dlm->node_num ? "master" :
-				  "remote");
-			memcpy(res->lvb, lksb->lvb, DLM_LVB_LEN);
 		}
+		/* Do nothing for lvb put requests - they should be done in
+ 		 * place when the lock is downconverted - otherwise we risk
+ 		 * racing gets and puts which could result in old lvb data
+ 		 * being propagated. We leave the put flag set and clear it
+ 		 * here. In the future we might want to clear it at the time
+ 		 * the put is actually done.
+		 */
 		spin_unlock(&res->spinlock);
 	}
 
fs/ocfs2/dlm/dlmcommon.h +53 -10

152 lines not on this page · raw message

fs/ocfs2/dlm/dlmconvert.c +24 -0
index 8285228..d555dec 100644
@@ -214,6 +214,9 @@ grant:
 	if (lock->ml.node == dlm->node_num)
 		mlog(0, "doing in-place convert for nonlocal lock\n");
 	lock->ml.type = type;
+	if (lock->lksb->flags & DLM_LKSB_PUT_LVB)
+		memcpy(res->lvb, lock->lksb->lvb, DLM_LVB_LEN);
+
 	status = DLM_NORMAL;
 	*call_ast = 1;
 	goto unlock_exit;
@@ -464,6 +467,12 @@ int dlm_convert_lock_handler(struct o2ne
 	}
 
 	spin_lock(&res->spinlock);
+	status = __dlm_lockres_state_to_status(res);
+	if (status != DLM_NORMAL) {
+		spin_unlock(&res->spinlock);
+		dlm_error(status);
+		goto leave;
+	}
 	list_for_each(iter, &res->granted) {
 		lock = list_entry(iter, struct dlm_lock, list);
 		if (lock->ml.cookie == cnv->cookie &&
@@ -473,6 +482,21 @@ int dlm_convert_lock_handler(struct o2ne
 		}
 		lock = NULL;
 	}
+	if (!lock) {
+		__dlm_print_one_lock_resource(res);
+		list_for_each(iter, &res->granted) {
+			lock = list_entry(iter, struct dlm_lock, list);
+			if (lock->ml.node == cnv->node_idx) {
+				mlog(ML_ERROR, "There is something here "
+				     "for node %u, lock->ml.cookie=%llu, "
+				     "cnv->cookie=%llu\n", cnv->node_idx,
+				     (unsigned long long)lock->ml.cookie,
+				     (unsigned long long)cnv->cookie);
+				break;
+			}
+		}
+		lock = NULL;
+	}
 	spin_unlock(&res->spinlock);
 	if (!lock) {
 		status = DLM_IVLOCKID;
fs/ocfs2/dlm/dlmdebug.c +3 -3
index c7eae5d..3f6c8d8 100644
@@ -37,10 +37,8 @@ #include "cluster/tcp.h"
 
 #include "dlmapi.h"
 #include "dlmcommon.h"
-#include "dlmdebug.h"
 
 #include "dlmdomain.h"
-#include "dlmdebug.h"
 
 #define MLOG_MASK_PREFIX ML_DLM
 #include "cluster/masklog.h"
@@ -120,6 +118,7 @@ void dlm_print_one_lock(struct dlm_lock 
 }
 EXPORT_SYMBOL_GPL(dlm_print_one_lock);
 
+#if 0
 void dlm_dump_lock_resources(struct dlm_ctxt *dlm)
 {
 	struct dlm_lock_resource *res;
@@ -136,12 +135,13 @@ void dlm_dump_lock_resources(struct dlm_
 
 	spin_lock(&dlm->spinlock);
 	for (i=0; i<DLM_HASH_BUCKETS; i++) {
-		bucket = &(dlm->lockres_hash[i]);
+		bucket = dlm_lockres_hash(dlm, i);
 		hlist_for_each_entry(res, iter, bucket, hash_node)
 			dlm_print_one_lock_resource(res);
 	}
 	spin_unlock(&dlm->spinlock);
 }
+#endif  /*  0  */
 
 static const char *dlm_errnames[] = {
 	[DLM_NORMAL] =			"DLM_NORMAL",
fs/ocfs2/dlm/dlmdebug.h deleted +0 -30
deleted file mode 100644
index 6858510..0000000
@@ -1,30 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * dlmdebug.h
- *
- * Copyright (C) 2004 Oracle.  All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 021110-1307, USA.
- *
- */
-
-#ifndef DLMDEBUG_H
-#define DLMDEBUG_H
-
-void dlm_dump_lock_resources(struct dlm_ctxt *dlm);
-
-#endif
fs/ocfs2/dlm/dlmdomain.c +72 -29

195 lines not on this page · raw message

fs/ocfs2/dlm/dlmfs.c +3 -3
index 7e88e24..bb2c202 100644
@@ -116,7 +116,7 @@ static int dlmfs_file_open(struct inode 
 	 * doesn't make sense for LVB writes. */
 	file->f_flags &= ~O_APPEND;
 
-	fp = kmalloc(sizeof(*fp), GFP_KERNEL);
+	fp = kmalloc(sizeof(*fp), GFP_NOFS);
 	if (!fp) {
 		status = -ENOMEM;
 		goto bail;
@@ -196,7 +196,7 @@ static ssize_t dlmfs_file_read(struct fi
 	else
 		readlen = count - *ppos;
 
-	lvb_buf = kmalloc(readlen, GFP_KERNEL);
+	lvb_buf = kmalloc(readlen, GFP_NOFS);
 	if (!lvb_buf)
 		return -ENOMEM;
 
@@ -240,7 +240,7 @@ static ssize_t dlmfs_file_write(struct f
 	else
 		writelen = count - *ppos;
 
-	lvb_buf = kmalloc(writelen, GFP_KERNEL);
+	lvb_buf = kmalloc(writelen, GFP_NOFS);
 	if (!lvb_buf)
 		return -ENOMEM;
 
fs/ocfs2/dlm/dlmlock.c +52 -16

121 lines not on this page · raw message

fs/ocfs2/dlm/dlmmaster.c +309 -139

885 lines not on this page · raw message

fs/ocfs2/dlm/dlmrecovery.c +449 -131

1,000 lines not on this page · raw message

fs/ocfs2/dlm/dlmthread.c +62 -6

142 lines not on this page · raw message

fs/ocfs2/dlm/dlmunlock.c +10 -0
index 7b1a275..1fe1112 100644
@@ -319,6 +319,16 @@ static enum dlm_status dlm_send_remote_u
 
 	mlog_entry("%.*s\n", res->lockname.len, res->lockname.name);
 
+	if (owner == dlm->node_num) {
+		/* ended up trying to contact ourself.  this means
+		 * that the lockres had been remote but became local
+		 * via a migration.  just retry it, now as local */
+		mlog(0, "%s:%.*s: this node became the master due to a "
+		     "migration, re-evaluate now\n", dlm->name,
+		     res->lockname.len, res->lockname.name);
+		return DLM_FORWARD;
+	}
+
 	memset(&unlock, 0, sizeof(unlock));
 	unlock.node_idx = dlm->node_num;
 	unlock.flags = cpu_to_be32(flags);
fs/ocfs2/dlm/userdlm.c +1 -1
index 74ca4e5..e641b08 100644
@@ -672,7 +672,7 @@ struct dlm_ctxt *user_dlm_register_conte
 	u32 dlm_key;
 	char *domain;
 
-	domain = kmalloc(name->len + 1, GFP_KERNEL);
+	domain = kmalloc(name->len + 1, GFP_NOFS);
 	if (!domain) {
 		mlog_errno(-ENOMEM);
 		return ERR_PTR(-ENOMEM);