diff options
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/glock.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index a7f3c462d4fe..80e09c50590a 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | 2 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
3 | * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. | 3 | * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. |
4 | * | 4 | * |
5 | * This copyrighted material is made available to anyone wishing to use, | 5 | * This copyrighted material is made available to anyone wishing to use, |
6 | * modify, copy, or redistribute it subject to the terms and conditions | 6 | * modify, copy, or redistribute it subject to the terms and conditions |
@@ -620,26 +620,21 @@ static void run_queue(struct gfs2_glock *gl) | |||
620 | 620 | ||
621 | static void gfs2_glmutex_lock(struct gfs2_glock *gl) | 621 | static void gfs2_glmutex_lock(struct gfs2_glock *gl) |
622 | { | 622 | { |
623 | struct gfs2_holder gh; | ||
624 | |||
625 | gfs2_holder_init(gl, 0, 0, &gh); | ||
626 | if (test_and_set_bit(HIF_WAIT, &gh.gh_iflags)) | ||
627 | BUG(); | ||
628 | |||
629 | spin_lock(&gl->gl_spin); | 623 | spin_lock(&gl->gl_spin); |
630 | if (test_and_set_bit(GLF_LOCK, &gl->gl_flags)) { | 624 | if (test_and_set_bit(GLF_LOCK, &gl->gl_flags)) { |
625 | struct gfs2_holder gh; | ||
626 | |||
627 | gfs2_holder_init(gl, 0, 0, &gh); | ||
628 | set_bit(HIF_WAIT, &gh.gh_iflags); | ||
631 | list_add_tail(&gh.gh_list, &gl->gl_waiters1); | 629 | list_add_tail(&gh.gh_list, &gl->gl_waiters1); |
630 | spin_unlock(&gl->gl_spin); | ||
631 | wait_on_holder(&gh); | ||
632 | gfs2_holder_uninit(&gh); | ||
632 | } else { | 633 | } else { |
633 | gl->gl_owner_pid = current->pid; | 634 | gl->gl_owner_pid = current->pid; |
634 | gl->gl_ip = (unsigned long)__builtin_return_address(0); | 635 | gl->gl_ip = (unsigned long)__builtin_return_address(0); |
635 | clear_bit(HIF_WAIT, &gh.gh_iflags); | 636 | spin_unlock(&gl->gl_spin); |
636 | smp_mb(); | ||
637 | wake_up_bit(&gh.gh_iflags, HIF_WAIT); | ||
638 | } | 637 | } |
639 | spin_unlock(&gl->gl_spin); | ||
640 | |||
641 | wait_on_holder(&gh); | ||
642 | gfs2_holder_uninit(&gh); | ||
643 | } | 638 | } |
644 | 639 | ||
645 | /** | 640 | /** |