[Ocfs2-commits] khackel commits r1695 - branches/dlm-glue/cluster

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Dec 7 14:18:00 CST 2004


Author: khackel
Date: 2004-12-07 14:17:58 -0600 (Tue, 07 Dec 2004)
New Revision: 1695

Modified:
   branches/dlm-glue/cluster/dlmmod.c
   branches/dlm-glue/cluster/dlmmod.h
Log:
pass flags for remote create/convert, number the status codes for debugging

Modified: branches/dlm-glue/cluster/dlmmod.c
===================================================================
--- branches/dlm-glue/cluster/dlmmod.c	2004-12-06 23:10:07 UTC (rev 1694)
+++ branches/dlm-glue/cluster/dlmmod.c	2004-12-07 20:17:58 UTC (rev 1695)
@@ -98,6 +98,7 @@
 
 typedef struct _dlm_create_lock
 {
+	u32 flags;   // TODO: reduce the size of this
 	u16 node_idx;
 	s8 requested_type;
 	u8 namelen;
@@ -107,6 +108,7 @@
 
 typedef struct _dlm_convert_lock
 {
+	u32 flags;   // TODO: reduce the size of this
 	u16 node_idx;
 	s8 requested_type;
 	u8 namelen;
@@ -116,7 +118,7 @@
 
 typedef struct _dlm_unlock_lock
 {
-	u32 flags;
+	u32 flags;   // TODO: reduce the size of this
 	u16 node_idx;
 	u8 namelen;
 	u8 name[NM_MAX_NAME_LEN];
@@ -425,6 +427,8 @@
 	spin_unlock(&res->spinlock);
 	dlm_kick_thread(dlm, res);
 	if (!got_it && (flags & LKM_NOQUEUE)) {
+		dlmprintk("did not get NOQUEUE lock %*s at level %d\n", 
+			  res->lockname.len, res->lockname.name, lock->type);
 		return DLM_NOTQUEUED;
 	}
 	return DLM_NORMAL;
@@ -494,7 +498,6 @@
 	dlm_status status = DLM_NORMAL;
 	struct list_head *iter;
 	dlm_lock *tmplock=NULL;
-	int remote_in_place = 0;
 
 	dlmprintk("type=%d, convert_type=%d, new convert_type=%d\n", lock->type, lock->convert_type, type);
 
@@ -543,11 +546,8 @@
 	/* fall thru to grant */
 
 grant:
-	if (lock->node != dlm->group_index) {
-		dlmprintk0("no in-place convert for nonlocal locks :(  see if this helps...\n");
-		remote_in_place = 1;
-		goto switch_queues;
-	}
+	if (lock->node != dlm->group_index)
+		dlmprintk0("doing in-place convert for nonlocal lock\n");
 
 	/* immediately grant the new lock type */
 	//printk("doing in-place %sconvert from %d to %d\n", 
@@ -575,6 +575,8 @@
 
 switch_queues:
 	if (flags & LKM_NOQUEUE) {
+		dlmprintk("failed to convert NOQUEUE lock %*s from %d to %d...\n",
+			  res->lockname.len, res->lockname.name, lock->type, type);
 		spin_unlock(&lock->spinlock);
 		spin_unlock(&res->spinlock);
 		return DLM_NOTQUEUED;
@@ -582,11 +584,7 @@
 
 	lock->convert_type = type;
 	list_del(&lock->list);
-	/* make sure the remote in-place convert gets handled right away */
-	if (remote_in_place)
-		list_add(&lock->list, &res->converting);
-	else
-		list_add_tail(&lock->list, &res->converting);
+	list_add_tail(&lock->list, &res->converting);
 	
 	spin_unlock(&lock->spinlock);
 	spin_unlock(&res->spinlock);
@@ -652,6 +650,8 @@
 	dlm_lock_resource *res;
 	dlm_lock *lock = NULL;
 	int call_ast = 0;
+	
+	dlmprintk0("\n");
 
 	if (!lksb)
 		return DLM_BADARGS;
@@ -682,6 +682,8 @@
 	dlm_status status;
 	int free_lock = 0, remote_ready = 0;
 	int local = 0, remove = 0, regrant = 0;
+	
+	dlmprintk0("\n");
 
 	/* according to spec and opendlm code
 	 *  flags & LKM_CANCEL != 0: must be converting or blocked
@@ -925,6 +927,8 @@
 	dlm_lock_resource *tmpres=NULL;
 	struct list_head *bucket;
 	
+	dlmprintk0("\n");
+
 	bucket = &(dlm->resources[lockname->hash & DLM_HASH_MASK]);
 
 	/* check for pre-existing lock */
@@ -1435,6 +1439,7 @@
 	create.requested_type = lock->type;
 	create.cookie = lock->cookie;
 	create.namelen = res->lockname.len;
+	create.flags = flags;
 	strncpy(create.name, res->lockname.name, create.namelen);
 
 	ret = DLM_NOLOCKMGR;
@@ -1489,8 +1494,16 @@
 	if (res) {
 		spin_lock(&res->spinlock);
 		newlock->lockres = res;
-		status = dlmlock_local(dlm, res, newlock, 0);
+		status = dlmlock_local(dlm, res, newlock, create->flags);
 		spin_unlock(&res->spinlock);
+
+		if (create->flags & LKM_NOQUEUE &&
+		    status == DLM_NOTQUEUED) {
+			dlmprintk("failed to get NOQUEUE lock %*s at level %d...\n",
+				  res->lockname.len, res->lockname.name, newlock->type);
+			/* never added to blocked queue, just delete */
+			kfree(newlock);
+		}
 	}
 
 	return status;
@@ -1512,6 +1525,7 @@
 	convert.requested_type = type;
 	convert.cookie = lock->cookie;
 	convert.namelen = res->lockname.len;
+	convert.flags = flags;
 	strncpy(convert.name, res->lockname.name, convert.namelen);
 
 	ret = DLM_NOLOCKMGR;
@@ -1565,7 +1579,7 @@
 			    lock->node == convert->node_idx) {
 				found = 1;
 	rdtsc(u5.hilo[0], u5.hilo[1]);
-				status = dlmconvert_local(dlm, res, lock, 0, convert->requested_type);
+				status = dlmconvert_local(dlm, res, lock, convert->flags, convert->requested_type);
 	rdtsc(u6.hilo[0], u6.hilo[1]);
 				break;
 			}

Modified: branches/dlm-glue/cluster/dlmmod.h
===================================================================
--- branches/dlm-glue/cluster/dlmmod.h	2004-12-06 23:10:07 UTC (rev 1694)
+++ branches/dlm-glue/cluster/dlmmod.h	2004-12-07 20:17:58 UTC (rev 1695)
@@ -120,48 +120,48 @@
 }
 
 typedef enum _dlm_status {
-	DLM_NORMAL,               /* request in progress */
-	DLM_GRANTED,              /* request granted */
-	DLM_DENIED,               /* request denied */
-	DLM_DENIED_NOLOCKS,       /* request denied, out of system resources */
-	DLM_WORKING,              /* async request in progress */
-	DLM_BLOCKED,              /* lock request blocked */
-	DLM_BLOCKED_ORPHAN,       /* lock request blocked by a orphan lock*/
-	DLM_DENIED_GRACE_PERIOD,  /* topological change in progress */
-	DLM_SYSERR,               /* system error */
-	DLM_NOSUPPORT,            /* unsupported */
-	DLM_CANCELGRANT,          /* can't cancel convert: already granted */
-	DLM_IVLOCKID,             /* bad lockid */
-	DLM_SYNC,                 /* synchronous request granted */
-	DLM_BADTYPE,              /* bad resource type */
-	DLM_BADRESOURCE,          /* bad resource handle */
-	DLM_MAXHANDLES,           /* no more resource handles */
-	DLM_NOCLINFO,             /* can't contact cluster manager */
-	DLM_NOLOCKMGR,            /* can't contact lock manager */
-	DLM_NOPURGED,             /* can't contact purge daemon */
-	DLM_BADARGS,              /* bad api args */
-	DLM_VOID,                 /* no status */
-	DLM_NOTQUEUED,            /* NOQUEUE was specified and request failed */
-	DLM_IVBUFLEN,             /* invalid resource name length */
-	DLM_CVTUNGRANT,           /* attempted to convert ungranted lock */
-	DLM_BADPARAM,             /* invalid lock mode specified */
-	DLM_VALNOTVALID,          /* value block has been invalidated */
-	DLM_REJECTED,             /* request rejected, unrecognized client */
-	DLM_ABORT,                /* blocked lock request cancelled */
-	DLM_CANCEL,               /* conversion request cancelled */
-	DLM_IVRESHANDLE,          /* invalid resource handle */
-	DLM_DEADLOCK,             /* deadlock recovery refused this request */
-	DLM_DENIED_NOASTS,        /* failed to allocate AST */
-	DLM_FORWARD,              /* request must wait for primary's response */
-	DLM_TIMEOUT,              /* timeout value for lock has expired */
-	DLM_IVGROUPID,            /* invalid group specification */
-	DLM_VERS_CONFLICT,        /* version conflicts prevent request handling */
-	DLM_BAD_DEVICE_PATH,      /* Locks device does not exist or path wrong */
-	DLM_NO_DEVICE_PERMISSION, /* Client has insufficient pers for device */
-	DLM_NO_CONTROL_DEVICE,    /* Cannot set options on opened device */
-	DLM_MAXSTATS,             /* upper limit for return code validation */
+	DLM_NORMAL,               /*  0: request in progress */
+	DLM_GRANTED,              /*  1: request granted */
+	DLM_DENIED,               /*  2: request denied */
+	DLM_DENIED_NOLOCKS,       /*  3: request denied, out of system resources */
+	DLM_WORKING,              /*  4: async request in progress */
+	DLM_BLOCKED,              /*  5: lock request blocked */
+	DLM_BLOCKED_ORPHAN,       /*  6: lock request blocked by a orphan lock*/
+	DLM_DENIED_GRACE_PERIOD,  /*  7: topological change in progress */
+	DLM_SYSERR,               /*  8: system error */
+	DLM_NOSUPPORT,            /*  9: unsupported */
+	DLM_CANCELGRANT,          /* 10: can't cancel convert: already granted */
+	DLM_IVLOCKID,             /* 11: bad lockid */
+	DLM_SYNC,                 /* 12: synchronous request granted */
+	DLM_BADTYPE,              /* 13: bad resource type */
+	DLM_BADRESOURCE,          /* 14: bad resource handle */
+	DLM_MAXHANDLES,           /* 15: no more resource handles */
+	DLM_NOCLINFO,             /* 16: can't contact cluster manager */
+	DLM_NOLOCKMGR,            /* 17: can't contact lock manager */
+	DLM_NOPURGED,             /* 18: can't contact purge daemon */
+	DLM_BADARGS,              /* 19: bad api args */
+	DLM_VOID,                 /* 20: no status */
+	DLM_NOTQUEUED,            /* 21: NOQUEUE was specified and request failed */
+	DLM_IVBUFLEN,             /* 22: invalid resource name length */
+	DLM_CVTUNGRANT,           /* 23: attempted to convert ungranted lock */
+	DLM_BADPARAM,             /* 24: invalid lock mode specified */
+	DLM_VALNOTVALID,          /* 25: value block has been invalidated */
+	DLM_REJECTED,             /* 26: request rejected, unrecognized client */
+	DLM_ABORT,                /* 27: blocked lock request cancelled */
+	DLM_CANCEL,               /* 28: conversion request cancelled */
+	DLM_IVRESHANDLE,          /* 29: invalid resource handle */
+	DLM_DEADLOCK,             /* 30: deadlock recovery refused this request */
+	DLM_DENIED_NOASTS,        /* 31: failed to allocate AST */
+	DLM_FORWARD,              /* 32: request must wait for primary's response */
+	DLM_TIMEOUT,              /* 33: timeout value for lock has expired */
+	DLM_IVGROUPID,            /* 34: invalid group specification */
+	DLM_VERS_CONFLICT,        /* 35: version conflicts prevent request handling */
+	DLM_BAD_DEVICE_PATH,      /* 36: Locks device does not exist or path wrong */
+	DLM_NO_DEVICE_PERMISSION, /* 37: Client has insufficient pers for device */
+	DLM_NO_CONTROL_DEVICE,    /* 38: Cannot set options on opened device */
+	DLM_MAXSTATS,             /* 39: upper limit for return code validation */
 	
-	DLM_RECOVERING            /* our lame addition to allow caller to fail a lock 
+	DLM_RECOVERING            /* 40: our lame addition to allow caller to fail a lock 
 				     request if it is being recovered */
 } dlm_status;
 



More information about the Ocfs2-commits mailing list