From: David Teigland <teigland@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 2/2] dlm: interface for purge
Date: Fri, 30 Mar 2007 15:06:16 -0500 [thread overview]
Message-ID: <20070330200615.GG13056@redhat.com> (raw)
Add code to accept purge commands from userland.
Signed-off-by: David Teigland <teigland@redhat.com>
Index: linux-2.6.21-rc5-quilt/fs/dlm/lock.h
===================================================================
--- linux-2.6.21-rc5-quilt.orig/fs/dlm/lock.h 2007-03-30 13:33:53.000000000 -0500
+++ linux-2.6.21-rc5-quilt/fs/dlm/lock.h 2007-03-30 14:40:02.000000000 -0500
@@ -41,6 +41,8 @@
uint32_t flags, uint32_t lkid, char *lvb_in);
int dlm_user_cancel(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,
uint32_t flags, uint32_t lkid);
+int dlm_user_purge(struct dlm_ls *ls, struct dlm_user_proc *proc,
+ int nodeid, int pid);
void dlm_clear_proc_locks(struct dlm_ls *ls, struct dlm_user_proc *proc);
static inline int is_master(struct dlm_rsb *r)
Index: linux-2.6.21-rc5-quilt/fs/dlm/user.c
===================================================================
--- linux-2.6.21-rc5-quilt.orig/fs/dlm/user.c 2007-03-30 13:33:53.000000000 -0500
+++ linux-2.6.21-rc5-quilt/fs/dlm/user.c 2007-03-30 14:46:10.000000000 -0500
@@ -56,6 +56,7 @@
union {
struct dlm_lock_params32 lock;
struct dlm_lspace_params lspace;
+ struct dlm_purge_params purge;
} i;
};
@@ -92,6 +93,9 @@
kb->i.lspace.flags = kb32->i.lspace.flags;
kb->i.lspace.minor = kb32->i.lspace.minor;
strcpy(kb->i.lspace.name, kb32->i.lspace.name);
+ } else if (kb->cmd == DLM_USER_PURGE) {
+ kb->i.purge.nodeid = kb32->i.purge.nodeid;
+ kb->i.purge.pid = kb32->i.purge.pid;
} else {
kb->i.lock.mode = kb32->i.lock.mode;
kb->i.lock.namelen = kb32->i.lock.namelen;
@@ -297,6 +301,22 @@
return error;
}
+static int device_user_purge(struct dlm_user_proc *proc,
+ struct dlm_purge_params *params)
+{
+ struct dlm_ls *ls;
+ int error;
+
+ ls = dlm_find_lockspace_local(proc->lockspace);
+ if (!ls)
+ return -ENOENT;
+
+ error = dlm_user_purge(ls, proc, params->nodeid, params->pid);
+
+ dlm_put_lockspace(ls);
+ return error;
+}
+
static int device_create_lockspace(struct dlm_lspace_params *params)
{
dlm_lockspace_t *lockspace;
@@ -508,6 +528,14 @@
error = device_remove_lockspace(&kbuf->i.lspace);
break;
+ case DLM_USER_PURGE:
+ if (!proc) {
+ log_print("no locking on control device");
+ goto out_sig;
+ }
+ error = device_user_purge(proc, &kbuf->i.purge);
+ break;
+
default:
log_print("Unknown command passed to DLM device : %d\n",
kbuf->cmd);
Index: linux-2.6.21-rc5-quilt/include/linux/dlm_device.h
===================================================================
--- linux-2.6.21-rc5-quilt.orig/include/linux/dlm_device.h 2007-03-30 13:33:53.000000000 -0500
+++ linux-2.6.21-rc5-quilt/include/linux/dlm_device.h 2007-03-30 14:40:02.000000000 -0500
@@ -19,7 +19,7 @@
/* Version of the device interface */
#define DLM_DEVICE_VERSION_MAJOR 5
-#define DLM_DEVICE_VERSION_MINOR 0
+#define DLM_DEVICE_VERSION_MINOR 1
#define DLM_DEVICE_VERSION_PATCH 0
/* struct passed to the lock write */
@@ -44,6 +44,11 @@
char name[0];
};
+struct dlm_purge_params {
+ __u32 nodeid;
+ __u32 pid;
+};
+
struct dlm_write_request {
__u32 version[3];
__u8 cmd;
@@ -53,6 +58,7 @@
union {
struct dlm_lock_params lock;
struct dlm_lspace_params lspace;
+ struct dlm_purge_params purge;
} i;
};
@@ -76,6 +82,7 @@
#define DLM_USER_QUERY 3
#define DLM_USER_CREATE_LOCKSPACE 4
#define DLM_USER_REMOVE_LOCKSPACE 5
+#define DLM_USER_PURGE 6
/* Arbitrary length restriction */
#define MAX_LS_NAME_LEN 64
next reply other threads:[~2007-03-30 20:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-30 20:06 David Teigland [this message]
2007-04-02 14:17 ` [Cluster-devel] Re: [PATCH 2/2] dlm: interface for purge Steven Whitehouse
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=20070330200615.GG13056@redhat.com \
--to=teigland@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).