aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/glock.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r--fs/gfs2/glock.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index ddc3e1e3faaf..3f45a14009b8 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -103,16 +103,21 @@ static inline void spin_unlock_bucket(unsigned int hash)
103 __bit_spin_unlock(0, (unsigned long *)bl); 103 __bit_spin_unlock(0, (unsigned long *)bl);
104} 104}
105 105
106void gfs2_glock_free(struct rcu_head *rcu) 106static void gfs2_glock_dealloc(struct rcu_head *rcu)
107{ 107{
108 struct gfs2_glock *gl = container_of(rcu, struct gfs2_glock, gl_rcu); 108 struct gfs2_glock *gl = container_of(rcu, struct gfs2_glock, gl_rcu);
109 struct gfs2_sbd *sdp = gl->gl_sbd;
110 109
111 if (gl->gl_ops->go_flags & GLOF_ASPACE) 110 if (gl->gl_ops->go_flags & GLOF_ASPACE)
112 kmem_cache_free(gfs2_glock_aspace_cachep, gl); 111 kmem_cache_free(gfs2_glock_aspace_cachep, gl);
113 else 112 else
114 kmem_cache_free(gfs2_glock_cachep, gl); 113 kmem_cache_free(gfs2_glock_cachep, gl);
114}
115
116void gfs2_glock_free(struct gfs2_glock *gl)
117{
118 struct gfs2_sbd *sdp = gl->gl_sbd;
115 119
120 call_rcu(&gl->gl_rcu, gfs2_glock_dealloc);
116 if (atomic_dec_and_test(&sdp->sd_glock_disposal)) 121 if (atomic_dec_and_test(&sdp->sd_glock_disposal))
117 wake_up(&sdp->sd_glock_wait); 122 wake_up(&sdp->sd_glock_wait);
118} 123}
@@ -760,6 +765,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
760 if (tmp) { 765 if (tmp) {
761 spin_unlock_bucket(hash); 766 spin_unlock_bucket(hash);
762 kmem_cache_free(cachep, gl); 767 kmem_cache_free(cachep, gl);
768 atomic_dec(&sdp->sd_glock_disposal);
763 gl = tmp; 769 gl = tmp;
764 } else { 770 } else {
765 hlist_bl_add_head_rcu(&gl->gl_list, &gl_hash_table[hash]); 771 hlist_bl_add_head_rcu(&gl->gl_list, &gl_hash_table[hash]);