mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-24 17:23:25 -05:00
[DLM] Update DLM to the latest patch level
Signed-off-by: David Teigland <teigland@redhat.com> Signed-off-by: Steve Whitehouse <swhiteho@redhat.com>
This commit is contained in:
parent
ec58002466
commit
901359256b
14 changed files with 147 additions and 151 deletions
16
fs/dlm/ast.c
16
fs/dlm/ast.c
|
@ -21,7 +21,7 @@ static struct list_head ast_queue;
|
||||||
static spinlock_t ast_queue_lock;
|
static spinlock_t ast_queue_lock;
|
||||||
static struct task_struct * astd_task;
|
static struct task_struct * astd_task;
|
||||||
static unsigned long astd_wakeflags;
|
static unsigned long astd_wakeflags;
|
||||||
static struct semaphore astd_running;
|
static struct mutex astd_running;
|
||||||
|
|
||||||
|
|
||||||
void dlm_del_ast(struct dlm_lkb *lkb)
|
void dlm_del_ast(struct dlm_lkb *lkb)
|
||||||
|
@ -56,7 +56,7 @@ static void process_asts(void)
|
||||||
int type = 0, found, bmode;
|
int type = 0, found, bmode;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
found = FALSE;
|
found = 0;
|
||||||
spin_lock(&ast_queue_lock);
|
spin_lock(&ast_queue_lock);
|
||||||
list_for_each_entry(lkb, &ast_queue, lkb_astqueue) {
|
list_for_each_entry(lkb, &ast_queue, lkb_astqueue) {
|
||||||
r = lkb->lkb_resource;
|
r = lkb->lkb_resource;
|
||||||
|
@ -68,7 +68,7 @@ static void process_asts(void)
|
||||||
list_del(&lkb->lkb_astqueue);
|
list_del(&lkb->lkb_astqueue);
|
||||||
type = lkb->lkb_ast_type;
|
type = lkb->lkb_ast_type;
|
||||||
lkb->lkb_ast_type = 0;
|
lkb->lkb_ast_type = 0;
|
||||||
found = TRUE;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
spin_unlock(&ast_queue_lock);
|
spin_unlock(&ast_queue_lock);
|
||||||
|
@ -117,10 +117,10 @@ static int dlm_astd(void *data)
|
||||||
schedule();
|
schedule();
|
||||||
set_current_state(TASK_RUNNING);
|
set_current_state(TASK_RUNNING);
|
||||||
|
|
||||||
down(&astd_running);
|
mutex_lock(&astd_running);
|
||||||
if (test_and_clear_bit(WAKE_ASTS, &astd_wakeflags))
|
if (test_and_clear_bit(WAKE_ASTS, &astd_wakeflags))
|
||||||
process_asts();
|
process_asts();
|
||||||
up(&astd_running);
|
mutex_unlock(&astd_running);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ int dlm_astd_start(void)
|
||||||
|
|
||||||
INIT_LIST_HEAD(&ast_queue);
|
INIT_LIST_HEAD(&ast_queue);
|
||||||
spin_lock_init(&ast_queue_lock);
|
spin_lock_init(&ast_queue_lock);
|
||||||
init_MUTEX(&astd_running);
|
mutex_init(&astd_running);
|
||||||
|
|
||||||
p = kthread_run(dlm_astd, NULL, "dlm_astd");
|
p = kthread_run(dlm_astd, NULL, "dlm_astd");
|
||||||
if (IS_ERR(p))
|
if (IS_ERR(p))
|
||||||
|
@ -157,11 +157,11 @@ void dlm_astd_stop(void)
|
||||||
|
|
||||||
void dlm_astd_suspend(void)
|
void dlm_astd_suspend(void)
|
||||||
{
|
{
|
||||||
down(&astd_running);
|
mutex_lock(&astd_running);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlm_astd_resume(void)
|
void dlm_astd_resume(void)
|
||||||
{
|
{
|
||||||
up(&astd_running);
|
mutex_unlock(&astd_running);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ struct spaces {
|
||||||
struct space {
|
struct space {
|
||||||
struct config_group group;
|
struct config_group group;
|
||||||
struct list_head members;
|
struct list_head members;
|
||||||
struct semaphore members_lock;
|
struct mutex members_lock;
|
||||||
int members_count;
|
int members_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -374,7 +374,7 @@ static struct config_group *make_space(struct config_group *g, const char *name)
|
||||||
sp->group.default_groups[1] = NULL;
|
sp->group.default_groups[1] = NULL;
|
||||||
|
|
||||||
INIT_LIST_HEAD(&sp->members);
|
INIT_LIST_HEAD(&sp->members);
|
||||||
init_MUTEX(&sp->members_lock);
|
mutex_init(&sp->members_lock);
|
||||||
sp->members_count = 0;
|
sp->members_count = 0;
|
||||||
return &sp->group;
|
return &sp->group;
|
||||||
|
|
||||||
|
@ -453,10 +453,10 @@ static struct config_item *make_node(struct config_group *g, const char *name)
|
||||||
nd->nodeid = -1;
|
nd->nodeid = -1;
|
||||||
nd->weight = 1; /* default weight of 1 if none is set */
|
nd->weight = 1; /* default weight of 1 if none is set */
|
||||||
|
|
||||||
down(&sp->members_lock);
|
mutex_lock(&sp->members_lock);
|
||||||
list_add(&nd->list, &sp->members);
|
list_add(&nd->list, &sp->members);
|
||||||
sp->members_count++;
|
sp->members_count++;
|
||||||
up(&sp->members_lock);
|
mutex_unlock(&sp->members_lock);
|
||||||
|
|
||||||
return &nd->item;
|
return &nd->item;
|
||||||
}
|
}
|
||||||
|
@ -466,10 +466,10 @@ static void drop_node(struct config_group *g, struct config_item *i)
|
||||||
struct space *sp = to_space(g->cg_item.ci_parent);
|
struct space *sp = to_space(g->cg_item.ci_parent);
|
||||||
struct node *nd = to_node(i);
|
struct node *nd = to_node(i);
|
||||||
|
|
||||||
down(&sp->members_lock);
|
mutex_lock(&sp->members_lock);
|
||||||
list_del(&nd->list);
|
list_del(&nd->list);
|
||||||
sp->members_count--;
|
sp->members_count--;
|
||||||
up(&sp->members_lock);
|
mutex_unlock(&sp->members_lock);
|
||||||
|
|
||||||
config_item_put(i);
|
config_item_put(i);
|
||||||
}
|
}
|
||||||
|
@ -677,7 +677,7 @@ int dlm_nodeid_list(char *lsname, int **ids_out)
|
||||||
if (!sp)
|
if (!sp)
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
|
|
||||||
down(&sp->members_lock);
|
mutex_lock(&sp->members_lock);
|
||||||
if (!sp->members_count) {
|
if (!sp->members_count) {
|
||||||
rv = 0;
|
rv = 0;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -698,7 +698,7 @@ int dlm_nodeid_list(char *lsname, int **ids_out)
|
||||||
|
|
||||||
*ids_out = ids;
|
*ids_out = ids;
|
||||||
out:
|
out:
|
||||||
up(&sp->members_lock);
|
mutex_unlock(&sp->members_lock);
|
||||||
put_space(sp);
|
put_space(sp);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -713,14 +713,14 @@ int dlm_node_weight(char *lsname, int nodeid)
|
||||||
if (!sp)
|
if (!sp)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
down(&sp->members_lock);
|
mutex_lock(&sp->members_lock);
|
||||||
list_for_each_entry(nd, &sp->members, list) {
|
list_for_each_entry(nd, &sp->members, list) {
|
||||||
if (nd->nodeid != nodeid)
|
if (nd->nodeid != nodeid)
|
||||||
continue;
|
continue;
|
||||||
w = nd->weight;
|
w = nd->weight;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
up(&sp->members_lock);
|
mutex_unlock(&sp->members_lock);
|
||||||
put_space(sp);
|
put_space(sp);
|
||||||
out:
|
out:
|
||||||
return w;
|
return w;
|
||||||
|
|
|
@ -63,12 +63,12 @@ static void print_lock(struct seq_file *s, struct dlm_lkb *lkb,
|
||||||
/* FIXME: this warns on Alpha */
|
/* FIXME: this warns on Alpha */
|
||||||
if (lkb->lkb_status == DLM_LKSTS_CONVERT
|
if (lkb->lkb_status == DLM_LKSTS_CONVERT
|
||||||
|| lkb->lkb_status == DLM_LKSTS_GRANTED)
|
|| lkb->lkb_status == DLM_LKSTS_GRANTED)
|
||||||
seq_printf(s, " %" PRIx64 "-%" PRIx64,
|
seq_printf(s, " %llx-%llx",
|
||||||
lkb->lkb_range[GR_RANGE_START],
|
lkb->lkb_range[GR_RANGE_START],
|
||||||
lkb->lkb_range[GR_RANGE_END]);
|
lkb->lkb_range[GR_RANGE_END]);
|
||||||
if (lkb->lkb_status == DLM_LKSTS_CONVERT
|
if (lkb->lkb_status == DLM_LKSTS_CONVERT
|
||||||
|| lkb->lkb_status == DLM_LKSTS_WAITING)
|
|| lkb->lkb_status == DLM_LKSTS_WAITING)
|
||||||
seq_printf(s, " (%" PRIx64 "-%" PRIx64 ")",
|
seq_printf(s, " (%llx-%llx)",
|
||||||
lkb->lkb_range[RQ_RANGE_START],
|
lkb->lkb_range[RQ_RANGE_START],
|
||||||
lkb->lkb_range[RQ_RANGE_END]);
|
lkb->lkb_range[RQ_RANGE_END]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
static struct file_operations _dlm_fops;
|
static struct file_operations _dlm_fops;
|
||||||
static const char *name_prefix="dlm";
|
static const char *name_prefix="dlm";
|
||||||
static struct list_head user_ls_list;
|
static struct list_head user_ls_list;
|
||||||
static struct semaphore user_ls_lock;
|
static struct mutex user_ls_lock;
|
||||||
|
|
||||||
/* Lock infos are stored in here indexed by lock ID */
|
/* Lock infos are stored in here indexed by lock ID */
|
||||||
static DEFINE_IDR(lockinfo_idr);
|
static DEFINE_IDR(lockinfo_idr);
|
||||||
|
@ -53,6 +53,7 @@ static rwlock_t lockinfo_lock;
|
||||||
#define LI_FLAG_COMPLETE 1
|
#define LI_FLAG_COMPLETE 1
|
||||||
#define LI_FLAG_FIRSTLOCK 2
|
#define LI_FLAG_FIRSTLOCK 2
|
||||||
#define LI_FLAG_PERSISTENT 3
|
#define LI_FLAG_PERSISTENT 3
|
||||||
|
#define LI_FLAG_ONLIST 4
|
||||||
|
|
||||||
/* flags in ls_flags*/
|
/* flags in ls_flags*/
|
||||||
#define LS_FLAG_DELETED 1
|
#define LS_FLAG_DELETED 1
|
||||||
|
@ -211,18 +212,18 @@ static struct user_ls *find_lockspace(int minor)
|
||||||
{
|
{
|
||||||
struct user_ls *lsinfo;
|
struct user_ls *lsinfo;
|
||||||
|
|
||||||
down(&user_ls_lock);
|
mutex_lock(&user_ls_lock);
|
||||||
lsinfo = __find_lockspace(minor);
|
lsinfo = __find_lockspace(minor);
|
||||||
up(&user_ls_lock);
|
mutex_unlock(&user_ls_lock);
|
||||||
|
|
||||||
return lsinfo;
|
return lsinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_lockspace_to_list(struct user_ls *lsinfo)
|
static void add_lockspace_to_list(struct user_ls *lsinfo)
|
||||||
{
|
{
|
||||||
down(&user_ls_lock);
|
mutex_lock(&user_ls_lock);
|
||||||
list_add(&lsinfo->ls_list, &user_ls_list);
|
list_add(&lsinfo->ls_list, &user_ls_list);
|
||||||
up(&user_ls_lock);
|
mutex_unlock(&user_ls_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Register a lockspace with the DLM and create a misc
|
/* Register a lockspace with the DLM and create a misc
|
||||||
|
@ -235,12 +236,11 @@ static int register_lockspace(char *name, struct user_ls **ls, int flags)
|
||||||
|
|
||||||
namelen = strlen(name)+strlen(name_prefix)+2;
|
namelen = strlen(name)+strlen(name_prefix)+2;
|
||||||
|
|
||||||
newls = kmalloc(sizeof(struct user_ls), GFP_KERNEL);
|
newls = kzalloc(sizeof(struct user_ls), GFP_KERNEL);
|
||||||
if (!newls)
|
if (!newls)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memset(newls, 0, sizeof(struct user_ls));
|
|
||||||
|
|
||||||
newls->ls_miscinfo.name = kmalloc(namelen, GFP_KERNEL);
|
newls->ls_miscinfo.name = kzalloc(namelen, GFP_KERNEL);
|
||||||
if (!newls->ls_miscinfo.name) {
|
if (!newls->ls_miscinfo.name) {
|
||||||
kfree(newls);
|
kfree(newls);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -277,7 +277,7 @@ static int register_lockspace(char *name, struct user_ls **ls, int flags)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called with the user_ls_lock semaphore held */
|
/* Called with the user_ls_lock mutex held */
|
||||||
static int unregister_lockspace(struct user_ls *lsinfo, int force)
|
static int unregister_lockspace(struct user_ls *lsinfo, int force)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
@ -305,11 +305,10 @@ static int unregister_lockspace(struct user_ls *lsinfo, int force)
|
||||||
static void add_to_astqueue(struct lock_info *li, void *astaddr, void *astparam,
|
static void add_to_astqueue(struct lock_info *li, void *astaddr, void *astparam,
|
||||||
int lvb_updated)
|
int lvb_updated)
|
||||||
{
|
{
|
||||||
struct ast_info *ast = kmalloc(sizeof(struct ast_info), GFP_KERNEL);
|
struct ast_info *ast = kzalloc(sizeof(struct ast_info), GFP_KERNEL);
|
||||||
if (!ast)
|
if (!ast)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memset(ast, 0, sizeof(*ast));
|
|
||||||
ast->result.user_astparam = astparam;
|
ast->result.user_astparam = astparam;
|
||||||
ast->result.user_astaddr = astaddr;
|
ast->result.user_astaddr = astaddr;
|
||||||
ast->result.user_lksb = li->li_user_lksb;
|
ast->result.user_lksb = li->li_user_lksb;
|
||||||
|
@ -382,6 +381,7 @@ static void ast_routine(void *param)
|
||||||
|
|
||||||
spin_lock(&li->li_file->fi_li_lock);
|
spin_lock(&li->li_file->fi_li_lock);
|
||||||
list_del(&li->li_ownerqueue);
|
list_del(&li->li_ownerqueue);
|
||||||
|
clear_bit(LI_FLAG_ONLIST, &li->li_flags);
|
||||||
spin_unlock(&li->li_file->fi_li_lock);
|
spin_unlock(&li->li_file->fi_li_lock);
|
||||||
release_lockinfo(li);
|
release_lockinfo(li);
|
||||||
return;
|
return;
|
||||||
|
@ -437,7 +437,7 @@ static int dlm_open(struct inode *inode, struct file *file)
|
||||||
if (!lsinfo)
|
if (!lsinfo)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
f = kmalloc(sizeof(struct file_info), GFP_KERNEL);
|
f = kzalloc(sizeof(struct file_info), GFP_KERNEL);
|
||||||
if (!f)
|
if (!f)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -570,7 +570,7 @@ static int dlm_close(struct inode *inode, struct file *file)
|
||||||
* then free the struct. If it's an AUTOFREE lockspace
|
* then free the struct. If it's an AUTOFREE lockspace
|
||||||
* then free the whole thing.
|
* then free the whole thing.
|
||||||
*/
|
*/
|
||||||
down(&user_ls_lock);
|
mutex_lock(&user_ls_lock);
|
||||||
if (atomic_dec_and_test(&lsinfo->ls_refcnt)) {
|
if (atomic_dec_and_test(&lsinfo->ls_refcnt)) {
|
||||||
|
|
||||||
if (lsinfo->ls_lockspace) {
|
if (lsinfo->ls_lockspace) {
|
||||||
|
@ -582,7 +582,7 @@ static int dlm_close(struct inode *inode, struct file *file)
|
||||||
kfree(lsinfo);
|
kfree(lsinfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
up(&user_ls_lock);
|
mutex_unlock(&user_ls_lock);
|
||||||
put_file_info(f);
|
put_file_info(f);
|
||||||
|
|
||||||
/* Restore signals */
|
/* Restore signals */
|
||||||
|
@ -620,10 +620,10 @@ static int do_user_remove_lockspace(struct file_info *fi, uint8_t cmd,
|
||||||
if (!capable(CAP_SYS_ADMIN))
|
if (!capable(CAP_SYS_ADMIN))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
down(&user_ls_lock);
|
mutex_lock(&user_ls_lock);
|
||||||
lsinfo = __find_lockspace(kparams->minor);
|
lsinfo = __find_lockspace(kparams->minor);
|
||||||
if (!lsinfo) {
|
if (!lsinfo) {
|
||||||
up(&user_ls_lock);
|
mutex_unlock(&user_ls_lock);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -631,7 +631,7 @@ static int do_user_remove_lockspace(struct file_info *fi, uint8_t cmd,
|
||||||
force = 2;
|
force = 2;
|
||||||
|
|
||||||
status = unregister_lockspace(lsinfo, force);
|
status = unregister_lockspace(lsinfo, force);
|
||||||
up(&user_ls_lock);
|
mutex_unlock(&user_ls_lock);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -752,7 +752,7 @@ static struct lock_info *allocate_lockinfo(struct file_info *fi, uint8_t cmd,
|
||||||
if (!try_module_get(THIS_MODULE))
|
if (!try_module_get(THIS_MODULE))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
li = kmalloc(sizeof(struct lock_info), GFP_KERNEL);
|
li = kzalloc(sizeof(struct lock_info), GFP_KERNEL);
|
||||||
if (li) {
|
if (li) {
|
||||||
li->li_magic = LOCKINFO_MAGIC;
|
li->li_magic = LOCKINFO_MAGIC;
|
||||||
li->li_file = fi;
|
li->li_file = fi;
|
||||||
|
@ -800,8 +800,10 @@ static int do_user_lock(struct file_info *fi, uint8_t cmd,
|
||||||
|
|
||||||
/* If this is a persistent lock we will have to create a
|
/* If this is a persistent lock we will have to create a
|
||||||
lockinfo again */
|
lockinfo again */
|
||||||
if (!li && DLM_LKF_PERSISTENT) {
|
if (!li && (kparams->flags & DLM_LKF_PERSISTENT)) {
|
||||||
li = allocate_lockinfo(fi, cmd, kparams);
|
li = allocate_lockinfo(fi, cmd, kparams);
|
||||||
|
if (!li)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
li->li_lksb.sb_lkid = kparams->lkid;
|
li->li_lksb.sb_lkid = kparams->lkid;
|
||||||
li->li_castaddr = kparams->castaddr;
|
li->li_castaddr = kparams->castaddr;
|
||||||
|
@ -887,6 +889,7 @@ static int do_user_lock(struct file_info *fi, uint8_t cmd,
|
||||||
|
|
||||||
spin_lock(&fi->fi_li_lock);
|
spin_lock(&fi->fi_li_lock);
|
||||||
list_add(&li->li_ownerqueue, &fi->fi_li_list);
|
list_add(&li->li_ownerqueue, &fi->fi_li_list);
|
||||||
|
set_bit(LI_FLAG_ONLIST, &li->li_flags);
|
||||||
spin_unlock(&fi->fi_li_lock);
|
spin_unlock(&fi->fi_li_lock);
|
||||||
if (add_lockinfo(li))
|
if (add_lockinfo(li))
|
||||||
printk(KERN_WARNING "Add lockinfo failed\n");
|
printk(KERN_WARNING "Add lockinfo failed\n");
|
||||||
|
@ -914,12 +917,13 @@ static int do_user_unlock(struct file_info *fi, uint8_t cmd,
|
||||||
li = get_lockinfo(kparams->lkid);
|
li = get_lockinfo(kparams->lkid);
|
||||||
if (!li) {
|
if (!li) {
|
||||||
li = allocate_lockinfo(fi, cmd, kparams);
|
li = allocate_lockinfo(fi, cmd, kparams);
|
||||||
|
if (!li)
|
||||||
|
return -ENOMEM;
|
||||||
spin_lock(&fi->fi_li_lock);
|
spin_lock(&fi->fi_li_lock);
|
||||||
list_add(&li->li_ownerqueue, &fi->fi_li_list);
|
list_add(&li->li_ownerqueue, &fi->fi_li_list);
|
||||||
|
set_bit(LI_FLAG_ONLIST, &li->li_flags);
|
||||||
spin_unlock(&fi->fi_li_lock);
|
spin_unlock(&fi->fi_li_lock);
|
||||||
}
|
}
|
||||||
if (!li)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
if (li->li_magic != LOCKINFO_MAGIC)
|
if (li->li_magic != LOCKINFO_MAGIC)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -932,6 +936,12 @@ static int do_user_unlock(struct file_info *fi, uint8_t cmd,
|
||||||
if (kparams->flags & DLM_LKF_CANCEL && li->li_grmode != -1)
|
if (kparams->flags & DLM_LKF_CANCEL && li->li_grmode != -1)
|
||||||
convert_cancel = 1;
|
convert_cancel = 1;
|
||||||
|
|
||||||
|
/* Wait until dlm_lock() has completed */
|
||||||
|
if (!test_bit(LI_FLAG_ONLIST, &li->li_flags)) {
|
||||||
|
down(&li->li_firstlock);
|
||||||
|
up(&li->li_firstlock);
|
||||||
|
}
|
||||||
|
|
||||||
/* dlm_unlock() passes a 0 for castaddr which means don't overwrite
|
/* dlm_unlock() passes a 0 for castaddr which means don't overwrite
|
||||||
the existing li_castaddr as that's the completion routine for
|
the existing li_castaddr as that's the completion routine for
|
||||||
unlocks. dlm_unlock_wait() specifies a new AST routine to be
|
unlocks. dlm_unlock_wait() specifies a new AST routine to be
|
||||||
|
@ -947,6 +957,7 @@ static int do_user_unlock(struct file_info *fi, uint8_t cmd,
|
||||||
if (!status && !convert_cancel) {
|
if (!status && !convert_cancel) {
|
||||||
spin_lock(&fi->fi_li_lock);
|
spin_lock(&fi->fi_li_lock);
|
||||||
list_del(&li->li_ownerqueue);
|
list_del(&li->li_ownerqueue);
|
||||||
|
clear_bit(LI_FLAG_ONLIST, &li->li_flags);
|
||||||
spin_unlock(&fi->fi_li_lock);
|
spin_unlock(&fi->fi_li_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1055,7 +1066,7 @@ static int __init dlm_device_init(void)
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
INIT_LIST_HEAD(&user_ls_list);
|
INIT_LIST_HEAD(&user_ls_list);
|
||||||
init_MUTEX(&user_ls_lock);
|
mutex_init(&user_ls_lock);
|
||||||
rwlock_init(&lockinfo_lock);
|
rwlock_init(&lockinfo_lock);
|
||||||
|
|
||||||
ctl_device.name = "dlm-control";
|
ctl_device.name = "dlm-control";
|
||||||
|
|
|
@ -33,7 +33,7 @@ static void put_free_de(struct dlm_ls *ls, struct dlm_direntry *de)
|
||||||
|
|
||||||
static struct dlm_direntry *get_free_de(struct dlm_ls *ls, int len)
|
static struct dlm_direntry *get_free_de(struct dlm_ls *ls, int len)
|
||||||
{
|
{
|
||||||
int found = FALSE;
|
int found = 0;
|
||||||
struct dlm_direntry *de;
|
struct dlm_direntry *de;
|
||||||
|
|
||||||
spin_lock(&ls->ls_recover_list_lock);
|
spin_lock(&ls->ls_recover_list_lock);
|
||||||
|
@ -42,7 +42,7 @@ static struct dlm_direntry *get_free_de(struct dlm_ls *ls, int len)
|
||||||
list_del(&de->list);
|
list_del(&de->list);
|
||||||
de->master_nodeid = 0;
|
de->master_nodeid = 0;
|
||||||
memset(de->name, 0, len);
|
memset(de->name, 0, len);
|
||||||
found = TRUE;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include <linux/kref.h>
|
#include <linux/kref.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/jhash.h>
|
#include <linux/jhash.h>
|
||||||
|
#include <linux/mutex.h>
|
||||||
#include <asm/semaphore.h>
|
#include <asm/semaphore.h>
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
|
|
||||||
|
@ -42,20 +43,6 @@
|
||||||
|
|
||||||
#define DLM_LOCKSPACE_LEN 64
|
#define DLM_LOCKSPACE_LEN 64
|
||||||
|
|
||||||
#ifndef TRUE
|
|
||||||
#define TRUE 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef FALSE
|
|
||||||
#define FALSE 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (BITS_PER_LONG == 64)
|
|
||||||
#define PRIx64 "lx"
|
|
||||||
#else
|
|
||||||
#define PRIx64 "Lx"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Size of the temp buffer midcomms allocates on the stack.
|
/* Size of the temp buffer midcomms allocates on the stack.
|
||||||
We try to make this large enough so most messages fit.
|
We try to make this large enough so most messages fit.
|
||||||
FIXME: should sctp make this unnecessary? */
|
FIXME: should sctp make this unnecessary? */
|
||||||
|
@ -266,7 +253,7 @@ struct dlm_lkb {
|
||||||
struct dlm_rsb {
|
struct dlm_rsb {
|
||||||
struct dlm_ls *res_ls; /* the lockspace */
|
struct dlm_ls *res_ls; /* the lockspace */
|
||||||
struct kref res_ref;
|
struct kref res_ref;
|
||||||
struct semaphore res_sem;
|
struct mutex res_mutex;
|
||||||
unsigned long res_flags;
|
unsigned long res_flags;
|
||||||
int res_length; /* length of rsb name */
|
int res_length; /* length of rsb name */
|
||||||
int res_nodeid;
|
int res_nodeid;
|
||||||
|
@ -449,7 +436,7 @@ struct dlm_ls {
|
||||||
struct dlm_dirtable *ls_dirtbl;
|
struct dlm_dirtable *ls_dirtbl;
|
||||||
uint32_t ls_dirtbl_size;
|
uint32_t ls_dirtbl_size;
|
||||||
|
|
||||||
struct semaphore ls_waiters_sem;
|
struct mutex ls_waiters_mutex;
|
||||||
struct list_head ls_waiters; /* lkbs needing a reply */
|
struct list_head ls_waiters; /* lkbs needing a reply */
|
||||||
|
|
||||||
struct list_head ls_nodes; /* current nodes in ls */
|
struct list_head ls_nodes; /* current nodes in ls */
|
||||||
|
@ -472,14 +459,14 @@ struct dlm_ls {
|
||||||
|
|
||||||
struct timer_list ls_timer;
|
struct timer_list ls_timer;
|
||||||
struct task_struct *ls_recoverd_task;
|
struct task_struct *ls_recoverd_task;
|
||||||
struct semaphore ls_recoverd_active;
|
struct mutex ls_recoverd_active;
|
||||||
spinlock_t ls_recover_lock;
|
spinlock_t ls_recover_lock;
|
||||||
uint32_t ls_recover_status; /* DLM_RS_ */
|
uint32_t ls_recover_status; /* DLM_RS_ */
|
||||||
uint64_t ls_recover_seq;
|
uint64_t ls_recover_seq;
|
||||||
struct dlm_recover *ls_recover_args;
|
struct dlm_recover *ls_recover_args;
|
||||||
struct rw_semaphore ls_in_recovery; /* block local requests */
|
struct rw_semaphore ls_in_recovery; /* block local requests */
|
||||||
struct list_head ls_requestqueue;/* queue remote requests */
|
struct list_head ls_requestqueue;/* queue remote requests */
|
||||||
struct semaphore ls_requestqueue_lock;
|
struct mutex ls_requestqueue_mutex;
|
||||||
char *ls_recover_buf;
|
char *ls_recover_buf;
|
||||||
struct list_head ls_recover_list;
|
struct list_head ls_recover_list;
|
||||||
spinlock_t ls_recover_list_lock;
|
spinlock_t ls_recover_list_lock;
|
||||||
|
|
|
@ -215,15 +215,15 @@ static inline int is_master_copy(struct dlm_lkb *lkb)
|
||||||
{
|
{
|
||||||
if (lkb->lkb_flags & DLM_IFL_MSTCPY)
|
if (lkb->lkb_flags & DLM_IFL_MSTCPY)
|
||||||
DLM_ASSERT(lkb->lkb_nodeid, dlm_print_lkb(lkb););
|
DLM_ASSERT(lkb->lkb_nodeid, dlm_print_lkb(lkb););
|
||||||
return (lkb->lkb_flags & DLM_IFL_MSTCPY) ? TRUE : FALSE;
|
return (lkb->lkb_flags & DLM_IFL_MSTCPY) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int middle_conversion(struct dlm_lkb *lkb)
|
static inline int middle_conversion(struct dlm_lkb *lkb)
|
||||||
{
|
{
|
||||||
if ((lkb->lkb_grmode==DLM_LOCK_PR && lkb->lkb_rqmode==DLM_LOCK_CW) ||
|
if ((lkb->lkb_grmode==DLM_LOCK_PR && lkb->lkb_rqmode==DLM_LOCK_CW) ||
|
||||||
(lkb->lkb_rqmode==DLM_LOCK_PR && lkb->lkb_grmode==DLM_LOCK_CW))
|
(lkb->lkb_rqmode==DLM_LOCK_PR && lkb->lkb_grmode==DLM_LOCK_CW))
|
||||||
return TRUE;
|
return 1;
|
||||||
return FALSE;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int down_conversion(struct dlm_lkb *lkb)
|
static inline int down_conversion(struct dlm_lkb *lkb)
|
||||||
|
@ -269,7 +269,7 @@ static struct dlm_rsb *create_rsb(struct dlm_ls *ls, char *name, int len)
|
||||||
r->res_ls = ls;
|
r->res_ls = ls;
|
||||||
r->res_length = len;
|
r->res_length = len;
|
||||||
memcpy(r->res_name, name, len);
|
memcpy(r->res_name, name, len);
|
||||||
init_MUTEX(&r->res_sem);
|
mutex_init(&r->res_mutex);
|
||||||
|
|
||||||
INIT_LIST_HEAD(&r->res_lookup);
|
INIT_LIST_HEAD(&r->res_lookup);
|
||||||
INIT_LIST_HEAD(&r->res_grantqueue);
|
INIT_LIST_HEAD(&r->res_grantqueue);
|
||||||
|
@ -712,7 +712,7 @@ static void add_to_waiters(struct dlm_lkb *lkb, int mstype)
|
||||||
{
|
{
|
||||||
struct dlm_ls *ls = lkb->lkb_resource->res_ls;
|
struct dlm_ls *ls = lkb->lkb_resource->res_ls;
|
||||||
|
|
||||||
down(&ls->ls_waiters_sem);
|
mutex_lock(&ls->ls_waiters_mutex);
|
||||||
if (lkb->lkb_wait_type) {
|
if (lkb->lkb_wait_type) {
|
||||||
log_print("add_to_waiters error %d", lkb->lkb_wait_type);
|
log_print("add_to_waiters error %d", lkb->lkb_wait_type);
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -721,7 +721,7 @@ static void add_to_waiters(struct dlm_lkb *lkb, int mstype)
|
||||||
kref_get(&lkb->lkb_ref);
|
kref_get(&lkb->lkb_ref);
|
||||||
list_add(&lkb->lkb_wait_reply, &ls->ls_waiters);
|
list_add(&lkb->lkb_wait_reply, &ls->ls_waiters);
|
||||||
out:
|
out:
|
||||||
up(&ls->ls_waiters_sem);
|
mutex_unlock(&ls->ls_waiters_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _remove_from_waiters(struct dlm_lkb *lkb)
|
static int _remove_from_waiters(struct dlm_lkb *lkb)
|
||||||
|
@ -745,9 +745,9 @@ static int remove_from_waiters(struct dlm_lkb *lkb)
|
||||||
struct dlm_ls *ls = lkb->lkb_resource->res_ls;
|
struct dlm_ls *ls = lkb->lkb_resource->res_ls;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
down(&ls->ls_waiters_sem);
|
mutex_lock(&ls->ls_waiters_mutex);
|
||||||
error = _remove_from_waiters(lkb);
|
error = _remove_from_waiters(lkb);
|
||||||
up(&ls->ls_waiters_sem);
|
mutex_unlock(&ls->ls_waiters_mutex);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -775,14 +775,14 @@ static int shrink_bucket(struct dlm_ls *ls, int b)
|
||||||
int count = 0, found;
|
int count = 0, found;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
found = FALSE;
|
found = 0;
|
||||||
write_lock(&ls->ls_rsbtbl[b].lock);
|
write_lock(&ls->ls_rsbtbl[b].lock);
|
||||||
list_for_each_entry_reverse(r, &ls->ls_rsbtbl[b].toss,
|
list_for_each_entry_reverse(r, &ls->ls_rsbtbl[b].toss,
|
||||||
res_hashchain) {
|
res_hashchain) {
|
||||||
if (!time_after_eq(jiffies, r->res_toss_time +
|
if (!time_after_eq(jiffies, r->res_toss_time +
|
||||||
dlm_config.toss_secs * HZ))
|
dlm_config.toss_secs * HZ))
|
||||||
continue;
|
continue;
|
||||||
found = TRUE;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1027,9 +1027,9 @@ static inline int first_in_list(struct dlm_lkb *lkb, struct list_head *head)
|
||||||
struct dlm_lkb *first = list_entry(head->next, struct dlm_lkb,
|
struct dlm_lkb *first = list_entry(head->next, struct dlm_lkb,
|
||||||
lkb_statequeue);
|
lkb_statequeue);
|
||||||
if (lkb->lkb_id == first->lkb_id)
|
if (lkb->lkb_id == first->lkb_id)
|
||||||
return TRUE;
|
return 1;
|
||||||
|
|
||||||
return FALSE;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return 1 if the locks' ranges overlap. If the lkb has no range then it is
|
/* Return 1 if the locks' ranges overlap. If the lkb has no range then it is
|
||||||
|
@ -1038,13 +1038,13 @@ static inline int first_in_list(struct dlm_lkb *lkb, struct list_head *head)
|
||||||
static inline int ranges_overlap(struct dlm_lkb *lkb1, struct dlm_lkb *lkb2)
|
static inline int ranges_overlap(struct dlm_lkb *lkb1, struct dlm_lkb *lkb2)
|
||||||
{
|
{
|
||||||
if (!lkb1->lkb_range || !lkb2->lkb_range)
|
if (!lkb1->lkb_range || !lkb2->lkb_range)
|
||||||
return TRUE;
|
return 1;
|
||||||
|
|
||||||
if (lkb1->lkb_range[RQ_RANGE_END] < lkb2->lkb_range[GR_RANGE_START] ||
|
if (lkb1->lkb_range[RQ_RANGE_END] < lkb2->lkb_range[GR_RANGE_START] ||
|
||||||
lkb1->lkb_range[RQ_RANGE_START] > lkb2->lkb_range[GR_RANGE_END])
|
lkb1->lkb_range[RQ_RANGE_START] > lkb2->lkb_range[GR_RANGE_END])
|
||||||
return FALSE;
|
return 0;
|
||||||
|
|
||||||
return TRUE;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the given lkb conflicts with another lkb on the queue. */
|
/* Check if the given lkb conflicts with another lkb on the queue. */
|
||||||
|
@ -1057,9 +1057,9 @@ static int queue_conflict(struct list_head *head, struct dlm_lkb *lkb)
|
||||||
if (this == lkb)
|
if (this == lkb)
|
||||||
continue;
|
continue;
|
||||||
if (ranges_overlap(lkb, this) && !modes_compat(this, lkb))
|
if (ranges_overlap(lkb, this) && !modes_compat(this, lkb))
|
||||||
return TRUE;
|
return 1;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1103,7 +1103,7 @@ static int conversion_deadlock_detect(struct dlm_rsb *rsb, struct dlm_lkb *lkb)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!modes_compat(this, lkb) && !modes_compat(lkb, this))
|
if (!modes_compat(this, lkb) && !modes_compat(lkb, this))
|
||||||
return TRUE;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if lkb is on the convert queue and is preventing the first
|
/* if lkb is on the convert queue and is preventing the first
|
||||||
|
@ -1114,10 +1114,10 @@ static int conversion_deadlock_detect(struct dlm_rsb *rsb, struct dlm_lkb *lkb)
|
||||||
if (self && self != first) {
|
if (self && self != first) {
|
||||||
if (!modes_compat(lkb, first) &&
|
if (!modes_compat(lkb, first) &&
|
||||||
!queue_conflict(&rsb->res_grantqueue, first))
|
!queue_conflict(&rsb->res_grantqueue, first))
|
||||||
return TRUE;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1157,7 +1157,7 @@ static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (lkb->lkb_exflags & DLM_LKF_EXPEDITE)
|
if (lkb->lkb_exflags & DLM_LKF_EXPEDITE)
|
||||||
return TRUE;
|
return 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A shortcut. Without this, !queue_conflict(grantqueue, lkb) would be
|
* A shortcut. Without this, !queue_conflict(grantqueue, lkb) would be
|
||||||
|
@ -1200,7 +1200,7 @@ static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (now && conv && !(lkb->lkb_exflags & DLM_LKF_QUECVT))
|
if (now && conv && !(lkb->lkb_exflags & DLM_LKF_QUECVT))
|
||||||
return TRUE;
|
return 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When using range locks the NOORDER flag is set to avoid the standard
|
* When using range locks the NOORDER flag is set to avoid the standard
|
||||||
|
@ -1208,7 +1208,7 @@ static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (lkb->lkb_exflags & DLM_LKF_NOORDER)
|
if (lkb->lkb_exflags & DLM_LKF_NOORDER)
|
||||||
return TRUE;
|
return 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 6-3: Once in that queue [CONVERTING], a conversion request cannot be
|
* 6-3: Once in that queue [CONVERTING], a conversion request cannot be
|
||||||
|
@ -1217,7 +1217,7 @@ static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!now && conv && first_in_list(lkb, &r->res_convertqueue))
|
if (!now && conv && first_in_list(lkb, &r->res_convertqueue))
|
||||||
return TRUE;
|
return 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 6-4: By default, a new request is immediately granted only if all
|
* 6-4: By default, a new request is immediately granted only if all
|
||||||
|
@ -1232,7 +1232,7 @@ static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now)
|
||||||
|
|
||||||
if (now && !conv && list_empty(&r->res_convertqueue) &&
|
if (now && !conv && list_empty(&r->res_convertqueue) &&
|
||||||
list_empty(&r->res_waitqueue))
|
list_empty(&r->res_waitqueue))
|
||||||
return TRUE;
|
return 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 6-4: Once a lock request is in the queue of ungranted new requests,
|
* 6-4: Once a lock request is in the queue of ungranted new requests,
|
||||||
|
@ -1244,7 +1244,7 @@ static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now)
|
||||||
|
|
||||||
if (!now && !conv && list_empty(&r->res_convertqueue) &&
|
if (!now && !conv && list_empty(&r->res_convertqueue) &&
|
||||||
first_in_list(lkb, &r->res_waitqueue))
|
first_in_list(lkb, &r->res_waitqueue))
|
||||||
return TRUE;
|
return 1;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
/*
|
/*
|
||||||
|
@ -1257,7 +1257,7 @@ static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now)
|
||||||
lkb->lkb_sbflags |= DLM_SBF_DEMOTED;
|
lkb->lkb_sbflags |= DLM_SBF_DEMOTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1308,7 +1308,7 @@ static int grant_pending_convert(struct dlm_rsb *r, int high)
|
||||||
|
|
||||||
list_for_each_entry_safe(lkb, s, &r->res_convertqueue, lkb_statequeue) {
|
list_for_each_entry_safe(lkb, s, &r->res_convertqueue, lkb_statequeue) {
|
||||||
demoted = is_demoted(lkb);
|
demoted = is_demoted(lkb);
|
||||||
if (can_be_granted(r, lkb, FALSE)) {
|
if (can_be_granted(r, lkb, 0)) {
|
||||||
grant_lock_pending(r, lkb);
|
grant_lock_pending(r, lkb);
|
||||||
grant_restart = 1;
|
grant_restart = 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1333,7 +1333,7 @@ static int grant_pending_wait(struct dlm_rsb *r, int high)
|
||||||
struct dlm_lkb *lkb, *s;
|
struct dlm_lkb *lkb, *s;
|
||||||
|
|
||||||
list_for_each_entry_safe(lkb, s, &r->res_waitqueue, lkb_statequeue) {
|
list_for_each_entry_safe(lkb, s, &r->res_waitqueue, lkb_statequeue) {
|
||||||
if (can_be_granted(r, lkb, FALSE))
|
if (can_be_granted(r, lkb, 0))
|
||||||
grant_lock_pending(r, lkb);
|
grant_lock_pending(r, lkb);
|
||||||
else
|
else
|
||||||
high = max_t(int, lkb->lkb_rqmode, high);
|
high = max_t(int, lkb->lkb_rqmode, high);
|
||||||
|
@ -1705,7 +1705,7 @@ static int do_request(struct dlm_rsb *r, struct dlm_lkb *lkb)
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
if (can_be_granted(r, lkb, TRUE)) {
|
if (can_be_granted(r, lkb, 1)) {
|
||||||
grant_lock(r, lkb);
|
grant_lock(r, lkb);
|
||||||
queue_cast(r, lkb, 0);
|
queue_cast(r, lkb, 0);
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -1733,7 +1733,7 @@ static int do_convert(struct dlm_rsb *r, struct dlm_lkb *lkb)
|
||||||
|
|
||||||
/* changing an existing lock may allow others to be granted */
|
/* changing an existing lock may allow others to be granted */
|
||||||
|
|
||||||
if (can_be_granted(r, lkb, TRUE)) {
|
if (can_be_granted(r, lkb, 1)) {
|
||||||
grant_lock(r, lkb);
|
grant_lock(r, lkb);
|
||||||
queue_cast(r, lkb, 0);
|
queue_cast(r, lkb, 0);
|
||||||
grant_pending_locks(r);
|
grant_pending_locks(r);
|
||||||
|
@ -2556,7 +2556,7 @@ static void receive_convert(struct dlm_ls *ls, struct dlm_message *ms)
|
||||||
{
|
{
|
||||||
struct dlm_lkb *lkb;
|
struct dlm_lkb *lkb;
|
||||||
struct dlm_rsb *r;
|
struct dlm_rsb *r;
|
||||||
int error, reply = TRUE;
|
int error, reply = 1;
|
||||||
|
|
||||||
error = find_lkb(ls, ms->m_remid, &lkb);
|
error = find_lkb(ls, ms->m_remid, &lkb);
|
||||||
if (error)
|
if (error)
|
||||||
|
@ -3205,7 +3205,7 @@ void dlm_recover_waiters_pre(struct dlm_ls *ls)
|
||||||
{
|
{
|
||||||
struct dlm_lkb *lkb, *safe;
|
struct dlm_lkb *lkb, *safe;
|
||||||
|
|
||||||
down(&ls->ls_waiters_sem);
|
mutex_lock(&ls->ls_waiters_mutex);
|
||||||
|
|
||||||
list_for_each_entry_safe(lkb, safe, &ls->ls_waiters, lkb_wait_reply) {
|
list_for_each_entry_safe(lkb, safe, &ls->ls_waiters, lkb_wait_reply) {
|
||||||
log_debug(ls, "pre recover waiter lkid %x type %d flags %x",
|
log_debug(ls, "pre recover waiter lkid %x type %d flags %x",
|
||||||
|
@ -3253,7 +3253,7 @@ void dlm_recover_waiters_pre(struct dlm_ls *ls)
|
||||||
lkb->lkb_wait_type);
|
lkb->lkb_wait_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
up(&ls->ls_waiters_sem);
|
mutex_unlock(&ls->ls_waiters_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int remove_resend_waiter(struct dlm_ls *ls, struct dlm_lkb **lkb_ret)
|
static int remove_resend_waiter(struct dlm_ls *ls, struct dlm_lkb **lkb_ret)
|
||||||
|
@ -3261,7 +3261,7 @@ static int remove_resend_waiter(struct dlm_ls *ls, struct dlm_lkb **lkb_ret)
|
||||||
struct dlm_lkb *lkb;
|
struct dlm_lkb *lkb;
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
down(&ls->ls_waiters_sem);
|
mutex_lock(&ls->ls_waiters_mutex);
|
||||||
list_for_each_entry(lkb, &ls->ls_waiters, lkb_wait_reply) {
|
list_for_each_entry(lkb, &ls->ls_waiters, lkb_wait_reply) {
|
||||||
if (lkb->lkb_flags & DLM_IFL_RESEND) {
|
if (lkb->lkb_flags & DLM_IFL_RESEND) {
|
||||||
rv = lkb->lkb_wait_type;
|
rv = lkb->lkb_wait_type;
|
||||||
|
@ -3270,7 +3270,7 @@ static int remove_resend_waiter(struct dlm_ls *ls, struct dlm_lkb **lkb_ret)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
up(&ls->ls_waiters_sem);
|
mutex_unlock(&ls->ls_waiters_mutex);
|
||||||
|
|
||||||
if (!rv)
|
if (!rv)
|
||||||
lkb = NULL;
|
lkb = NULL;
|
||||||
|
|
|
@ -38,12 +38,12 @@ static inline int is_master(struct dlm_rsb *r)
|
||||||
|
|
||||||
static inline void lock_rsb(struct dlm_rsb *r)
|
static inline void lock_rsb(struct dlm_rsb *r)
|
||||||
{
|
{
|
||||||
down(&r->res_sem);
|
mutex_lock(&r->res_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void unlock_rsb(struct dlm_rsb *r)
|
static inline void unlock_rsb(struct dlm_rsb *r)
|
||||||
{
|
{
|
||||||
up(&r->res_sem);
|
mutex_unlock(&r->res_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,7 +31,7 @@ static inline void dlm_delete_debug_file(struct dlm_ls *ls) { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int ls_count;
|
static int ls_count;
|
||||||
static struct semaphore ls_lock;
|
static struct mutex ls_lock;
|
||||||
static struct list_head lslist;
|
static struct list_head lslist;
|
||||||
static spinlock_t lslist_lock;
|
static spinlock_t lslist_lock;
|
||||||
static struct task_struct * scand_task;
|
static struct task_struct * scand_task;
|
||||||
|
@ -177,7 +177,7 @@ int dlm_lockspace_init(void)
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
ls_count = 0;
|
ls_count = 0;
|
||||||
init_MUTEX(&ls_lock);
|
mutex_init(&ls_lock);
|
||||||
INIT_LIST_HEAD(&lslist);
|
INIT_LIST_HEAD(&lslist);
|
||||||
spin_lock_init(&lslist_lock);
|
spin_lock_init(&lslist_lock);
|
||||||
|
|
||||||
|
@ -351,10 +351,9 @@ static int new_lockspace(char *name, int namelen, void **lockspace,
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
ls = kmalloc(sizeof(struct dlm_ls) + namelen, GFP_KERNEL);
|
ls = kzalloc(sizeof(struct dlm_ls) + namelen, GFP_KERNEL);
|
||||||
if (!ls)
|
if (!ls)
|
||||||
goto out;
|
goto out;
|
||||||
memset(ls, 0, sizeof(struct dlm_ls) + namelen);
|
|
||||||
memcpy(ls->ls_name, name, namelen);
|
memcpy(ls->ls_name, name, namelen);
|
||||||
ls->ls_namelen = namelen;
|
ls->ls_namelen = namelen;
|
||||||
ls->ls_exflags = flags;
|
ls->ls_exflags = flags;
|
||||||
|
@ -398,7 +397,7 @@ static int new_lockspace(char *name, int namelen, void **lockspace,
|
||||||
}
|
}
|
||||||
|
|
||||||
INIT_LIST_HEAD(&ls->ls_waiters);
|
INIT_LIST_HEAD(&ls->ls_waiters);
|
||||||
init_MUTEX(&ls->ls_waiters_sem);
|
mutex_init(&ls->ls_waiters_mutex);
|
||||||
|
|
||||||
INIT_LIST_HEAD(&ls->ls_nodes);
|
INIT_LIST_HEAD(&ls->ls_nodes);
|
||||||
INIT_LIST_HEAD(&ls->ls_nodes_gone);
|
INIT_LIST_HEAD(&ls->ls_nodes_gone);
|
||||||
|
@ -416,14 +415,14 @@ static int new_lockspace(char *name, int namelen, void **lockspace,
|
||||||
ls->ls_uevent_result = 0;
|
ls->ls_uevent_result = 0;
|
||||||
|
|
||||||
ls->ls_recoverd_task = NULL;
|
ls->ls_recoverd_task = NULL;
|
||||||
init_MUTEX(&ls->ls_recoverd_active);
|
mutex_init(&ls->ls_recoverd_active);
|
||||||
spin_lock_init(&ls->ls_recover_lock);
|
spin_lock_init(&ls->ls_recover_lock);
|
||||||
ls->ls_recover_status = 0;
|
ls->ls_recover_status = 0;
|
||||||
ls->ls_recover_seq = 0;
|
ls->ls_recover_seq = 0;
|
||||||
ls->ls_recover_args = NULL;
|
ls->ls_recover_args = NULL;
|
||||||
init_rwsem(&ls->ls_in_recovery);
|
init_rwsem(&ls->ls_in_recovery);
|
||||||
INIT_LIST_HEAD(&ls->ls_requestqueue);
|
INIT_LIST_HEAD(&ls->ls_requestqueue);
|
||||||
init_MUTEX(&ls->ls_requestqueue_lock);
|
mutex_init(&ls->ls_requestqueue_mutex);
|
||||||
|
|
||||||
ls->ls_recover_buf = kmalloc(dlm_config.buffer_size, GFP_KERNEL);
|
ls->ls_recover_buf = kmalloc(dlm_config.buffer_size, GFP_KERNEL);
|
||||||
if (!ls->ls_recover_buf)
|
if (!ls->ls_recover_buf)
|
||||||
|
@ -493,7 +492,7 @@ int dlm_new_lockspace(char *name, int namelen, void **lockspace,
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
down(&ls_lock);
|
mutex_lock(&ls_lock);
|
||||||
if (!ls_count)
|
if (!ls_count)
|
||||||
error = threads_start();
|
error = threads_start();
|
||||||
if (error)
|
if (error)
|
||||||
|
@ -503,7 +502,7 @@ int dlm_new_lockspace(char *name, int namelen, void **lockspace,
|
||||||
if (!error)
|
if (!error)
|
||||||
ls_count++;
|
ls_count++;
|
||||||
out:
|
out:
|
||||||
up(&ls_lock);
|
mutex_unlock(&ls_lock);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -629,11 +628,11 @@ static int release_lockspace(struct dlm_ls *ls, int force)
|
||||||
kobject_unregister(&ls->ls_kobj);
|
kobject_unregister(&ls->ls_kobj);
|
||||||
kfree(ls);
|
kfree(ls);
|
||||||
|
|
||||||
down(&ls_lock);
|
mutex_lock(&ls_lock);
|
||||||
ls_count--;
|
ls_count--;
|
||||||
if (!ls_count)
|
if (!ls_count)
|
||||||
threads_stop();
|
threads_stop();
|
||||||
up(&ls_lock);
|
mutex_unlock(&ls_lock);
|
||||||
|
|
||||||
module_put(THIS_MODULE);
|
module_put(THIS_MODULE);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -52,7 +52,7 @@ static int dlm_add_member(struct dlm_ls *ls, int nodeid)
|
||||||
struct dlm_member *memb;
|
struct dlm_member *memb;
|
||||||
int w;
|
int w;
|
||||||
|
|
||||||
memb = kmalloc(sizeof(struct dlm_member), GFP_KERNEL);
|
memb = kzalloc(sizeof(struct dlm_member), GFP_KERNEL);
|
||||||
if (!memb)
|
if (!memb)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -79,9 +79,9 @@ static int dlm_is_member(struct dlm_ls *ls, int nodeid)
|
||||||
|
|
||||||
list_for_each_entry(memb, &ls->ls_nodes, list) {
|
list_for_each_entry(memb, &ls->ls_nodes, list) {
|
||||||
if (memb->nodeid == nodeid)
|
if (memb->nodeid == nodeid)
|
||||||
return TRUE;
|
return 1;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dlm_is_removed(struct dlm_ls *ls, int nodeid)
|
int dlm_is_removed(struct dlm_ls *ls, int nodeid)
|
||||||
|
@ -90,9 +90,9 @@ int dlm_is_removed(struct dlm_ls *ls, int nodeid)
|
||||||
|
|
||||||
list_for_each_entry(memb, &ls->ls_nodes_gone, list) {
|
list_for_each_entry(memb, &ls->ls_nodes_gone, list) {
|
||||||
if (memb->nodeid == nodeid)
|
if (memb->nodeid == nodeid)
|
||||||
return TRUE;
|
return 1;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clear_memb_list(struct list_head *head)
|
static void clear_memb_list(struct list_head *head)
|
||||||
|
@ -178,10 +178,10 @@ int dlm_recover_members(struct dlm_ls *ls, struct dlm_recover *rv, int *neg_out)
|
||||||
/* move departed members from ls_nodes to ls_nodes_gone */
|
/* move departed members from ls_nodes to ls_nodes_gone */
|
||||||
|
|
||||||
list_for_each_entry_safe(memb, safe, &ls->ls_nodes, list) {
|
list_for_each_entry_safe(memb, safe, &ls->ls_nodes, list) {
|
||||||
found = FALSE;
|
found = 0;
|
||||||
for (i = 0; i < rv->node_count; i++) {
|
for (i = 0; i < rv->node_count; i++) {
|
||||||
if (memb->nodeid == rv->nodeids[i]) {
|
if (memb->nodeid == rv->nodeids[i]) {
|
||||||
found = TRUE;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -271,10 +271,9 @@ int dlm_ls_start(struct dlm_ls *ls)
|
||||||
int *ids = NULL;
|
int *ids = NULL;
|
||||||
int error, count;
|
int error, count;
|
||||||
|
|
||||||
rv = kmalloc(sizeof(struct dlm_recover), GFP_KERNEL);
|
rv = kzalloc(sizeof(struct dlm_recover), GFP_KERNEL);
|
||||||
if (!rv)
|
if (!rv)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memset(rv, 0, sizeof(struct dlm_recover));
|
|
||||||
|
|
||||||
error = count = dlm_nodeid_list(ls->ls_name, &ids);
|
error = count = dlm_nodeid_list(ls->ls_name, &ids);
|
||||||
if (error <= 0)
|
if (error <= 0)
|
||||||
|
|
|
@ -119,7 +119,7 @@ int dlm_process_incoming_buffer(int nodeid, const void *base,
|
||||||
|
|
||||||
switch (msg->h_cmd) {
|
switch (msg->h_cmd) {
|
||||||
case DLM_MSG:
|
case DLM_MSG:
|
||||||
dlm_receive_message(msg, nodeid, FALSE);
|
dlm_receive_message(msg, nodeid, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DLM_RCOM:
|
case DLM_RCOM:
|
||||||
|
|
|
@ -420,7 +420,7 @@ int dlm_recover_master_reply(struct dlm_ls *ls, struct dlm_rcom *rc)
|
||||||
|
|
||||||
r = recover_list_find(ls, rc->rc_id);
|
r = recover_list_find(ls, rc->rc_id);
|
||||||
if (!r) {
|
if (!r) {
|
||||||
log_error(ls, "dlm_recover_master_reply no id %"PRIx64"",
|
log_error(ls, "dlm_recover_master_reply no id %llx",
|
||||||
rc->rc_id);
|
rc->rc_id);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -477,8 +477,8 @@ static int all_queues_empty(struct dlm_rsb *r)
|
||||||
if (!list_empty(&r->res_grantqueue) ||
|
if (!list_empty(&r->res_grantqueue) ||
|
||||||
!list_empty(&r->res_convertqueue) ||
|
!list_empty(&r->res_convertqueue) ||
|
||||||
!list_empty(&r->res_waitqueue))
|
!list_empty(&r->res_waitqueue))
|
||||||
return FALSE;
|
return 0;
|
||||||
return TRUE;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int recover_locks(struct dlm_rsb *r)
|
static int recover_locks(struct dlm_rsb *r)
|
||||||
|
@ -586,18 +586,18 @@ static void recover_lvb(struct dlm_rsb *r)
|
||||||
{
|
{
|
||||||
struct dlm_lkb *lkb, *high_lkb = NULL;
|
struct dlm_lkb *lkb, *high_lkb = NULL;
|
||||||
uint32_t high_seq = 0;
|
uint32_t high_seq = 0;
|
||||||
int lock_lvb_exists = FALSE;
|
int lock_lvb_exists = 0;
|
||||||
int big_lock_exists = FALSE;
|
int big_lock_exists = 0;
|
||||||
int lvblen = r->res_ls->ls_lvblen;
|
int lvblen = r->res_ls->ls_lvblen;
|
||||||
|
|
||||||
list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) {
|
list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) {
|
||||||
if (!(lkb->lkb_exflags & DLM_LKF_VALBLK))
|
if (!(lkb->lkb_exflags & DLM_LKF_VALBLK))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
lock_lvb_exists = TRUE;
|
lock_lvb_exists = 1;
|
||||||
|
|
||||||
if (lkb->lkb_grmode > DLM_LOCK_CR) {
|
if (lkb->lkb_grmode > DLM_LOCK_CR) {
|
||||||
big_lock_exists = TRUE;
|
big_lock_exists = 1;
|
||||||
goto setflag;
|
goto setflag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -611,10 +611,10 @@ static void recover_lvb(struct dlm_rsb *r)
|
||||||
if (!(lkb->lkb_exflags & DLM_LKF_VALBLK))
|
if (!(lkb->lkb_exflags & DLM_LKF_VALBLK))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
lock_lvb_exists = TRUE;
|
lock_lvb_exists = 1;
|
||||||
|
|
||||||
if (lkb->lkb_grmode > DLM_LOCK_CR) {
|
if (lkb->lkb_grmode > DLM_LOCK_CR) {
|
||||||
big_lock_exists = TRUE;
|
big_lock_exists = 1;
|
||||||
goto setflag;
|
goto setflag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,9 +45,9 @@ static int ls_recover(struct dlm_ls *ls, struct dlm_recover *rv)
|
||||||
unsigned long start;
|
unsigned long start;
|
||||||
int error, neg = 0;
|
int error, neg = 0;
|
||||||
|
|
||||||
log_debug(ls, "recover %"PRIx64"", rv->seq);
|
log_debug(ls, "recover %llx", rv->seq);
|
||||||
|
|
||||||
down(&ls->ls_recoverd_active);
|
mutex_lock(&ls->ls_recoverd_active);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Suspending and resuming dlm_astd ensures that no lkb's from this ls
|
* Suspending and resuming dlm_astd ensures that no lkb's from this ls
|
||||||
|
@ -199,16 +199,16 @@ static int ls_recover(struct dlm_ls *ls, struct dlm_recover *rv)
|
||||||
|
|
||||||
dlm_astd_wake();
|
dlm_astd_wake();
|
||||||
|
|
||||||
log_debug(ls, "recover %"PRIx64" done: %u ms", rv->seq,
|
log_debug(ls, "recover %llx done: %u ms", rv->seq,
|
||||||
jiffies_to_msecs(jiffies - start));
|
jiffies_to_msecs(jiffies - start));
|
||||||
up(&ls->ls_recoverd_active);
|
mutex_unlock(&ls->ls_recoverd_active);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
dlm_release_root_list(ls);
|
dlm_release_root_list(ls);
|
||||||
log_debug(ls, "recover %"PRIx64" error %d", rv->seq, error);
|
log_debug(ls, "recover %llx error %d", rv->seq, error);
|
||||||
up(&ls->ls_recoverd_active);
|
mutex_unlock(&ls->ls_recoverd_active);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,11 +275,11 @@ void dlm_recoverd_stop(struct dlm_ls *ls)
|
||||||
|
|
||||||
void dlm_recoverd_suspend(struct dlm_ls *ls)
|
void dlm_recoverd_suspend(struct dlm_ls *ls)
|
||||||
{
|
{
|
||||||
down(&ls->ls_recoverd_active);
|
mutex_lock(&ls->ls_recoverd_active);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlm_recoverd_resume(struct dlm_ls *ls)
|
void dlm_recoverd_resume(struct dlm_ls *ls)
|
||||||
{
|
{
|
||||||
up(&ls->ls_recoverd_active);
|
mutex_unlock(&ls->ls_recoverd_active);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,9 +47,9 @@ void dlm_add_requestqueue(struct dlm_ls *ls, int nodeid, struct dlm_header *hd)
|
||||||
e->nodeid = nodeid;
|
e->nodeid = nodeid;
|
||||||
memcpy(e->request, hd, length);
|
memcpy(e->request, hd, length);
|
||||||
|
|
||||||
down(&ls->ls_requestqueue_lock);
|
mutex_lock(&ls->ls_requestqueue_mutex);
|
||||||
list_add_tail(&e->list, &ls->ls_requestqueue);
|
list_add_tail(&e->list, &ls->ls_requestqueue);
|
||||||
up(&ls->ls_requestqueue_lock);
|
mutex_unlock(&ls->ls_requestqueue_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dlm_process_requestqueue(struct dlm_ls *ls)
|
int dlm_process_requestqueue(struct dlm_ls *ls)
|
||||||
|
@ -58,19 +58,19 @@ int dlm_process_requestqueue(struct dlm_ls *ls)
|
||||||
struct dlm_header *hd;
|
struct dlm_header *hd;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
down(&ls->ls_requestqueue_lock);
|
mutex_lock(&ls->ls_requestqueue_mutex);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (list_empty(&ls->ls_requestqueue)) {
|
if (list_empty(&ls->ls_requestqueue)) {
|
||||||
up(&ls->ls_requestqueue_lock);
|
mutex_unlock(&ls->ls_requestqueue_mutex);
|
||||||
error = 0;
|
error = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
e = list_entry(ls->ls_requestqueue.next, struct rq_entry, list);
|
e = list_entry(ls->ls_requestqueue.next, struct rq_entry, list);
|
||||||
up(&ls->ls_requestqueue_lock);
|
mutex_unlock(&ls->ls_requestqueue_mutex);
|
||||||
|
|
||||||
hd = (struct dlm_header *) e->request;
|
hd = (struct dlm_header *) e->request;
|
||||||
error = dlm_receive_message(hd, e->nodeid, TRUE);
|
error = dlm_receive_message(hd, e->nodeid, 1);
|
||||||
|
|
||||||
if (error == -EINTR) {
|
if (error == -EINTR) {
|
||||||
/* entry is left on requestqueue */
|
/* entry is left on requestqueue */
|
||||||
|
@ -78,13 +78,13 @@ int dlm_process_requestqueue(struct dlm_ls *ls)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
down(&ls->ls_requestqueue_lock);
|
mutex_lock(&ls->ls_requestqueue_mutex);
|
||||||
list_del(&e->list);
|
list_del(&e->list);
|
||||||
kfree(e);
|
kfree(e);
|
||||||
|
|
||||||
if (dlm_locking_stopped(ls)) {
|
if (dlm_locking_stopped(ls)) {
|
||||||
log_debug(ls, "process_requestqueue abort running");
|
log_debug(ls, "process_requestqueue abort running");
|
||||||
up(&ls->ls_requestqueue_lock);
|
mutex_unlock(&ls->ls_requestqueue_mutex);
|
||||||
error = -EINTR;
|
error = -EINTR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -105,15 +105,15 @@ int dlm_process_requestqueue(struct dlm_ls *ls)
|
||||||
void dlm_wait_requestqueue(struct dlm_ls *ls)
|
void dlm_wait_requestqueue(struct dlm_ls *ls)
|
||||||
{
|
{
|
||||||
for (;;) {
|
for (;;) {
|
||||||
down(&ls->ls_requestqueue_lock);
|
mutex_lock(&ls->ls_requestqueue_mutex);
|
||||||
if (list_empty(&ls->ls_requestqueue))
|
if (list_empty(&ls->ls_requestqueue))
|
||||||
break;
|
break;
|
||||||
if (dlm_locking_stopped(ls))
|
if (dlm_locking_stopped(ls))
|
||||||
break;
|
break;
|
||||||
up(&ls->ls_requestqueue_lock);
|
mutex_unlock(&ls->ls_requestqueue_mutex);
|
||||||
schedule();
|
schedule();
|
||||||
}
|
}
|
||||||
up(&ls->ls_requestqueue_lock);
|
mutex_unlock(&ls->ls_requestqueue_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int purge_request(struct dlm_ls *ls, struct dlm_message *ms, int nodeid)
|
static int purge_request(struct dlm_ls *ls, struct dlm_message *ms, int nodeid)
|
||||||
|
@ -170,7 +170,7 @@ void dlm_purge_requestqueue(struct dlm_ls *ls)
|
||||||
struct dlm_message *ms;
|
struct dlm_message *ms;
|
||||||
struct rq_entry *e, *safe;
|
struct rq_entry *e, *safe;
|
||||||
|
|
||||||
down(&ls->ls_requestqueue_lock);
|
mutex_lock(&ls->ls_requestqueue_mutex);
|
||||||
list_for_each_entry_safe(e, safe, &ls->ls_requestqueue, list) {
|
list_for_each_entry_safe(e, safe, &ls->ls_requestqueue, list) {
|
||||||
ms = (struct dlm_message *) e->request;
|
ms = (struct dlm_message *) e->request;
|
||||||
|
|
||||||
|
@ -179,6 +179,6 @@ void dlm_purge_requestqueue(struct dlm_ls *ls)
|
||||||
kfree(e);
|
kfree(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
up(&ls->ls_requestqueue_lock);
|
mutex_unlock(&ls->ls_requestqueue_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue