[DLM] canceling deadlocked lock
Add a function that can be used through libdlm by a system daemon to cancel another process's deadlocked lock. A completion ast with EDEADLK is returned to the process waiting for the lock. Signed-off-by: David Teigland <teigland@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
This commit is contained in:
committed by
Steven Whitehouse
parent
84d8cd69a8
commit
8b4021fa43
@@ -156,6 +156,7 @@ static int lkb_is_endoflife(struct dlm_lkb *lkb, int sb_status, int type)
|
||||
return 1;
|
||||
case -DLM_ECANCEL:
|
||||
case -ETIMEDOUT:
|
||||
case -EDEADLK:
|
||||
if (lkb->lkb_grmode == DLM_LOCK_IV)
|
||||
return 1;
|
||||
break;
|
||||
@@ -320,6 +321,22 @@ static int device_user_unlock(struct dlm_user_proc *proc,
|
||||
return error;
|
||||
}
|
||||
|
||||
static int device_user_deadlock(struct dlm_user_proc *proc,
|
||||
struct dlm_lock_params *params)
|
||||
{
|
||||
struct dlm_ls *ls;
|
||||
int error;
|
||||
|
||||
ls = dlm_find_lockspace_local(proc->lockspace);
|
||||
if (!ls)
|
||||
return -ENOENT;
|
||||
|
||||
error = dlm_user_deadlock(ls, params->flags, params->lkid);
|
||||
|
||||
dlm_put_lockspace(ls);
|
||||
return error;
|
||||
}
|
||||
|
||||
static int create_misc_device(struct dlm_ls *ls, char *name)
|
||||
{
|
||||
int error, len;
|
||||
@@ -545,6 +562,14 @@ static ssize_t device_write(struct file *file, const char __user *buf,
|
||||
error = device_user_unlock(proc, &kbuf->i.lock);
|
||||
break;
|
||||
|
||||
case DLM_USER_DEADLOCK:
|
||||
if (!proc) {
|
||||
log_print("no locking on control device");
|
||||
goto out_sig;
|
||||
}
|
||||
error = device_user_deadlock(proc, &kbuf->i.lock);
|
||||
break;
|
||||
|
||||
case DLM_USER_CREATE_LOCKSPACE:
|
||||
if (proc) {
|
||||
log_print("create/remove only on control device");
|
||||
|
Reference in New Issue
Block a user