[Linux-cluster] Discover persistent/orphan lock

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

 



We met some problems about DLM's persistent/orphan lock feature. DLM
does nothing when a user mode lock client that holds persistent locks
exits abnormally. Then the resource master has totally no idea about the
persistent/orphan lock. Hence it's impossible for other clients to know
that this lock is an orphan lock. 
Another one is that there is no way to query orphan lock though
dlm_query. A dedicated query command is needed for it.

Any comments?

I did little hacks against DLM to resolve these probelms (please check
out the attachment). I use a special way to notify resouce master when a
lock become orphan lock (conver to the granted mode with a new special
flag).

Best Regards,
Stan
-- 
Opinions expressed are those of the author and do not represent Intel
Corporation
"gpg --recv-keys --keyserver wwwkeys.pgp.net E1390A7F"
{E1390A7F:3AD1 1B0C 2019 E183 0CFF  55E8 369A 8B75 E139 0A7F}


Index: dlm/lib/libdlm.h
===================================================================
RCS file: /cvs/cluster/cluster/dlm/lib/libdlm.h,v
retrieving revision 1.5
diff -u -r1.5 libdlm.h
--- dlm/lib/libdlm.h	13 Oct 2004 13:19:39 -0000	1.5
+++ dlm/lib/libdlm.h	18 Oct 2004 01:37:59 -0000
@@ -75,7 +75,8 @@
 #define DLM_QUERY_LOCKS_EQUAL    0x0300
 #define DLM_QUERY_LOCKS_BLOCKING 0x0400
 #define DLM_QUERY_LOCKS_NOTBLOCK 0x0500
-#define DLM_QUERY_LOCKS_ALL      0x0600
+#define DLM_QUERY_LOCKS_ORPHAN   0x0600
+#define DLM_QUERY_LOCKS_ALL      0x0700
 #define DLM_QUERY_MASK           0x0F00
 
 /* GRMODE is the default for mode comparisons,
Index: dlm-kernel/src/device.c
===================================================================
RCS file: /cvs/cluster/cluster/dlm-kernel/src/device.c,v
retrieving revision 1.20
diff -u -r1.20 device.c
--- dlm-kernel/src/device.c	14 Oct 2004 10:05:41 -0000	1.20
+++ dlm-kernel/src/device.c	18 Oct 2004 01:38:02 -0000
@@ -469,10 +469,23 @@
 		if (lkb->lkb_flags & GDLM_LKFLG_PERSISTENT) {
 			list_del(&old_li->li_ownerqueue);
 
+			/* Update master copy*/
+			if (lkb->lkb_resource->res_nodeid) {
+				status = dlm_lock(f->fi_ls->ls_lockspace, 
+					lkb->lkb_grmode, &li.li_lksb, 
+					DLM_LKF_CONVERT|DLM_LKF_ORPHAN,
+					NULL, 0, 0, ast_routine, &li, NULL, NULL);
+				if (status == 0)
+					wait_for_ast(&li);
+			} else {
+				lkb->lkb_orphan = 1;
+			}
+
 			/* But tidy our references in it */
 			kfree(old_li);
 			lkb->lkb_astparam = (long)NULL;
 			put_file_info(f);
+
 			continue;
 		}
 
Index: dlm-kernel/src/dlm.h
===================================================================
RCS file: /cvs/cluster/cluster/dlm-kernel/src/dlm.h,v
retrieving revision 1.8
diff -u -r1.8 dlm.h
--- dlm-kernel/src/dlm.h	30 Sep 2004 08:19:41 -0000	1.8
+++ dlm-kernel/src/dlm.h	18 Oct 2004 01:38:03 -0000
@@ -143,6 +143,7 @@
 #define DLM_LKF_NOQUEUEBAST    (0x00000800)
 #define DLM_LKF_HEADQUE        (0x00001000)
 #define DLM_LKF_NOORDER        (0x00002000)
+#define DLM_LKF_ORPHAN         (0x00004000)
 
 /*
  * Some return codes that are not in errno.h
@@ -226,7 +227,8 @@
 #define DLM_QUERY_LOCKS_EQUAL    0x0300
 #define DLM_QUERY_LOCKS_BLOCKING 0x0400
 #define DLM_QUERY_LOCKS_NOTBLOCK 0x0500
-#define DLM_QUERY_LOCKS_ALL      0x0600
+#define DLM_QUERY_LOCKS_ORPHAN   0x0600
+#define DLM_QUERY_LOCKS_ALL      0x0700
 #define DLM_QUERY_MASK           0x0F00
 
 /* GRMODE is the default for mode comparisons,
Index: dlm-kernel/src/dlm_internal.h
===================================================================
RCS file: /cvs/cluster/cluster/dlm-kernel/src/dlm_internal.h,v
retrieving revision 1.25
diff -u -r1.25 dlm_internal.h
--- dlm-kernel/src/dlm_internal.h	12 Oct 2004 11:03:13 -0000	1.25
+++ dlm-kernel/src/dlm_internal.h	18 Oct 2004 01:38:04 -0000
@@ -389,7 +389,7 @@
 #define GDLM_LKFLG_PERSISTENT	(0x00000080)
 #define GDLM_LKFLG_NODLCKWT	(0x00000100)
 #define GDLM_LKFLG_EXPEDITE	(0x00000400)
-/* external flags now go up to: (0x00002000) : DLM_LKF_NOORDER */
+/* external flags now go up to: (0x00004000) : DLM_LKF_ORPHAN */
 
 /* internal-only flags */
 #define GDLM_LKFLG_RANGE	(0x00010000)
@@ -432,6 +432,8 @@
 
 	uint32_t		lkb_remid;	/* id on remote partner */
 	uint32_t		lkb_nodeid;	/* id of remote partner */
+	
+	uint32_t		lkb_orphan;	/* orphan lock */
 
 	void *			lkb_astaddr;
 	void *			lkb_bastaddr;
Index: dlm-kernel/src/lockqueue.c
===================================================================
RCS file: /cvs/cluster/cluster/dlm-kernel/src/lockqueue.c,v
retrieving revision 1.29
diff -u -r1.29 lockqueue.c
--- dlm-kernel/src/lockqueue.c	17 Sep 2004 04:43:48 -0000	1.29
+++ dlm-kernel/src/lockqueue.c	18 Oct 2004 01:38:10 -0000
@@ -896,6 +896,13 @@
 
 		lkb = find_lock_by_id(lspace, freq->rr_remlkid);
 
+		/* Special case for update orphan lock status */
+		if(freq->rr_flags & DLM_LKF_ORPHAN) {
+			lkb->lkb_orphan = 1;
+			queue_ast(lkb, AST_COMP, freq->rr_rqmode);
+			break;
+		}	
+		
 		DLM_ASSERT(lkb,
 			   print_request(freq);
 			   printk("nodeid %u\n", nodeid););
Index: dlm-kernel/src/queries.c
===================================================================
RCS file: /cvs/cluster/cluster/dlm-kernel/src/queries.c,v
retrieving revision 1.7
diff -u -r1.7 queries.c
--- dlm-kernel/src/queries.c	20 Aug 2004 09:30:56 -0000	1.7
+++ dlm-kernel/src/queries.c	18 Oct 2004 01:38:14 -0000
@@ -583,6 +583,10 @@
 		case DLM_QUERY_LOCKS_LOWER:
 			if (lkmode < mode)
 				status = add_lock(lkb, qinfo);
+
+		case DLM_QUERY_LOCKS_ORPHAN:
+			if (lkb->lkb_orphan == 1)
+				status = add_lock(lkb, qinfo);
 			break;
 		}
 	}

[Index of Archives]     [Corosync Cluster Engine]     [GFS]     [Linux Virtualization]     [Centos Virtualization]     [Centos]     [Linux RAID]     [Fedora Users]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Camping]

  Powered by Linux