diff options
Diffstat (limited to 'fs/dlm/lock.c')
-rw-r--r-- | fs/dlm/lock.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index 5bac9827ded3..6ad2b8eb96a5 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c | |||
@@ -3772,12 +3772,10 @@ int dlm_user_unlock(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, | |||
3772 | goto out_put; | 3772 | goto out_put; |
3773 | 3773 | ||
3774 | spin_lock(&ua->proc->locks_spin); | 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: | 3779 | out_put: |
3782 | dlm_put_lkb(lkb); | 3780 | dlm_put_lkb(lkb); |
3783 | out: | 3781 | out: |
@@ -3817,9 +3815,8 @@ int dlm_user_cancel(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, | |||
3817 | /* this lkb was removed from the WAITING queue */ | 3815 | /* this lkb was removed from the WAITING queue */ |
3818 | if (lkb->lkb_grmode == DLM_LOCK_IV) { | 3816 | if (lkb->lkb_grmode == DLM_LOCK_IV) { |
3819 | spin_lock(&ua->proc->locks_spin); | 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 | } | 3820 | } |
3824 | out_put: | 3821 | out_put: |
3825 | dlm_put_lkb(lkb); | 3822 | dlm_put_lkb(lkb); |
@@ -3880,11 +3877,6 @@ void dlm_clear_proc_locks(struct dlm_ls *ls, struct dlm_user_proc *proc) | |||
3880 | mutex_lock(&ls->ls_clear_proc_locks); | 3877 | mutex_lock(&ls->ls_clear_proc_locks); |
3881 | 3878 | ||
3882 | list_for_each_entry_safe(lkb, safe, &proc->locks, lkb_ownqueue) { | 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); | 3880 | list_del_init(&lkb->lkb_ownqueue); |
3889 | 3881 | ||
3890 | if (lkb->lkb_exflags & DLM_LKF_PERSISTENT) { | 3882 | if (lkb->lkb_exflags & DLM_LKF_PERSISTENT) { |
@@ -3901,6 +3893,20 @@ void dlm_clear_proc_locks(struct dlm_ls *ls, struct dlm_user_proc *proc) | |||
3901 | 3893 | ||
3902 | dlm_put_lkb(lkb); | 3894 | dlm_put_lkb(lkb); |
3903 | } | 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); | 3909 | mutex_unlock(&ls->ls_clear_proc_locks); |
3905 | unlock_recovery(ls); | 3910 | unlock_recovery(ls); |
3906 | } | 3911 | } |
3912 | |||