X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=fs%2Fdlm%2Fuser.c;h=3870150b83a479396eb6a179757d92c1a61baf2c;hb=5cb69bcacea70024252138a9cb4229a142a93389;hp=494d00ac014e55ae07b1d6ebee9d54fa68fd0637;hpb=ad73c67e792c752ddc99f2b0587abae05255dd6d;p=linux-2.6-omap-h63xx.git diff --git a/fs/dlm/user.c b/fs/dlm/user.c index 494d00ac014..3870150b83a 100644 --- a/fs/dlm/user.c +++ b/fs/dlm/user.c @@ -22,10 +22,11 @@ #include "lockspace.h" #include "lock.h" #include "lvb_table.h" +#include "user.h" static const char *name_prefix="dlm"; static struct miscdevice ctl_device; -static struct file_operations device_fops; +static const struct file_operations device_fops; #ifdef CONFIG_COMPAT @@ -180,6 +181,14 @@ void dlm_user_add_ast(struct dlm_lkb *lkb, int type) ua->lksb.sb_status == -EAGAIN && !list_empty(&lkb->lkb_ownqueue)) remove_ownqueue = 1; + /* unlocks or cancels of waiting requests need to be removed from the + proc's unlocking list, again there must be a better way... */ + + if (ua->lksb.sb_status == -DLM_EUNLOCK || + (ua->lksb.sb_status == -DLM_ECANCEL && + lkb->lkb_grmode == DLM_LOCK_IV)) + remove_ownqueue = 1; + /* We want to copy the lvb to userspace when the completion ast is read if the status is 0, the lock has an lvb and lvb_ops says we should. We could probably have set_lvb_lock() @@ -325,7 +334,7 @@ static int device_remove_lockspace(struct dlm_lspace_params *params) { dlm_lockspace_t *lockspace; struct dlm_ls *ls; - int error; + int error, force = 0; if (!capable(CAP_SYS_ADMIN)) return -EPERM; @@ -341,6 +350,9 @@ static int device_remove_lockspace(struct dlm_lspace_params *params) } kfree(ls->ls_device.name); + if (params->flags & DLM_USER_LSFLG_FORCEFREE) + force = 2; + lockspace = ls->ls_local_handle; /* dlm_release_lockspace waits for references to go to zero, @@ -348,8 +360,8 @@ static int device_remove_lockspace(struct dlm_lspace_params *params) before the release will procede */ dlm_put_lockspace(ls); - error = dlm_release_lockspace(lockspace, 0); -out: + error = dlm_release_lockspace(lockspace, force); + out: return error; } @@ -520,6 +532,7 @@ static int device_open(struct inode *inode, struct file *file) proc->lockspace = ls->ls_local_handle; INIT_LIST_HEAD(&proc->asts); INIT_LIST_HEAD(&proc->locks); + INIT_LIST_HEAD(&proc->unlocking); spin_lock_init(&proc->asts_spin); spin_lock_init(&proc->locks_spin); init_waitqueue_head(&proc->wait); @@ -747,7 +760,7 @@ static int ctl_device_close(struct inode *inode, struct file *file) return 0; } -static struct file_operations device_fops = { +static const struct file_operations device_fops = { .open = device_open, .release = device_close, .read = device_read, @@ -756,7 +769,7 @@ static struct file_operations device_fops = { .owner = THIS_MODULE, }; -static struct file_operations ctl_device_fops = { +static const struct file_operations ctl_device_fops = { .open = ctl_device_open, .release = ctl_device_close, .write = device_write,