All of lore.kernel.org
 help / color / mirror / Atom feed
From: teigland@sourceware.org <teigland@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/dlm/lib libdlm.c libdlm.h
Date: 30 May 2007 18:18:03 -0000	[thread overview]
Message-ID: <20070530181803.29529.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	teigland at sourceware.org	2007-05-30 18:18:02

Modified files:
	dlm/lib        : libdlm.c libdlm.h 

Log message:
	Add dlm_ls_deadlock_cancel() that allows a system daemon to cancel
	an application's deadlocked lock.  This requires the latest dlm
	kernel headers.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/dlm/lib/libdlm.c.diff?cvsroot=cluster&r1=1.34&r2=1.35
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/dlm/lib/libdlm.h.diff?cvsroot=cluster&r1=1.14&r2=1.15

--- cluster/dlm/lib/libdlm.c	2007/05/18 16:35:15	1.34
+++ cluster/dlm/lib/libdlm.c	2007/05/30 18:18:02	1.35
@@ -1006,8 +1006,8 @@
  * All the ways to unlock/cancel a lock
  */
 
-static int ls_unlock_v5(struct dlm_ls_info *lsinfo, uint32_t lkid, uint32_t flags,
-			struct dlm_lksb *lksb, void *astarg)
+static int ls_unlock_v5(struct dlm_ls_info *lsinfo, uint32_t lkid,
+			uint32_t flags, struct dlm_lksb *lksb, void *astarg)
 {
 	struct dlm_write_request_v5 req;
 
@@ -1027,8 +1027,8 @@
 		return write(lsinfo->fd, &req, sizeof(req));
 }
 
-static int ls_unlock_v6(struct dlm_ls_info *lsinfo, uint32_t lkid, uint32_t flags,
-			struct dlm_lksb *lksb, void *astarg)
+static int ls_unlock_v6(struct dlm_ls_info *lsinfo, uint32_t lkid,
+			uint32_t flags, struct dlm_lksb *lksb, void *astarg)
 {
 	struct dlm_write_request req;
 
@@ -1091,6 +1091,34 @@
 	return dlm_ls_unlock(default_ls, lkid, flags, lksb, astarg);
 }
 
+int dlm_ls_deadlock_cancel(dlm_lshandle_t ls, uint32_t lkid, uint32_t flags)
+{
+	struct dlm_ls_info *lsinfo = (struct dlm_ls_info *)ls;
+	struct dlm_write_request req;
+
+	if (kernel_version.version[0] < 6) {
+		errno = ENOSYS;
+		return -1;
+	}
+
+	if (ls == NULL) {
+		errno = ENOTCONN;
+		return -1;
+	}
+
+	if (!lkid) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	set_version_v6(&req);
+	req.cmd = DLM_USER_DEADLOCK;
+	req.i.lock.lkid = lkid;
+	req.i.lock.flags = flags;
+
+	return write(lsinfo->fd, &req, sizeof(req));
+}
+
 
 /*
  * Purge
@@ -1130,7 +1158,7 @@
  * do their own fd handling.
  * This allows a non-threaded app to use the DLM.
  */
-int dlm_get_fd()
+int dlm_get_fd(void)
 {
     if (default_ls)
     {
--- cluster/dlm/lib/libdlm.h	2007/05/18 16:35:16	1.14
+++ cluster/dlm/lib/libdlm.h	2007/05/30 18:18:02	1.15
@@ -159,6 +159,7 @@
  * dlm_ls_unlock()
  * dlm_ls_lock_wait()
  * dlm_ls_unlock_wait()
+ * dlm_ls_deadlock_cancel()
  * dlm_ls_purge()
  */
 
@@ -209,6 +210,10 @@
 		uint32_t flags,
 		struct dlm_lksb *lksb);
 
+extern int dlm_ls_deadlock_cancel(dlm_lshandle_t ls,
+		uint32_t lkid,
+		uint32_t flags);
+
 extern int dlm_ls_purge(dlm_lshandle_t lockspace,
 		int nodeid,
 		int pid);



             reply	other threads:[~2007-05-30 18:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-30 18:18 teigland [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-06-05 16:35 [Cluster-devel] cluster/dlm/lib libdlm.c libdlm.h teigland
2007-05-18 16:35 teigland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070530181803.29529.qmail@sourceware.org \
    --to=teigland@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.