Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes

* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes:
GFS2: Extend umount wait coverage to full glock lifetime
GFS2: Wait for unlock completion on umount

+27 -5
+4
fs/gfs2/glock.c
··· 769 769 if (!gl) 770 770 return -ENOMEM; 771 771 772 + atomic_inc(&sdp->sd_glock_disposal); 772 773 gl->gl_flags = 0; 773 774 gl->gl_name = name; 774 775 atomic_set(&gl->gl_ref, 1); ··· 1539 1538 up_write(&gfs2_umount_flush_sem); 1540 1539 msleep(10); 1541 1540 } 1541 + flush_workqueue(glock_workqueue); 1542 + wait_event(sdp->sd_glock_wait, atomic_read(&sdp->sd_glock_disposal) == 0); 1543 + gfs2_dump_lockstate(sdp); 1542 1544 } 1543 1545 1544 1546 void gfs2_glock_finish_truncate(struct gfs2_inode *ip)
+1 -1
fs/gfs2/glock.h
··· 123 123 int (*lm_mount) (struct gfs2_sbd *sdp, const char *fsname); 124 124 void (*lm_unmount) (struct gfs2_sbd *sdp); 125 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 127 unsigned int (*lm_lock) (struct gfs2_glock *gl, 128 128 unsigned int req_state, unsigned int flags); 129 129 void (*lm_cancel) (struct gfs2_glock *gl);
+2
fs/gfs2/incore.h
··· 544 544 struct gfs2_holder sd_live_gh; 545 545 struct gfs2_glock *sd_rename_gl; 546 546 struct gfs2_glock *sd_trans_gl; 547 + wait_queue_head_t sd_glock_wait; 548 + atomic_t sd_glock_disposal; 547 549 548 550 /* Inode Stuff */ 549 551
+8 -3
fs/gfs2/lock_dlm.c
··· 21 21 { 22 22 struct gfs2_glock *gl = arg; 23 23 unsigned ret = gl->gl_state; 24 + struct gfs2_sbd *sdp = gl->gl_sbd; 24 25 25 26 BUG_ON(gl->gl_lksb.sb_flags & DLM_SBF_DEMOTED); 26 27 ··· 31 30 switch (gl->gl_lksb.sb_status) { 32 31 case -DLM_EUNLOCK: /* Unlocked, so glock can be freed */ 33 32 kmem_cache_free(gfs2_glock_cachep, gl); 33 + if (atomic_dec_and_test(&sdp->sd_glock_disposal)) 34 + wake_up(&sdp->sd_glock_wait); 34 35 return; 35 36 case -DLM_ECANCEL: /* Cancel while getting lock */ 36 37 ret |= LM_OUT_CANCELED; ··· 167 164 return LM_OUT_ASYNC; 168 165 } 169 166 170 - static void gdlm_put_lock(struct kmem_cache *cachep, void *ptr) 167 + static void gdlm_put_lock(struct kmem_cache *cachep, struct gfs2_glock *gl) 171 168 { 172 - struct gfs2_glock *gl = ptr; 173 - struct lm_lockstruct *ls = &gl->gl_sbd->sd_lockstruct; 169 + struct gfs2_sbd *sdp = gl->gl_sbd; 170 + struct lm_lockstruct *ls = &sdp->sd_lockstruct; 174 171 int error; 175 172 176 173 if (gl->gl_lksb.sb_lkid == 0) { 177 174 kmem_cache_free(cachep, gl); 175 + if (atomic_dec_and_test(&sdp->sd_glock_disposal)) 176 + wake_up(&sdp->sd_glock_wait); 178 177 return; 179 178 } 180 179
+11 -1
fs/gfs2/ops_fstype.c
··· 82 82 83 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 87 spin_lock_init(&sdp->sd_statfs_spin); 86 88 87 89 spin_lock_init(&sdp->sd_rindex_spin); ··· 985 983 { Opt_err, NULL }, 986 984 }; 987 985 986 + static void nolock_put_lock(struct kmem_cache *cachep, struct gfs2_glock *gl) 987 + { 988 + struct gfs2_sbd *sdp = gl->gl_sbd; 989 + kmem_cache_free(cachep, gl); 990 + if (atomic_dec_and_test(&sdp->sd_glock_disposal)) 991 + wake_up(&sdp->sd_glock_wait); 992 + } 993 + 988 994 static const struct lm_lockops nolock_ops = { 989 995 .lm_proto_name = "lock_nolock", 990 - .lm_put_lock = kmem_cache_free, 996 + .lm_put_lock = nolock_put_lock, 991 997 .lm_tokens = &nolock_tokens, 992 998 }; 993 999
+1
fs/gfs2/super.c
··· 21 21 #include <linux/gfs2_ondisk.h> 22 22 #include <linux/crc32.h> 23 23 #include <linux/time.h> 24 + #include <linux/wait.h> 24 25 25 26 #include "gfs2.h" 26 27 #include "incore.h"