Loading fs/dlm/ast.c +8 −8 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ static struct list_head ast_queue; static spinlock_t ast_queue_lock; static struct task_struct * astd_task; static unsigned long astd_wakeflags; static struct semaphore astd_running; static struct mutex astd_running; void dlm_del_ast(struct dlm_lkb *lkb) Loading Loading @@ -56,7 +56,7 @@ static void process_asts(void) int type = 0, found, bmode; for (;;) { found = FALSE; found = 0; spin_lock(&ast_queue_lock); list_for_each_entry(lkb, &ast_queue, lkb_astqueue) { r = lkb->lkb_resource; Loading @@ -68,7 +68,7 @@ static void process_asts(void) list_del(&lkb->lkb_astqueue); type = lkb->lkb_ast_type; lkb->lkb_ast_type = 0; found = TRUE; found = 1; break; } spin_unlock(&ast_queue_lock); Loading Loading @@ -117,10 +117,10 @@ static int dlm_astd(void *data) schedule(); set_current_state(TASK_RUNNING); down(&astd_running); mutex_lock(&astd_running); if (test_and_clear_bit(WAKE_ASTS, &astd_wakeflags)) process_asts(); up(&astd_running); mutex_unlock(&astd_running); } return 0; } Loading @@ -140,7 +140,7 @@ int dlm_astd_start(void) INIT_LIST_HEAD(&ast_queue); spin_lock_init(&ast_queue_lock); init_MUTEX(&astd_running); mutex_init(&astd_running); p = kthread_run(dlm_astd, NULL, "dlm_astd"); if (IS_ERR(p)) Loading @@ -157,11 +157,11 @@ void dlm_astd_stop(void) void dlm_astd_suspend(void) { down(&astd_running); mutex_lock(&astd_running); } void dlm_astd_resume(void) { up(&astd_running); mutex_unlock(&astd_running); } fs/dlm/config.c +10 −10 Original line number Diff line number Diff line Loading @@ -162,7 +162,7 @@ struct spaces { struct space { struct config_group group; struct list_head members; struct semaphore members_lock; struct mutex members_lock; int members_count; }; Loading Loading @@ -374,7 +374,7 @@ static struct config_group *make_space(struct config_group *g, const char *name) sp->group.default_groups[1] = NULL; INIT_LIST_HEAD(&sp->members); init_MUTEX(&sp->members_lock); mutex_init(&sp->members_lock); sp->members_count = 0; return &sp->group; Loading Loading @@ -453,10 +453,10 @@ static struct config_item *make_node(struct config_group *g, const char *name) nd->nodeid = -1; 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); sp->members_count++; up(&sp->members_lock); mutex_unlock(&sp->members_lock); return &nd->item; } Loading @@ -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 node *nd = to_node(i); down(&sp->members_lock); mutex_lock(&sp->members_lock); list_del(&nd->list); sp->members_count--; up(&sp->members_lock); mutex_unlock(&sp->members_lock); config_item_put(i); } Loading Loading @@ -677,7 +677,7 @@ int dlm_nodeid_list(char *lsname, int **ids_out) if (!sp) return -EEXIST; down(&sp->members_lock); mutex_lock(&sp->members_lock); if (!sp->members_count) { rv = 0; goto out; Loading @@ -698,7 +698,7 @@ int dlm_nodeid_list(char *lsname, int **ids_out) *ids_out = ids; out: up(&sp->members_lock); mutex_unlock(&sp->members_lock); put_space(sp); return rv; } Loading @@ -713,14 +713,14 @@ int dlm_node_weight(char *lsname, int nodeid) if (!sp) goto out; down(&sp->members_lock); mutex_lock(&sp->members_lock); list_for_each_entry(nd, &sp->members, list) { if (nd->nodeid != nodeid) continue; w = nd->weight; break; } up(&sp->members_lock); mutex_unlock(&sp->members_lock); put_space(sp); out: return w; Loading fs/dlm/debug_fs.c +2 −2 Original line number Diff line number Diff line Loading @@ -63,12 +63,12 @@ static void print_lock(struct seq_file *s, struct dlm_lkb *lkb, /* FIXME: this warns on Alpha */ if (lkb->lkb_status == DLM_LKSTS_CONVERT || 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_END]); if (lkb->lkb_status == DLM_LKSTS_CONVERT || 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_END]); } Loading fs/dlm/device.c +33 −22 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ static struct file_operations _dlm_fops; static const char *name_prefix="dlm"; 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 */ static DEFINE_IDR(lockinfo_idr); Loading @@ -53,6 +53,7 @@ static rwlock_t lockinfo_lock; #define LI_FLAG_COMPLETE 1 #define LI_FLAG_FIRSTLOCK 2 #define LI_FLAG_PERSISTENT 3 #define LI_FLAG_ONLIST 4 /* flags in ls_flags*/ #define LS_FLAG_DELETED 1 Loading Loading @@ -211,18 +212,18 @@ static struct user_ls *find_lockspace(int minor) { struct user_ls *lsinfo; down(&user_ls_lock); mutex_lock(&user_ls_lock); lsinfo = __find_lockspace(minor); up(&user_ls_lock); mutex_unlock(&user_ls_lock); return 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); up(&user_ls_lock); mutex_unlock(&user_ls_lock); } /* Register a lockspace with the DLM and create a misc Loading @@ -235,12 +236,11 @@ static int register_lockspace(char *name, struct user_ls **ls, int flags) 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) 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) { kfree(newls); return -ENOMEM; Loading Loading @@ -277,7 +277,7 @@ static int register_lockspace(char *name, struct user_ls **ls, int flags) 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) { int status; Loading Loading @@ -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, 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) return; memset(ast, 0, sizeof(*ast)); ast->result.user_astparam = astparam; ast->result.user_astaddr = astaddr; ast->result.user_lksb = li->li_user_lksb; Loading Loading @@ -382,6 +381,7 @@ static void ast_routine(void *param) spin_lock(&li->li_file->fi_li_lock); list_del(&li->li_ownerqueue); clear_bit(LI_FLAG_ONLIST, &li->li_flags); spin_unlock(&li->li_file->fi_li_lock); release_lockinfo(li); return; Loading Loading @@ -437,7 +437,7 @@ static int dlm_open(struct inode *inode, struct file *file) if (!lsinfo) return -ENOENT; f = kmalloc(sizeof(struct file_info), GFP_KERNEL); f = kzalloc(sizeof(struct file_info), GFP_KERNEL); if (!f) return -ENOMEM; Loading Loading @@ -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 whole thing. */ down(&user_ls_lock); mutex_lock(&user_ls_lock); if (atomic_dec_and_test(&lsinfo->ls_refcnt)) { if (lsinfo->ls_lockspace) { Loading @@ -582,7 +582,7 @@ static int dlm_close(struct inode *inode, struct file *file) kfree(lsinfo); } } up(&user_ls_lock); mutex_unlock(&user_ls_lock); put_file_info(f); /* Restore signals */ Loading Loading @@ -620,10 +620,10 @@ static int do_user_remove_lockspace(struct file_info *fi, uint8_t cmd, if (!capable(CAP_SYS_ADMIN)) return -EPERM; down(&user_ls_lock); mutex_lock(&user_ls_lock); lsinfo = __find_lockspace(kparams->minor); if (!lsinfo) { up(&user_ls_lock); mutex_unlock(&user_ls_lock); return -EINVAL; } Loading @@ -631,7 +631,7 @@ static int do_user_remove_lockspace(struct file_info *fi, uint8_t cmd, force = 2; status = unregister_lockspace(lsinfo, force); up(&user_ls_lock); mutex_unlock(&user_ls_lock); return status; } Loading Loading @@ -752,7 +752,7 @@ static struct lock_info *allocate_lockinfo(struct file_info *fi, uint8_t cmd, if (!try_module_get(THIS_MODULE)) return NULL; li = kmalloc(sizeof(struct lock_info), GFP_KERNEL); li = kzalloc(sizeof(struct lock_info), GFP_KERNEL); if (li) { li->li_magic = LOCKINFO_MAGIC; li->li_file = fi; Loading Loading @@ -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 lockinfo again */ if (!li && DLM_LKF_PERSISTENT) { if (!li && (kparams->flags & DLM_LKF_PERSISTENT)) { li = allocate_lockinfo(fi, cmd, kparams); if (!li) return -ENOMEM; li->li_lksb.sb_lkid = kparams->lkid; li->li_castaddr = kparams->castaddr; Loading Loading @@ -887,6 +889,7 @@ static int do_user_lock(struct file_info *fi, uint8_t cmd, spin_lock(&fi->fi_li_lock); list_add(&li->li_ownerqueue, &fi->fi_li_list); set_bit(LI_FLAG_ONLIST, &li->li_flags); spin_unlock(&fi->fi_li_lock); if (add_lockinfo(li)) printk(KERN_WARNING "Add lockinfo failed\n"); Loading Loading @@ -914,12 +917,13 @@ static int do_user_unlock(struct file_info *fi, uint8_t cmd, li = get_lockinfo(kparams->lkid); if (!li) { li = allocate_lockinfo(fi, cmd, kparams); if (!li) return -ENOMEM; spin_lock(&fi->fi_li_lock); list_add(&li->li_ownerqueue, &fi->fi_li_list); set_bit(LI_FLAG_ONLIST, &li->li_flags); spin_unlock(&fi->fi_li_lock); } if (!li) return -ENOMEM; if (li->li_magic != LOCKINFO_MAGIC) return -EINVAL; Loading @@ -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) 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 the existing li_castaddr as that's the completion routine for unlocks. dlm_unlock_wait() specifies a new AST routine to be Loading @@ -947,6 +957,7 @@ static int do_user_unlock(struct file_info *fi, uint8_t cmd, if (!status && !convert_cancel) { spin_lock(&fi->fi_li_lock); list_del(&li->li_ownerqueue); clear_bit(LI_FLAG_ONLIST, &li->li_flags); spin_unlock(&fi->fi_li_lock); } Loading Loading @@ -1055,7 +1066,7 @@ static int __init dlm_device_init(void) int r; INIT_LIST_HEAD(&user_ls_list); init_MUTEX(&user_ls_lock); mutex_init(&user_ls_lock); rwlock_init(&lockinfo_lock); ctl_device.name = "dlm-control"; Loading fs/dlm/dir.c +2 −2 Original line number Diff line number Diff line Loading @@ -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) { int found = FALSE; int found = 0; struct dlm_direntry *de; spin_lock(&ls->ls_recover_list_lock); Loading @@ -42,7 +42,7 @@ static struct dlm_direntry *get_free_de(struct dlm_ls *ls, int len) list_del(&de->list); de->master_nodeid = 0; memset(de->name, 0, len); found = TRUE; found = 1; break; } } Loading Loading
fs/dlm/ast.c +8 −8 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ static struct list_head ast_queue; static spinlock_t ast_queue_lock; static struct task_struct * astd_task; static unsigned long astd_wakeflags; static struct semaphore astd_running; static struct mutex astd_running; void dlm_del_ast(struct dlm_lkb *lkb) Loading Loading @@ -56,7 +56,7 @@ static void process_asts(void) int type = 0, found, bmode; for (;;) { found = FALSE; found = 0; spin_lock(&ast_queue_lock); list_for_each_entry(lkb, &ast_queue, lkb_astqueue) { r = lkb->lkb_resource; Loading @@ -68,7 +68,7 @@ static void process_asts(void) list_del(&lkb->lkb_astqueue); type = lkb->lkb_ast_type; lkb->lkb_ast_type = 0; found = TRUE; found = 1; break; } spin_unlock(&ast_queue_lock); Loading Loading @@ -117,10 +117,10 @@ static int dlm_astd(void *data) schedule(); set_current_state(TASK_RUNNING); down(&astd_running); mutex_lock(&astd_running); if (test_and_clear_bit(WAKE_ASTS, &astd_wakeflags)) process_asts(); up(&astd_running); mutex_unlock(&astd_running); } return 0; } Loading @@ -140,7 +140,7 @@ int dlm_astd_start(void) INIT_LIST_HEAD(&ast_queue); spin_lock_init(&ast_queue_lock); init_MUTEX(&astd_running); mutex_init(&astd_running); p = kthread_run(dlm_astd, NULL, "dlm_astd"); if (IS_ERR(p)) Loading @@ -157,11 +157,11 @@ void dlm_astd_stop(void) void dlm_astd_suspend(void) { down(&astd_running); mutex_lock(&astd_running); } void dlm_astd_resume(void) { up(&astd_running); mutex_unlock(&astd_running); }
fs/dlm/config.c +10 −10 Original line number Diff line number Diff line Loading @@ -162,7 +162,7 @@ struct spaces { struct space { struct config_group group; struct list_head members; struct semaphore members_lock; struct mutex members_lock; int members_count; }; Loading Loading @@ -374,7 +374,7 @@ static struct config_group *make_space(struct config_group *g, const char *name) sp->group.default_groups[1] = NULL; INIT_LIST_HEAD(&sp->members); init_MUTEX(&sp->members_lock); mutex_init(&sp->members_lock); sp->members_count = 0; return &sp->group; Loading Loading @@ -453,10 +453,10 @@ static struct config_item *make_node(struct config_group *g, const char *name) nd->nodeid = -1; 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); sp->members_count++; up(&sp->members_lock); mutex_unlock(&sp->members_lock); return &nd->item; } Loading @@ -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 node *nd = to_node(i); down(&sp->members_lock); mutex_lock(&sp->members_lock); list_del(&nd->list); sp->members_count--; up(&sp->members_lock); mutex_unlock(&sp->members_lock); config_item_put(i); } Loading Loading @@ -677,7 +677,7 @@ int dlm_nodeid_list(char *lsname, int **ids_out) if (!sp) return -EEXIST; down(&sp->members_lock); mutex_lock(&sp->members_lock); if (!sp->members_count) { rv = 0; goto out; Loading @@ -698,7 +698,7 @@ int dlm_nodeid_list(char *lsname, int **ids_out) *ids_out = ids; out: up(&sp->members_lock); mutex_unlock(&sp->members_lock); put_space(sp); return rv; } Loading @@ -713,14 +713,14 @@ int dlm_node_weight(char *lsname, int nodeid) if (!sp) goto out; down(&sp->members_lock); mutex_lock(&sp->members_lock); list_for_each_entry(nd, &sp->members, list) { if (nd->nodeid != nodeid) continue; w = nd->weight; break; } up(&sp->members_lock); mutex_unlock(&sp->members_lock); put_space(sp); out: return w; Loading
fs/dlm/debug_fs.c +2 −2 Original line number Diff line number Diff line Loading @@ -63,12 +63,12 @@ static void print_lock(struct seq_file *s, struct dlm_lkb *lkb, /* FIXME: this warns on Alpha */ if (lkb->lkb_status == DLM_LKSTS_CONVERT || 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_END]); if (lkb->lkb_status == DLM_LKSTS_CONVERT || 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_END]); } Loading
fs/dlm/device.c +33 −22 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ static struct file_operations _dlm_fops; static const char *name_prefix="dlm"; 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 */ static DEFINE_IDR(lockinfo_idr); Loading @@ -53,6 +53,7 @@ static rwlock_t lockinfo_lock; #define LI_FLAG_COMPLETE 1 #define LI_FLAG_FIRSTLOCK 2 #define LI_FLAG_PERSISTENT 3 #define LI_FLAG_ONLIST 4 /* flags in ls_flags*/ #define LS_FLAG_DELETED 1 Loading Loading @@ -211,18 +212,18 @@ static struct user_ls *find_lockspace(int minor) { struct user_ls *lsinfo; down(&user_ls_lock); mutex_lock(&user_ls_lock); lsinfo = __find_lockspace(minor); up(&user_ls_lock); mutex_unlock(&user_ls_lock); return 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); up(&user_ls_lock); mutex_unlock(&user_ls_lock); } /* Register a lockspace with the DLM and create a misc Loading @@ -235,12 +236,11 @@ static int register_lockspace(char *name, struct user_ls **ls, int flags) 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) 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) { kfree(newls); return -ENOMEM; Loading Loading @@ -277,7 +277,7 @@ static int register_lockspace(char *name, struct user_ls **ls, int flags) 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) { int status; Loading Loading @@ -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, 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) return; memset(ast, 0, sizeof(*ast)); ast->result.user_astparam = astparam; ast->result.user_astaddr = astaddr; ast->result.user_lksb = li->li_user_lksb; Loading Loading @@ -382,6 +381,7 @@ static void ast_routine(void *param) spin_lock(&li->li_file->fi_li_lock); list_del(&li->li_ownerqueue); clear_bit(LI_FLAG_ONLIST, &li->li_flags); spin_unlock(&li->li_file->fi_li_lock); release_lockinfo(li); return; Loading Loading @@ -437,7 +437,7 @@ static int dlm_open(struct inode *inode, struct file *file) if (!lsinfo) return -ENOENT; f = kmalloc(sizeof(struct file_info), GFP_KERNEL); f = kzalloc(sizeof(struct file_info), GFP_KERNEL); if (!f) return -ENOMEM; Loading Loading @@ -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 whole thing. */ down(&user_ls_lock); mutex_lock(&user_ls_lock); if (atomic_dec_and_test(&lsinfo->ls_refcnt)) { if (lsinfo->ls_lockspace) { Loading @@ -582,7 +582,7 @@ static int dlm_close(struct inode *inode, struct file *file) kfree(lsinfo); } } up(&user_ls_lock); mutex_unlock(&user_ls_lock); put_file_info(f); /* Restore signals */ Loading Loading @@ -620,10 +620,10 @@ static int do_user_remove_lockspace(struct file_info *fi, uint8_t cmd, if (!capable(CAP_SYS_ADMIN)) return -EPERM; down(&user_ls_lock); mutex_lock(&user_ls_lock); lsinfo = __find_lockspace(kparams->minor); if (!lsinfo) { up(&user_ls_lock); mutex_unlock(&user_ls_lock); return -EINVAL; } Loading @@ -631,7 +631,7 @@ static int do_user_remove_lockspace(struct file_info *fi, uint8_t cmd, force = 2; status = unregister_lockspace(lsinfo, force); up(&user_ls_lock); mutex_unlock(&user_ls_lock); return status; } Loading Loading @@ -752,7 +752,7 @@ static struct lock_info *allocate_lockinfo(struct file_info *fi, uint8_t cmd, if (!try_module_get(THIS_MODULE)) return NULL; li = kmalloc(sizeof(struct lock_info), GFP_KERNEL); li = kzalloc(sizeof(struct lock_info), GFP_KERNEL); if (li) { li->li_magic = LOCKINFO_MAGIC; li->li_file = fi; Loading Loading @@ -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 lockinfo again */ if (!li && DLM_LKF_PERSISTENT) { if (!li && (kparams->flags & DLM_LKF_PERSISTENT)) { li = allocate_lockinfo(fi, cmd, kparams); if (!li) return -ENOMEM; li->li_lksb.sb_lkid = kparams->lkid; li->li_castaddr = kparams->castaddr; Loading Loading @@ -887,6 +889,7 @@ static int do_user_lock(struct file_info *fi, uint8_t cmd, spin_lock(&fi->fi_li_lock); list_add(&li->li_ownerqueue, &fi->fi_li_list); set_bit(LI_FLAG_ONLIST, &li->li_flags); spin_unlock(&fi->fi_li_lock); if (add_lockinfo(li)) printk(KERN_WARNING "Add lockinfo failed\n"); Loading Loading @@ -914,12 +917,13 @@ static int do_user_unlock(struct file_info *fi, uint8_t cmd, li = get_lockinfo(kparams->lkid); if (!li) { li = allocate_lockinfo(fi, cmd, kparams); if (!li) return -ENOMEM; spin_lock(&fi->fi_li_lock); list_add(&li->li_ownerqueue, &fi->fi_li_list); set_bit(LI_FLAG_ONLIST, &li->li_flags); spin_unlock(&fi->fi_li_lock); } if (!li) return -ENOMEM; if (li->li_magic != LOCKINFO_MAGIC) return -EINVAL; Loading @@ -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) 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 the existing li_castaddr as that's the completion routine for unlocks. dlm_unlock_wait() specifies a new AST routine to be Loading @@ -947,6 +957,7 @@ static int do_user_unlock(struct file_info *fi, uint8_t cmd, if (!status && !convert_cancel) { spin_lock(&fi->fi_li_lock); list_del(&li->li_ownerqueue); clear_bit(LI_FLAG_ONLIST, &li->li_flags); spin_unlock(&fi->fi_li_lock); } Loading Loading @@ -1055,7 +1066,7 @@ static int __init dlm_device_init(void) int r; INIT_LIST_HEAD(&user_ls_list); init_MUTEX(&user_ls_lock); mutex_init(&user_ls_lock); rwlock_init(&lockinfo_lock); ctl_device.name = "dlm-control"; Loading
fs/dlm/dir.c +2 −2 Original line number Diff line number Diff line Loading @@ -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) { int found = FALSE; int found = 0; struct dlm_direntry *de; spin_lock(&ls->ls_recover_list_lock); Loading @@ -42,7 +42,7 @@ static struct dlm_direntry *get_free_de(struct dlm_ls *ls, int len) list_del(&de->list); de->master_nodeid = 0; memset(de->name, 0, len); found = TRUE; found = 1; break; } } Loading