diff options
-rw-r--r-- | fs/gfs2/glock.c | 4 | ||||
-rw-r--r-- | fs/gfs2/glock.h | 2 | ||||
-rw-r--r-- | fs/gfs2/lock_dlm.c | 6 | ||||
-rw-r--r-- | fs/gfs2/ops_fstype.c | 10 | ||||
-rw-r--r-- | fs/gfs2/super.c | 2 |
5 files changed, 17 insertions, 7 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/lock_dlm.c b/fs/gfs2/lock_dlm.c index cdd0755d7823..0e5e0e7022e5 100644 --- a/fs/gfs2/lock_dlm.c +++ b/fs/gfs2/lock_dlm.c | |||
@@ -167,15 +167,16 @@ static unsigned int gdlm_lock(struct gfs2_glock *gl, | |||
167 | return LM_OUT_ASYNC; | 167 | return LM_OUT_ASYNC; |
168 | } | 168 | } |
169 | 169 | ||
170 | 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) |
171 | { | 171 | { |
172 | struct gfs2_glock *gl = ptr; | ||
173 | struct gfs2_sbd *sdp = gl->gl_sbd; | 172 | struct gfs2_sbd *sdp = gl->gl_sbd; |
174 | struct lm_lockstruct *ls = &sdp->sd_lockstruct; | 173 | struct lm_lockstruct *ls = &sdp->sd_lockstruct; |
175 | int error; | 174 | int error; |
176 | 175 | ||
177 | if (gl->gl_lksb.sb_lkid == 0) { | 176 | if (gl->gl_lksb.sb_lkid == 0) { |
178 | 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); | ||
179 | return; | 180 | return; |
180 | } | 181 | } |
181 | 182 | ||
@@ -187,7 +188,6 @@ static void gdlm_put_lock(struct kmem_cache *cachep, void *ptr) | |||
187 | (unsigned long long)gl->gl_name.ln_number, error); | 188 | (unsigned long long)gl->gl_name.ln_number, error); |
188 | return; | 189 | return; |
189 | } | 190 | } |
190 | atomic_inc(&sdp->sd_glock_disposal); | ||
191 | } | 191 | } |
192 | 192 | ||
193 | static void gdlm_cancel(struct gfs2_glock *gl) | 193 | static void gdlm_cancel(struct gfs2_glock *gl) |
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 9390fc7d8d40..8a102f731003 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -985,9 +985,17 @@ static const match_table_t nolock_tokens = { | |||
985 | { Opt_err, NULL }, | 985 | { Opt_err, NULL }, |
986 | }; | 986 | }; |
987 | 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 | |||
988 | static const struct lm_lockops nolock_ops = { | 996 | static const struct lm_lockops nolock_ops = { |
989 | .lm_proto_name = "lock_nolock", | 997 | .lm_proto_name = "lock_nolock", |
990 | .lm_put_lock = kmem_cache_free, | 998 | .lm_put_lock = nolock_put_lock, |
991 | .lm_tokens = &nolock_tokens, | 999 | .lm_tokens = &nolock_tokens, |
992 | }; | 1000 | }; |
993 | 1001 | ||
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 66242b32db5b..b9dd3da22c0a 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -861,8 +861,6 @@ restart: | |||
861 | gfs2_jindex_free(sdp); | 861 | gfs2_jindex_free(sdp); |
862 | /* Take apart glock structures and buffer lists */ | 862 | /* Take apart glock structures and buffer lists */ |
863 | gfs2_gl_hash_clear(sdp); | 863 | gfs2_gl_hash_clear(sdp); |
864 | /* Wait for dlm to reply to all our unlock requests */ | ||
865 | wait_event(sdp->sd_glock_wait, atomic_read(&sdp->sd_glock_disposal) == 0); | ||
866 | /* Unmount the locking protocol */ | 864 | /* Unmount the locking protocol */ |
867 | gfs2_lm_unmount(sdp); | 865 | gfs2_lm_unmount(sdp); |
868 | 866 | ||