cluster/dlm/lib libdlm.c libdlm.h
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
dlm/lib/libdlm.c +33 -5
@@ -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) {
dlm/lib/libdlm.h +5 -0
@@ -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);