diff options
author | David Teigland <teigland@redhat.com> | 2007-03-30 16:06:16 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2007-05-01 04:11:12 -0400 |
commit | 72c2be776bd6eec5186e316e6d9dd4aab78d314d (patch) | |
tree | 378338f229887375efbb3388068a148227b72b23 /fs | |
parent | 8499137d4ef1829281e04838113b6b09a0bf1269 (diff) |
[DLM] interface for purge (2/2)
Add code to accept purge commands from userland.
Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/dlm/lock.h | 2 | ||||
-rw-r--r-- | fs/dlm/user.c | 28 |
2 files changed, 30 insertions, 0 deletions
diff --git a/fs/dlm/lock.h b/fs/dlm/lock.h index 0843a3073ec3..64fc4ec40668 100644 --- a/fs/dlm/lock.h +++ b/fs/dlm/lock.h | |||
@@ -41,6 +41,8 @@ int dlm_user_unlock(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, | |||
41 | uint32_t flags, uint32_t lkid, char *lvb_in); | 41 | uint32_t flags, uint32_t lkid, char *lvb_in); |
42 | int dlm_user_cancel(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, | 42 | int dlm_user_cancel(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, |
43 | uint32_t flags, uint32_t lkid); | 43 | uint32_t flags, uint32_t lkid); |
44 | int dlm_user_purge(struct dlm_ls *ls, struct dlm_user_proc *proc, | ||
45 | int nodeid, int pid); | ||
44 | void dlm_clear_proc_locks(struct dlm_ls *ls, struct dlm_user_proc *proc); | 46 | void dlm_clear_proc_locks(struct dlm_ls *ls, struct dlm_user_proc *proc); |
45 | 47 | ||
46 | static inline int is_master(struct dlm_rsb *r) | 48 | static inline int is_master(struct dlm_rsb *r) |
diff --git a/fs/dlm/user.c b/fs/dlm/user.c index c978c67b1eff..3e746a6ebac3 100644 --- a/fs/dlm/user.c +++ b/fs/dlm/user.c | |||
@@ -56,6 +56,7 @@ struct dlm_write_request32 { | |||
56 | union { | 56 | union { |
57 | struct dlm_lock_params32 lock; | 57 | struct dlm_lock_params32 lock; |
58 | struct dlm_lspace_params lspace; | 58 | struct dlm_lspace_params lspace; |
59 | struct dlm_purge_params purge; | ||
59 | } i; | 60 | } i; |
60 | }; | 61 | }; |
61 | 62 | ||
@@ -92,6 +93,9 @@ static void compat_input(struct dlm_write_request *kb, | |||
92 | kb->i.lspace.flags = kb32->i.lspace.flags; | 93 | kb->i.lspace.flags = kb32->i.lspace.flags; |
93 | kb->i.lspace.minor = kb32->i.lspace.minor; | 94 | kb->i.lspace.minor = kb32->i.lspace.minor; |
94 | strcpy(kb->i.lspace.name, kb32->i.lspace.name); | 95 | strcpy(kb->i.lspace.name, kb32->i.lspace.name); |
96 | } else if (kb->cmd == DLM_USER_PURGE) { | ||
97 | kb->i.purge.nodeid = kb32->i.purge.nodeid; | ||
98 | kb->i.purge.pid = kb32->i.purge.pid; | ||
95 | } else { | 99 | } else { |
96 | kb->i.lock.mode = kb32->i.lock.mode; | 100 | kb->i.lock.mode = kb32->i.lock.mode; |
97 | kb->i.lock.namelen = kb32->i.lock.namelen; | 101 | kb->i.lock.namelen = kb32->i.lock.namelen; |
@@ -320,6 +324,22 @@ fail: | |||
320 | return error; | 324 | return error; |
321 | } | 325 | } |
322 | 326 | ||
327 | static int device_user_purge(struct dlm_user_proc *proc, | ||
328 | struct dlm_purge_params *params) | ||
329 | { | ||
330 | struct dlm_ls *ls; | ||
331 | int error; | ||
332 | |||
333 | ls = dlm_find_lockspace_local(proc->lockspace); | ||
334 | if (!ls) | ||
335 | return -ENOENT; | ||
336 | |||
337 | error = dlm_user_purge(ls, proc, params->nodeid, params->pid); | ||
338 | |||
339 | dlm_put_lockspace(ls); | ||
340 | return error; | ||
341 | } | ||
342 | |||
323 | static int device_create_lockspace(struct dlm_lspace_params *params) | 343 | static int device_create_lockspace(struct dlm_lspace_params *params) |
324 | { | 344 | { |
325 | dlm_lockspace_t *lockspace; | 345 | dlm_lockspace_t *lockspace; |
@@ -522,6 +542,14 @@ static ssize_t device_write(struct file *file, const char __user *buf, | |||
522 | error = device_remove_lockspace(&kbuf->i.lspace); | 542 | error = device_remove_lockspace(&kbuf->i.lspace); |
523 | break; | 543 | break; |
524 | 544 | ||
545 | case DLM_USER_PURGE: | ||
546 | if (!proc) { | ||
547 | log_print("no locking on control device"); | ||
548 | goto out_sig; | ||
549 | } | ||
550 | error = device_user_purge(proc, &kbuf->i.purge); | ||
551 | break; | ||
552 | |||
525 | default: | 553 | default: |
526 | log_print("Unknown command passed to DLM device : %d\n", | 554 | log_print("Unknown command passed to DLM device : %d\n", |
527 | kbuf->cmd); | 555 | kbuf->cmd); |