diff options
-rw-r--r-- | fs/gfs2/glock.c | 4 | ||||
-rw-r--r-- | fs/gfs2/glock.h | 2 | ||||
-rw-r--r-- | fs/gfs2/incore.h | 2 | ||||
-rw-r--r-- | fs/gfs2/lock_dlm.c | 11 | ||||
-rw-r--r-- | fs/gfs2/ops_fstype.c | 12 | ||||
-rw-r--r-- | fs/gfs2/super.c | 1 |
6 files changed, 27 insertions, 5 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index f455a03a09e2..f42663325931 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -769,6 +769,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, | |||
769 | if (!gl) | 769 | if (!gl) |
770 | return -ENOMEM; | 770 | return -ENOMEM; |
771 | 771 | ||
772 | atomic_inc(&sdp->sd_glock_disposal); | ||
772 | gl->gl_flags = 0; | 773 | gl->gl_flags = 0; |
773 | gl->gl_name = name; | 774 | gl->gl_name = name; |
774 | atomic_set(&gl->gl_ref, 1); | 775 | atomic_set(&gl->gl_ref, 1); |
@@ -1538,6 +1539,9 @@ void gfs2_gl_hash_clear(struct gfs2_sbd *sdp) | |||
1538 | up_write(&gfs2_umount_flush_sem); | 1539 | up_write(&gfs2_umount_flush_sem); |
1539 | msleep(10); | 1540 | msleep(10); |
1540 | } | 1541 | } |
1542 | flush_workqueue(glock_workqueue); | ||
1543 | wait_event(sdp->sd_glock_wait, atomic_read(&sdp->sd_glock_disposal) == 0); | ||
1544 | gfs2_dump_lockstate(sdp); | ||
1541 | } | 1545 | } |
1542 | 1546 | ||
1543 | void gfs2_glock_finish_truncate(struct gfs2_inode *ip) | 1547 | void gfs2_glock_finish_truncate(struct gfs2_inode *ip) |
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h index 13f0bd228132..c0262faf4725 100644 --- a/fs/gfs2/glock.h +++ b/fs/gfs2/glock.h | |||
@@ -123,7 +123,7 @@ struct lm_lockops { | |||
123 | int (*lm_mount) (struct gfs2_sbd *sdp, const char *fsname); | 123 | int (*lm_mount) (struct gfs2_sbd *sdp, const char *fsname); |
124 | void (*lm_unmount) (struct gfs2_sbd *sdp); | 124 | void (*lm_unmount) (struct gfs2_sbd *sdp); |
125 | void (*lm_withdraw) (struct gfs2_sbd *sdp); | 125 | void (*lm_withdraw) (struct gfs2_sbd *sdp); |
126 | void (*lm_put_lock) (struct kmem_cache *cachep, void *gl); | 126 | void (*lm_put_lock) (struct kmem_cache *cachep, struct gfs2_glock *gl); |
127 | unsigned int (*lm_lock) (struct gfs2_glock *gl, | 127 | unsigned int (*lm_lock) (struct gfs2_glock *gl, |
128 | unsigned int req_state, unsigned int flags); | 128 | unsigned int req_state, unsigned int flags); |
129 | void (*lm_cancel) (struct gfs2_glock *gl); | 129 | void (*lm_cancel) (struct gfs2_glock *gl); |
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 4792200978c8..bc0ad158e6b4 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -544,6 +544,8 @@ struct gfs2_sbd { | |||
544 | struct gfs2_holder sd_live_gh; | 544 | struct gfs2_holder sd_live_gh; |
545 | struct gfs2_glock *sd_rename_gl; | 545 | struct gfs2_glock *sd_rename_gl; |
546 | struct gfs2_glock *sd_trans_gl; | 546 | struct gfs2_glock *sd_trans_gl; |
547 | wait_queue_head_t sd_glock_wait; | ||
548 | atomic_t sd_glock_disposal; | ||
547 | 549 | ||
548 | /* Inode Stuff */ | 550 | /* Inode Stuff */ |
549 | 551 | ||
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c index 46df988323bc..0e5e0e7022e5 100644 --- a/fs/gfs2/lock_dlm.c +++ b/fs/gfs2/lock_dlm.c | |||
@@ -21,6 +21,7 @@ static void gdlm_ast(void *arg) | |||
21 | { | 21 | { |
22 | struct gfs2_glock *gl = arg; | 22 | struct gfs2_glock *gl = arg; |
23 | unsigned ret = gl->gl_state; | 23 | unsigned ret = gl->gl_state; |
24 | struct gfs2_sbd *sdp = gl->gl_sbd; | ||
24 | 25 | ||
25 | BUG_ON(gl->gl_lksb.sb_flags & DLM_SBF_DEMOTED); | 26 | BUG_ON(gl->gl_lksb.sb_flags & DLM_SBF_DEMOTED); |
26 | 27 | ||
@@ -30,6 +31,8 @@ static void gdlm_ast(void *arg) | |||
30 | switch (gl->gl_lksb.sb_status) { | 31 | switch (gl->gl_lksb.sb_status) { |
31 | case -DLM_EUNLOCK: /* Unlocked, so glock can be freed */ | 32 | case -DLM_EUNLOCK: /* Unlocked, so glock can be freed */ |
32 | kmem_cache_free(gfs2_glock_cachep, gl); | 33 | kmem_cache_free(gfs2_glock_cachep, gl); |
34 | if (atomic_dec_and_test(&sdp->sd_glock_disposal)) | ||
35 | wake_up(&sdp->sd_glock_wait); | ||
33 | return; | 36 | return; |
34 | case -DLM_ECANCEL: /* Cancel while getting lock */ | 37 | case -DLM_ECANCEL: /* Cancel while getting lock */ |
35 | ret |= LM_OUT_CANCELED; | 38 | ret |= LM_OUT_CANCELED; |
@@ -164,14 +167,16 @@ static unsigned int gdlm_lock(struct gfs2_glock *gl, | |||
164 | return LM_OUT_ASYNC; | 167 | return LM_OUT_ASYNC; |
165 | } | 168 | } |
166 | 169 | ||
167 | static void gdlm_put_lock(struct kmem_cache *cachep, void *ptr) | 170 | static void gdlm_put_lock(struct kmem_cache *cachep, struct gfs2_glock *gl) |
168 | { | 171 | { |
169 | struct gfs2_glock *gl = ptr; | 172 | struct gfs2_sbd *sdp = gl->gl_sbd; |
170 | struct lm_lockstruct *ls = &gl->gl_sbd->sd_lockstruct; | 173 | struct lm_lockstruct *ls = &sdp->sd_lockstruct; |
171 | int error; | 174 | int error; |
172 | 175 | ||
173 | if (gl->gl_lksb.sb_lkid == 0) { | 176 | if (gl->gl_lksb.sb_lkid == 0) { |
174 | kmem_cache_free(cachep, gl); | 177 | kmem_cache_free(cachep, gl); |
178 | if (atomic_dec_and_test(&sdp->sd_glock_disposal)) | ||
179 | wake_up(&sdp->sd_glock_wait); | ||
175 | return; | 180 | return; |
176 | } | 181 | } |
177 | 182 | ||
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index edfee24f3636..8a102f731003 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -82,6 +82,8 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb) | |||
82 | 82 | ||
83 | gfs2_tune_init(&sdp->sd_tune); | 83 | gfs2_tune_init(&sdp->sd_tune); |
84 | 84 | ||
85 | init_waitqueue_head(&sdp->sd_glock_wait); | ||
86 | atomic_set(&sdp->sd_glock_disposal, 0); | ||
85 | spin_lock_init(&sdp->sd_statfs_spin); | 87 | spin_lock_init(&sdp->sd_statfs_spin); |
86 | 88 | ||
87 | spin_lock_init(&sdp->sd_rindex_spin); | 89 | spin_lock_init(&sdp->sd_rindex_spin); |
@@ -983,9 +985,17 @@ static const match_table_t nolock_tokens = { | |||
983 | { Opt_err, NULL }, | 985 | { Opt_err, NULL }, |
984 | }; | 986 | }; |
985 | 987 | ||
988 | static void nolock_put_lock(struct kmem_cache *cachep, struct gfs2_glock *gl) | ||
989 | { | ||
990 | struct gfs2_sbd *sdp = gl->gl_sbd; | ||
991 | kmem_cache_free(cachep, gl); | ||
992 | if (atomic_dec_and_test(&sdp->sd_glock_disposal)) | ||
993 | wake_up(&sdp->sd_glock_wait); | ||
994 | } | ||
995 | |||
986 | static const struct lm_lockops nolock_ops = { | 996 | static const struct lm_lockops nolock_ops = { |
987 | .lm_proto_name = "lock_nolock", | 997 | .lm_proto_name = "lock_nolock", |
988 | .lm_put_lock = kmem_cache_free, | 998 | .lm_put_lock = nolock_put_lock, |
989 | .lm_tokens = &nolock_tokens, | 999 | .lm_tokens = &nolock_tokens, |
990 | }; | 1000 | }; |
991 | 1001 | ||
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index c282ad41f3d1..b9dd3da22c0a 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/gfs2_ondisk.h> | 21 | #include <linux/gfs2_ondisk.h> |
22 | #include <linux/crc32.h> | 22 | #include <linux/crc32.h> |
23 | #include <linux/time.h> | 23 | #include <linux/time.h> |
24 | #include <linux/wait.h> | ||
24 | 25 | ||
25 | #include "gfs2.h" | 26 | #include "gfs2.h" |
26 | #include "incore.h" | 27 | #include "incore.h" |