Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 58544
b: refs/heads/master
c: 41d7db0
h: refs/heads/master
v: v3
  • Loading branch information
Steven Whitehouse committed Jul 9, 2007
1 parent 6ce8796 commit e637f7f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 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: cd81a4bac67d44742ab0aa1848f4a78e9d7e1093
refs/heads/master: 41d7db0ab437bc84f8a6e77cccc626ce937605ac
11 changes: 8 additions & 3 deletions trunk/fs/gfs2/locking/dlm/lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ static int gdlm_create_lp(struct gdlm_ls *ls, struct lm_lockname *name,
lp->cur = DLM_LOCK_IV;
lp->lvb = NULL;
lp->hold_null = NULL;
init_completion(&lp->ast_wait);
INIT_LIST_HEAD(&lp->clist);
INIT_LIST_HEAD(&lp->blist);
INIT_LIST_HEAD(&lp->delay_list);
Expand Down Expand Up @@ -399,6 +398,12 @@ static void gdlm_del_lvb(struct gdlm_lock *lp)
lp->lksb.sb_lvbptr = NULL;
}

static int gdlm_ast_wait(void *word)
{
schedule();
return 0;
}

/* This can do a synchronous dlm request (requiring a lock_dlm thread to get
the completion) because gfs won't call hold_lvb() during a callback (from
the context of a lock_dlm thread). */
Expand All @@ -424,10 +429,10 @@ static int hold_null_lock(struct gdlm_lock *lp)
lpn->lkf = DLM_LKF_VALBLK | DLM_LKF_EXPEDITE;
set_bit(LFL_NOBAST, &lpn->flags);
set_bit(LFL_INLOCK, &lpn->flags);
set_bit(LFL_AST_WAIT, &lpn->flags);

init_completion(&lpn->ast_wait);
gdlm_do_lock(lpn);
wait_for_completion(&lpn->ast_wait);
wait_on_bit(&lpn->flags, LFL_AST_WAIT, gdlm_ast_wait, TASK_UNINTERRUPTIBLE);
error = lpn->lksb.sb_status;
if (error) {
printk(KERN_INFO "lock_dlm: hold_null_lock dlm error %d\n",
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/gfs2/locking/dlm/lock_dlm.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ enum {
LFL_NOBAST = 10,
LFL_HEADQUE = 11,
LFL_UNLOCK_DELETE = 12,
LFL_AST_WAIT = 13,
};

struct gdlm_lock {
Expand All @@ -117,7 +118,6 @@ struct gdlm_lock {
unsigned long flags; /* lock_dlm flags LFL_ */

int bast_mode; /* protected by async_lock */
struct completion ast_wait;

struct list_head clist; /* complete */
struct list_head blist; /* blocking */
Expand Down
11 changes: 9 additions & 2 deletions trunk/fs/gfs2/locking/dlm/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ static void process_blocking(struct gdlm_lock *lp, int bast_mode)
ls->fscb(ls->sdp, cb, &lp->lockname);
}

static void wake_up_ast(struct gdlm_lock *lp)
{
clear_bit(LFL_AST_WAIT, &lp->flags);
smp_mb__after_clear_bit();
wake_up_bit(&lp->flags, LFL_AST_WAIT);
}

static void process_complete(struct gdlm_lock *lp)
{
struct gdlm_ls *ls = lp->ls;
Expand Down Expand Up @@ -136,7 +143,7 @@ static void process_complete(struct gdlm_lock *lp)
*/

if (test_and_clear_bit(LFL_SYNC_LVB, &lp->flags)) {
complete(&lp->ast_wait);
wake_up_ast(lp);
return;
}

Expand Down Expand Up @@ -214,7 +221,7 @@ static void process_complete(struct gdlm_lock *lp)
if (test_bit(LFL_INLOCK, &lp->flags)) {
clear_bit(LFL_NOBLOCK, &lp->flags);
lp->cur = lp->req;
complete(&lp->ast_wait);
wake_up_ast(lp);
return;
}

Expand Down

0 comments on commit e637f7f

Please sign in to comment.