Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 38754
b: refs/heads/master
c: 34e22be
h: refs/heads/master
v: v3
  • Loading branch information
David Teigland authored and Steven Whitehouse committed Jul 20, 2006
1 parent 4d584e7 commit c5361c5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3b4a0a74949cf4f87f7ca84cc0457eb5687b2923
refs/heads/master: 34e22bed19013c77f942083e25cfc7adf6c71a8f
7 changes: 4 additions & 3 deletions trunk/fs/dlm/lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ static int create_lkb(struct dlm_ls *ls, struct dlm_lkb **lkb_ret)
lkb->lkb_nodeid = -1;
lkb->lkb_grmode = DLM_LOCK_IV;
kref_init(&lkb->lkb_ref);
INIT_LIST_HEAD(&lkb->lkb_ownqueue);

get_random_bytes(&bucket, sizeof(bucket));
bucket &= (ls->ls_lkbtbl_size - 1);
Expand Down Expand Up @@ -3705,7 +3706,7 @@ int dlm_user_unlock(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,
goto out_put;

spin_lock(&ua->proc->locks_spin);
list_del(&lkb->lkb_ownqueue);
list_del_init(&lkb->lkb_ownqueue);
spin_unlock(&ua->proc->locks_spin);

/* this removes the reference for the proc->locks list added by
Expand Down Expand Up @@ -3749,7 +3750,7 @@ int dlm_user_cancel(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,
/* this lkb was removed from the WAITING queue */
if (lkb->lkb_grmode == DLM_LOCK_IV) {
spin_lock(&ua->proc->locks_spin);
list_del(&lkb->lkb_ownqueue);
list_del_init(&lkb->lkb_ownqueue);
spin_unlock(&ua->proc->locks_spin);
unhold_lkb(lkb);
}
Expand Down Expand Up @@ -3817,7 +3818,7 @@ void dlm_clear_proc_locks(struct dlm_ls *ls, struct dlm_user_proc *proc)
unhold_lkb(lkb);
}

list_del(&lkb->lkb_ownqueue);
list_del_init(&lkb->lkb_ownqueue);

if (lkb->lkb_exflags & DLM_LKF_PERSISTENT) {
lkb->lkb_flags |= DLM_IFL_ORPHAN;
Expand Down
16 changes: 16 additions & 0 deletions trunk/fs/dlm/user.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ void dlm_user_add_ast(struct dlm_lkb *lkb, int type)
struct dlm_ls *ls;
struct dlm_user_args *ua;
struct dlm_user_proc *proc;
int remove_ownqueue = 0;

/* dlm_clear_proc_locks() sets ORPHAN/DEAD flag on each
lkb before dealing with it. We need to check this
Expand Down Expand Up @@ -171,6 +172,14 @@ void dlm_user_add_ast(struct dlm_lkb *lkb, int type)
wake_up_interruptible(&proc->wait);
}

/* noqueue requests that fail may need to be removed from the
proc's locks list, there should be a better way of detecting
this situation than checking all these things... */

if (type == AST_COMP && lkb->lkb_grmode == DLM_LOCK_IV &&
ua->lksb.sb_status == -EAGAIN && !list_empty(&lkb->lkb_ownqueue))
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()
Expand All @@ -185,6 +194,13 @@ void dlm_user_add_ast(struct dlm_lkb *lkb, int type)
ua->update_user_lvb = 0;

spin_unlock(&proc->asts_spin);

if (remove_ownqueue) {
spin_lock(&ua->proc->locks_spin);
list_del_init(&lkb->lkb_ownqueue);
spin_unlock(&ua->proc->locks_spin);
dlm_put_lkb(lkb);
}
out:
mutex_unlock(&ls->ls_clear_proc_locks);
}
Expand Down

0 comments on commit c5361c5

Please sign in to comment.