[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/gfs-kernel/src/dlm lock_dlm.h main.c p ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	STABLE
Changes by:	rpeterso sourceware org	2007-03-23 18:05:15

Modified files:
	gfs-kernel/src/dlm: lock_dlm.h main.c plock.c 

Log message:
	Resolves: Bugzilla Bug 233167: [CitiStreet] Kernel Panic when spawn
	listener processes on GFS.  Patch written by Josef Bacik (Whiter).

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/dlm/lock_dlm.h.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.18.2.3.6.4&r2=1.18.2.3.6.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/dlm/main.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.7&r2=1.7.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/dlm/plock.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.12.8.3&r2=1.12.8.4

--- cluster/gfs-kernel/src/dlm/Attic/lock_dlm.h	2007/02/07 15:25:05	1.18.2.3.6.4
+++ cluster/gfs-kernel/src/dlm/Attic/lock_dlm.h	2007/03/23 18:05:14	1.18.2.3.6.5
@@ -46,6 +46,7 @@
 #define LOCK_DLM_STRNAME_BYTES	(24)
 
 #define LOCK_DLM_MAX_NODES	(128)
+#define LOCK_DLM_MAX_PLOCK	(1024)
 
 #define DROP_LOCKS_COUNT	(200000)
 #define DROP_LOCKS_PERIOD	(60)
--- cluster/gfs-kernel/src/dlm/Attic/main.c	2004/11/02 04:50:49	1.7
+++ cluster/gfs-kernel/src/dlm/Attic/main.c	2007/03/23 18:05:14	1.7.8.1
@@ -27,6 +27,7 @@
 int				lock_dlm_max_nodes;
 int				lock_dlm_drop_count;
 int				lock_dlm_drop_period;
+int				lock_dlm_max_plock_get;
 
 static char *                   debug_buf;
 static unsigned int             debug_size;
@@ -153,6 +154,11 @@
 	return sprintf(b, "%d\n", lock_dlm_max_nodes);
 }
 
+static int max_plock_info(char *b, char **start, off_t offset, int length)
+{
+	return sprintf(b, "%d\n", lock_dlm_max_plock_get);
+}
+
 static int drop_count_info(char *b, char **start, off_t offset, int length)
 {
 	return sprintf(b, "%d\n", lock_dlm_drop_count);
@@ -188,6 +194,16 @@
 	return rv;
 }
 
+static int max_plock_write(struct file *file, const char *buffer,
+			   unsigned long count, void *data)
+{
+	int rv = copy_string(buffer, count);
+	if (rv < 0)
+		return rv;
+	lock_dlm_max_plock_get = (int) simple_strtol(proc_str, NULL, 0);
+	return rv;
+}
+
 static int drop_count_write(struct file *file, const char *buffer,
 			    unsigned long count, void *data)
 {
@@ -210,7 +226,8 @@
 
 static void create_proc_entries(void)
 {
-	struct proc_dir_entry *p, *debug, *drop_count, *drop_period, *max_nodes;
+	struct proc_dir_entry *p, *debug, *drop_count, *drop_period,
+		*max_nodes, *plock_get;
 
 	debug = drop_count = drop_period = max_nodes = NULL;
 
@@ -227,6 +244,14 @@
 	p->write_proc = max_nodes_write;
 	max_nodes = p;
 
+	p = create_proc_entry("max_plock_get", 0666, proc_dir);
+	if (!p)
+		goto out;
+	p->owner = THIS_MODULE;
+	p->get_info = max_plock_info;
+	p->write_proc = max_plock_write;
+	plock_get = p;
+
 	p = create_proc_entry("debug", 0444, proc_dir);
 	if (!p)
 		goto out;
@@ -259,6 +284,8 @@
 		remove_proc_entry("drop_count", proc_dir);
 	if (debug)
 		remove_proc_entry("debug", proc_dir);
+	if (plock_get)
+		remove_proc_entry("max_plock_get", proc_dir);
 	if (max_nodes)
 		remove_proc_entry("max_nodes", proc_dir);
 
@@ -270,6 +297,7 @@
 {
 	if (proc_dir) {
 		remove_proc_entry("max_nodes", proc_dir);
+		remove_proc_entry("max_plock_get", proc_dir);
 		remove_proc_entry("debug", proc_dir);
 		remove_proc_entry("drop_period", proc_dir);
 		remove_proc_entry("drop_count", proc_dir);
@@ -298,6 +326,7 @@
 	lock_dlm_max_nodes = LOCK_DLM_MAX_NODES;
 	lock_dlm_drop_count = DROP_LOCKS_COUNT;
 	lock_dlm_drop_period = DROP_LOCKS_PERIOD;
+	lock_dlm_max_plock_get = LOCK_DLM_MAX_PLOCK;
 
 #ifdef CONFIG_PROC_FS
 	create_proc_entries();
--- cluster/gfs-kernel/src/dlm/Attic/plock.c	2006/09/15 17:43:41	1.12.8.3
+++ cluster/gfs-kernel/src/dlm/Attic/plock.c	2007/03/23 18:05:14	1.12.8.4
@@ -30,6 +30,8 @@
 
 #define HEAD      1
 
+extern int lock_dlm_max_plock_get;
+
 static int local_conflict(dlm_t *dlm, struct dlm_resource *r,
 			  struct lm_lockname *name, unsigned long owner,
 			  uint64_t start, uint64_t end, int ex);
@@ -1055,7 +1057,7 @@
 	dlm_lock_t *lp;
 	struct dlm_queryinfo qinfo;
 	struct dlm_lockinfo *lki;
-	int query = 0, s, error;
+	int query = 0, s = 0, error;
 
 	/* acquire a null lock on which to base the query */
 
@@ -1076,14 +1078,13 @@
 	query = DLM_LOCK_THIS | DLM_QUERY_QUEUE_GRANTED |
 		DLM_QUERY_LOCKS_HIGHER;
 
-	for (s = 16; s < dlm->max_nodes + 1; s += 16) {
-
-		lki = kmalloc(s * sizeof(struct dlm_lockinfo), GFP_KERNEL);
+	do {
+		s += 16;
+		lki = kzalloc(s * sizeof(struct dlm_lockinfo), GFP_KERNEL);
 		if (!lki) {
 			error = -ENOMEM;
 			goto out;
 		}
-		memset(lki, 0, s * sizeof(struct dlm_lockinfo));
 		memset(&qinfo, 0, sizeof(qinfo));
 		qinfo.gqi_locksize = s;
 		qinfo.gqi_lockinfo = lki;
@@ -1103,11 +1104,14 @@
 		kfree(lki);
 		if (error != -E2BIG)
 			goto out;
-	}
+	} while (error == -E2BIG && s < lock_dlm_max_plock_get);
 
 	/* check query results for blocking locks */
 
-	error = 0;
+	if (error) {
+		error = -EAGAIN;
+		goto out;
+	}
 
 	for (s = 0; s < qinfo.gqi_lockcount; s++) {
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]