lock.c (68c817a1c4e21b893672ac73d8a498e6647453aa) | lock.c (a1bc86e6bddd34362ca08a3a4d898eb4b5c15215) |
---|---|
1/****************************************************************************** 2******************************************************************************* 3** 4** Copyright (C) 2005 Red Hat, Inc. All rights reserved. 5** 6** This copyrighted material is made available to anyone wishing to use, 7** modify, copy, or redistribute it subject to the terms and conditions 8** of the GNU General Public License v.2. --- 3758 unchanged lines hidden (view full) --- 3767 error = unlock_lock(ls, lkb, &args); 3768 3769 if (error == -DLM_EUNLOCK) 3770 error = 0; 3771 if (error) 3772 goto out_put; 3773 3774 spin_lock(&ua->proc->locks_spin); | 1/****************************************************************************** 2******************************************************************************* 3** 4** Copyright (C) 2005 Red Hat, Inc. All rights reserved. 5** 6** This copyrighted material is made available to anyone wishing to use, 7** modify, copy, or redistribute it subject to the terms and conditions 8** of the GNU General Public License v.2. --- 3758 unchanged lines hidden (view full) --- 3767 error = unlock_lock(ls, lkb, &args); 3768 3769 if (error == -DLM_EUNLOCK) 3770 error = 0; 3771 if (error) 3772 goto out_put; 3773 3774 spin_lock(&ua->proc->locks_spin); |
3775 list_del_init(&lkb->lkb_ownqueue); | 3775 /* dlm_user_add_ast() may have already taken lkb off the proc list */ 3776 if (!list_empty(&lkb->lkb_ownqueue)) 3777 list_move(&lkb->lkb_ownqueue, &ua->proc->unlocking); |
3776 spin_unlock(&ua->proc->locks_spin); | 3778 spin_unlock(&ua->proc->locks_spin); |
3777 3778 /* this removes the reference for the proc->locks list added by 3779 dlm_user_request */ 3780 unhold_lkb(lkb); | |
3781 out_put: 3782 dlm_put_lkb(lkb); 3783 out: 3784 unlock_recovery(ls); 3785 return error; 3786} 3787 3788int dlm_user_cancel(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, --- 23 unchanged lines hidden (view full) --- 3812 if (error == -DLM_ECANCEL) 3813 error = 0; 3814 if (error) 3815 goto out_put; 3816 3817 /* this lkb was removed from the WAITING queue */ 3818 if (lkb->lkb_grmode == DLM_LOCK_IV) { 3819 spin_lock(&ua->proc->locks_spin); | 3779 out_put: 3780 dlm_put_lkb(lkb); 3781 out: 3782 unlock_recovery(ls); 3783 return error; 3784} 3785 3786int dlm_user_cancel(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, --- 23 unchanged lines hidden (view full) --- 3810 if (error == -DLM_ECANCEL) 3811 error = 0; 3812 if (error) 3813 goto out_put; 3814 3815 /* this lkb was removed from the WAITING queue */ 3816 if (lkb->lkb_grmode == DLM_LOCK_IV) { 3817 spin_lock(&ua->proc->locks_spin); |
3820 list_del_init(&lkb->lkb_ownqueue); | 3818 list_move(&lkb->lkb_ownqueue, &ua->proc->unlocking); |
3821 spin_unlock(&ua->proc->locks_spin); | 3819 spin_unlock(&ua->proc->locks_spin); |
3822 unhold_lkb(lkb); | |
3823 } 3824 out_put: 3825 dlm_put_lkb(lkb); 3826 out: 3827 unlock_recovery(ls); 3828 return error; 3829} 3830 --- 44 unchanged lines hidden (view full) --- 3875void dlm_clear_proc_locks(struct dlm_ls *ls, struct dlm_user_proc *proc) 3876{ 3877 struct dlm_lkb *lkb, *safe; 3878 3879 lock_recovery(ls); 3880 mutex_lock(&ls->ls_clear_proc_locks); 3881 3882 list_for_each_entry_safe(lkb, safe, &proc->locks, lkb_ownqueue) { | 3820 } 3821 out_put: 3822 dlm_put_lkb(lkb); 3823 out: 3824 unlock_recovery(ls); 3825 return error; 3826} 3827 --- 44 unchanged lines hidden (view full) --- 3872void dlm_clear_proc_locks(struct dlm_ls *ls, struct dlm_user_proc *proc) 3873{ 3874 struct dlm_lkb *lkb, *safe; 3875 3876 lock_recovery(ls); 3877 mutex_lock(&ls->ls_clear_proc_locks); 3878 3879 list_for_each_entry_safe(lkb, safe, &proc->locks, lkb_ownqueue) { |
3883 if (lkb->lkb_ast_type) { 3884 list_del(&lkb->lkb_astqueue); 3885 unhold_lkb(lkb); 3886 } 3887 | |
3888 list_del_init(&lkb->lkb_ownqueue); 3889 3890 if (lkb->lkb_exflags & DLM_LKF_PERSISTENT) { 3891 lkb->lkb_flags |= DLM_IFL_ORPHAN; 3892 orphan_proc_lock(ls, lkb); 3893 } else { 3894 lkb->lkb_flags |= DLM_IFL_DEAD; 3895 unlock_proc_lock(ls, lkb); 3896 } 3897 3898 /* this removes the reference for the proc->locks list 3899 added by dlm_user_request, it may result in the lkb 3900 being freed */ 3901 3902 dlm_put_lkb(lkb); 3903 } | 3880 list_del_init(&lkb->lkb_ownqueue); 3881 3882 if (lkb->lkb_exflags & DLM_LKF_PERSISTENT) { 3883 lkb->lkb_flags |= DLM_IFL_ORPHAN; 3884 orphan_proc_lock(ls, lkb); 3885 } else { 3886 lkb->lkb_flags |= DLM_IFL_DEAD; 3887 unlock_proc_lock(ls, lkb); 3888 } 3889 3890 /* this removes the reference for the proc->locks list 3891 added by dlm_user_request, it may result in the lkb 3892 being freed */ 3893 3894 dlm_put_lkb(lkb); 3895 } |
3896 3897 /* in-progress unlocks */ 3898 list_for_each_entry_safe(lkb, safe, &proc->unlocking, lkb_ownqueue) { 3899 list_del_init(&lkb->lkb_ownqueue); 3900 lkb->lkb_flags |= DLM_IFL_DEAD; 3901 dlm_put_lkb(lkb); 3902 } 3903 3904 list_for_each_entry_safe(lkb, safe, &proc->asts, lkb_astqueue) { 3905 list_del(&lkb->lkb_astqueue); 3906 dlm_put_lkb(lkb); 3907 } 3908 |
|
3904 mutex_unlock(&ls->ls_clear_proc_locks); 3905 unlock_recovery(ls); 3906} | 3909 mutex_unlock(&ls->ls_clear_proc_locks); 3910 unlock_recovery(ls); 3911} |
3912 |
|