Hi Ross,

----- Original Message -----
> Do you have any suggestions for tracking down the root cause?

One time, when I had a similar problem in rhel7, and couldn't use
kernel tracing because there were millions of glocks involved.
The trace was too huge and quickly swamped the biggest possible
kernel trace buffer. So I ended up writing this ugly, hacky patch
that's attached. Perhaps you can use it as a starting point.

The idea is: every time there's a get or a put to a glock, it
saves off a 1-byte identifier of what function did the get/put.
It saved it in a new 64-byte field kept for each glock, which of
course meant the slab became much bigger, but it was never meant
to be shipped, right?

Then, when the problem occurred, it would dump out the problematic
glock, including the 64-byte get/put history value.
Then I would go through it and identify the history of what went
wrong.

Since this is a fairly old (2015) patch that targets an old rhel7,
it will obviously need a lot of updating to get it to work, but
it might work better than the kernel tracing, depending on how
many glocks are involved in your test.

Regards,

Bob Peterson
Red Hat File Systems
From 01f7c8b9ef44280be90eabb44847d27db68dec32 Mon Sep 17 00:00:00 2001
From: Bob Peterson <rpete...@redhat.com>
Date: Fri, 4 Sep 2015 15:06:47 -0500
Subject: [PATCH] GFS2: Instrumentation to track down glock get/puts out of
 sync

---
 fs/gfs2/file.c       |   4 +-
 fs/gfs2/glock.c      | 198 ++++++++++++++++++++++++++++++++++++++++++---------
 fs/gfs2/glock.h      |   6 +-
 fs/gfs2/glops.c      |   3 +
 fs/gfs2/incore.h     |   5 ++
 fs/gfs2/inode.c      |  16 ++---
 fs/gfs2/ops_fstype.c |  16 ++---
 fs/gfs2/quota.c      |   8 +--
 fs/gfs2/recovery.c   |   2 +-
 fs/gfs2/rgrp.c       |  10 +--
 fs/gfs2/super.c      |   6 +-
 fs/gfs2/sys.c        |   4 +-
 12 files changed, 207 insertions(+), 71 deletions(-)

diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index af0d418da809..11c02ff155ed 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -1086,11 +1086,11 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
 		gfs2_holder_reinit(state, flags, fl_gh);
 	} else {
 		error = gfs2_glock_get(GFS2_SB(&ip->i_inode), ip->i_no_addr,
-				       &gfs2_flock_glops, CREATE, &gl);
+				       &gfs2_flock_glops, CREATE, &gl, 10);
 		if (error)
 			goto out;
 		gfs2_holder_init(gl, state, flags, fl_gh);
-		gfs2_glock_put(gl);
+		gfs2_glock_put(gl, 67);
 	}
 	for (sleeptime = 1; sleeptime <= 4; sleeptime <<= 1) {
 		error = gfs2_glock_nq(fl_gh);
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 1c186f9ec4d1..303fed6af984 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -98,10 +98,13 @@ void gfs2_glock_free(struct gfs2_glock *gl)
  *
  */
 
-static void gfs2_glock_hold(struct gfs2_glock *gl)
+static void gfs2_glock_hold(struct gfs2_glock *gl, int caller)
 {
 	GLOCK_BUG_ON(gl, __lockref_is_dead(&gl->gl_lockref));
 	lockref_get(&gl->gl_lockref);
+	gl->gl_getputhist[gl->gl_getputs++] = caller;
+	if (gl->gl_getputs > GETPUTHIST)
+		gl->gl_getputs = 0;
 }
 
 /**
@@ -161,11 +164,18 @@ static void gfs2_glock_remove_from_lru(struct gfs2_glock *gl)
  *
  */
 
-void gfs2_glock_put(struct gfs2_glock *gl)
+void gfs2_glock_put(struct gfs2_glock *gl, int caller)
 {
 	struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
 	struct address_space *mapping = gfs2_glock2aspace(gl);
 
+	if (caller == 60 && gl->gl_getputs &&
+	    gl->gl_getputhist[gl->gl_getputs - 1] == 4)
+		gl->gl_getputs--;
+	else
+		gl->gl_getputhist[gl->gl_getputs++] = caller;
+	if (gl->gl_getputs > GETPUTHIST)
+		gl->gl_getputs = 0;
 	if (lockref_put_or_lock(&gl->gl_lockref))
 		return;
 
@@ -328,10 +338,17 @@ static void state_change(struct gfs2_glock *gl, unsigned int new_state)
 
 	if (held1 != held2) {
 		GLOCK_BUG_ON(gl, __lockref_is_dead(&gl->gl_lockref));
-		if (held2)
+		if (held2) {
 			gl->gl_lockref.count++;
-		else
+			gl->gl_getputhist[gl->gl_getputs++] = 1;
+			if (gl->gl_getputs > GETPUTHIST)
+				gl->gl_getputs = 0;
+		} else {
 			gl->gl_lockref.count--;
+			gl->gl_getputhist[gl->gl_getputs++] = 51;
+			if (gl->gl_getputs > GETPUTHIST)
+				gl->gl_getputs = 0;
+		}
 	}
 	if (held1 && held2 && list_empty(&gl->gl_holders))
 		clear_bit(GLF_QUEUED, &gl->gl_flags);
@@ -476,7 +493,7 @@ __acquires(&gl->gl_spin)
 		glops->go_inval(gl, target == LM_ST_DEFERRED ? 0 : DIO_METADATA);
 	clear_bit(GLF_INVALIDATE_IN_PROGRESS, &gl->gl_flags);
 
-	gfs2_glock_hold(gl);
+	gfs2_glock_hold(gl, 2);
 	if (sdp->sd_lockstruct.ls_ops->lm_lock)	{
 		/* lock_dlm */
 		ret = sdp->sd_lockstruct.ls_ops->lm_lock(gl, target, lck_flags);
@@ -485,7 +502,7 @@ __acquires(&gl->gl_spin)
 		    test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags)) {
 			finish_xmote(gl, target);
 			if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
-				gfs2_glock_put(gl);
+				gfs2_glock_put(gl, 54);
 		}
 		else if (ret) {
 			printk(KERN_ERR "GFS2: lm_lock ret %d\n", ret);
@@ -494,7 +511,9 @@ __acquires(&gl->gl_spin)
 	} else { /* lock_nolock */
 		finish_xmote(gl, target);
 		if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
-			gfs2_glock_put(gl);
+			gfs2_glock_put(gl, 55);
+		else
+			gl->gl_whoq = 1;
 	}
 
 	spin_lock(&gl->gl_spin);
@@ -566,8 +585,13 @@ out_sched:
 	clear_bit(GLF_LOCK, &gl->gl_flags);
 	smp_mb__after_clear_bit();
 	gl->gl_lockref.count++;
+	gl->gl_getputhist[gl->gl_getputs++] = 3;
+	if (gl->gl_getputs > GETPUTHIST)
+		gl->gl_getputs = 0;
 	if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
 		gl->gl_lockref.count--;
+	else
+		gl->gl_whoq = 2;
 	return;
 
 out_unlock:
@@ -595,7 +619,7 @@ static void delete_work_func(struct work_struct *work)
 		iput(inode);
 	}
 out:
-	gfs2_glock_put(gl);
+	gfs2_glock_put(gl, 56);
 }
 
 static void glock_work_func(struct work_struct *work)
@@ -626,15 +650,17 @@ static void glock_work_func(struct work_struct *work)
 	run_queue(gl, 0);
 	spin_unlock(&gl->gl_spin);
 	if (!delay)
-		gfs2_glock_put(gl);
+		gfs2_glock_put(gl, 57);
 	else {
 		if (gl->gl_name.ln_type != LM_TYPE_INODE)
 			delay = 0;
 		if (queue_delayed_work(glock_workqueue, &gl->gl_work, delay) == 0)
-			gfs2_glock_put(gl);
+			gfs2_glock_put(gl, 58);
+		else
+			gl->gl_whoq = 3;
 	}
 	if (drop_ref)
-		gfs2_glock_put(gl);
+		gfs2_glock_put(gl, 59);
 }
 
 /**
@@ -652,7 +678,7 @@ static void glock_work_func(struct work_struct *work)
 
 int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
 		   const struct gfs2_glock_operations *glops, int create,
-		   struct gfs2_glock **glp)
+		   struct gfs2_glock **glp, int caller)
 {
 	struct super_block *s = sdp->sd_vfs;
 	struct lm_lockname name = { .ln_number = number,
@@ -693,6 +719,9 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
 
 	atomic_inc(&sdp->sd_glock_disposal);
 	gl->gl_node.next = NULL;
+	memset(gl->gl_getputhist, 0, sizeof(gl->gl_getputhist));
+	gl->gl_getputhist[0] = caller;
+	gl->gl_getputs = 1;
 	gl->gl_flags = 0;
 	gl->gl_name = name;
 	gl->gl_lockref.count = 1;
@@ -711,6 +740,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
 	gl->gl_object = NULL;
 	gl->gl_hold_time = GL_GLOCK_DFT_HOLD;
 	INIT_DELAYED_WORK(&gl->gl_work, glock_work_func);
+	gl->gl_whoq = 777;
 	INIT_WORK(&gl->gl_delete, delete_work_func);
 
 	mapping = gfs2_glock2aspace(gl);
@@ -774,7 +804,7 @@ void gfs2_holder_init(struct gfs2_glock *gl, unsigned int state, u16 flags,
 	gh->gh_flags = flags;
 	gh->gh_error = 0;
 	gh->gh_iflags = 0;
-	gfs2_glock_hold(gl);
+	gfs2_glock_hold(gl, 4);
 }
 
 /**
@@ -807,7 +837,7 @@ void gfs2_holder_reinit(unsigned int state, u16 flags, struct gfs2_holder *gh)
 void gfs2_holder_uninit(struct gfs2_holder *gh)
 {
 	put_pid(gh->gh_owner_pid);
-	gfs2_glock_put(gh->gh_gl);
+	gfs2_glock_put(gh->gh_gl, 60);
 	gfs2_holder_mark_uninitialized(gh);
 	gh->gh_ip = 0;
 }
@@ -989,6 +1019,8 @@ int gfs2_glock_nq(struct gfs2_holder *gh)
 		gl->gl_lockref.count++;
 		if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
 			gl->gl_lockref.count--;
+		else
+			gl->gl_whoq = 4;
 	}
 	run_queue(gl, 1);
 	spin_unlock(&gl->gl_spin);
@@ -1052,13 +1084,15 @@ void gfs2_glock_dq(struct gfs2_holder *gh)
 	if (likely(fast_path))
 		return;
 
-	gfs2_glock_hold(gl);
+	gfs2_glock_hold(gl, 5);
 	if (test_bit(GLF_PENDING_DEMOTE, &gl->gl_flags) &&
 	    !test_bit(GLF_DEMOTE, &gl->gl_flags) &&
 	    gl->gl_name.ln_type == LM_TYPE_INODE)
 		delay = gl->gl_hold_time;
 	if (queue_delayed_work(glock_workqueue, &gl->gl_work, delay) == 0)
-		gfs2_glock_put(gl);
+		gfs2_glock_put(gl, 61);
+	else
+		gl->gl_whoq = 5;
 }
 
 void gfs2_glock_dq_wait(struct gfs2_holder *gh)
@@ -1095,15 +1129,16 @@ void gfs2_glock_dq_uninit(struct gfs2_holder *gh)
 
 int gfs2_glock_nq_num(struct gfs2_sbd *sdp, u64 number,
 		      const struct gfs2_glock_operations *glops,
-		      unsigned int state, u16 flags, struct gfs2_holder *gh)
+		      unsigned int state, int flags, struct gfs2_holder *gh,
+		      int caller)
 {
 	struct gfs2_glock *gl;
 	int error;
 
-	error = gfs2_glock_get(sdp, number, glops, CREATE, &gl);
+	error = gfs2_glock_get(sdp, number, glops, CREATE, &gl, caller);
 	if (!error) {
 		error = gfs2_glock_nq_init(gl, state, flags, gh);
-		gfs2_glock_put(gl);
+		gfs2_glock_put(gl, 62);
 	}
 
 	return error;
@@ -1222,7 +1257,7 @@ void gfs2_glock_cb(struct gfs2_glock *gl, unsigned int state)
 	unsigned long holdtime;
 	unsigned long now = jiffies;
 
-	gfs2_glock_hold(gl);
+	gfs2_glock_hold(gl, 6);
 	holdtime = gl->gl_tchange + gl->gl_hold_time;
 	if (test_bit(GLF_QUEUED, &gl->gl_flags) &&
 	    gl->gl_name.ln_type == LM_TYPE_INODE) {
@@ -1236,7 +1271,9 @@ void gfs2_glock_cb(struct gfs2_glock *gl, unsigned int state)
 	handle_callback(gl, state, delay, true);
 	spin_unlock(&gl->gl_spin);
 	if (queue_delayed_work(glock_workqueue, &gl->gl_work, delay) == 0)
-		gfs2_glock_put(gl);
+		gfs2_glock_put(gl, 63);
+	else
+		gl->gl_whoq = 6;
 }
 
 /**
@@ -1294,11 +1331,16 @@ void gfs2_glock_complete(struct gfs2_glock *gl, int ret)
 	}
 
 	gl->gl_lockref.count++;
+	gl->gl_getputhist[gl->gl_getputs++] = 64;
+	if (gl->gl_getputs > GETPUTHIST)
+		gl->gl_getputs = 0;
 	set_bit(GLF_REPLY_PENDING, &gl->gl_flags);
 	spin_unlock(&gl->gl_spin);
 
 	if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
-		gfs2_glock_put(gl);
+		gfs2_glock_put(gl, 64);
+	else
+		gl->gl_whoq = 7;
 }
 
 static int glock_cmp(void *priv, struct list_head *a, struct list_head *b)
@@ -1359,6 +1401,8 @@ add_back_to_lru:
 		smp_mb__after_clear_bit();
 		if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
 			gl->gl_lockref.count--;
+		else
+			gl->gl_whoq = 8;
 		spin_unlock(&gl->gl_spin);
 		cond_resched_lock(&lru_lock);
 	}
@@ -1457,8 +1501,9 @@ static void thaw_glock(struct gfs2_glock *gl)
 	set_bit(GLF_REPLY_PENDING, &gl->gl_flags);
 	if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0) {
 out:
-		gfs2_glock_put(gl);
-	}
+		gfs2_glock_put(gl, 65);
+	} else
+		gl->gl_whoq = 9;
 }
 
 /**
@@ -1476,7 +1521,9 @@ static void clear_glock(struct gfs2_glock *gl)
 		handle_callback(gl, LM_ST_UNLOCKED, 0, false);
 	spin_unlock(&gl->gl_spin);
 	if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
-		gfs2_glock_put(gl);
+		gfs2_glock_put(gl, 66);
+	else
+		gl->gl_whoq = 10;
 }
 
 /**
@@ -1674,16 +1721,97 @@ int gfs2_dump_glock(struct seq_file *seq, const struct gfs2_glock *gl)
 	dtime *= 1000000/HZ; /* demote time in uSec */
 	if (!test_bit(GLF_DEMOTE, &gl->gl_flags))
 		dtime = 0;
-	gfs2_print_dbg(seq, "G:  s:%s n:%u/%llx f:%s t:%s d:%s/%llu a:%d v:%d r:%d m:%ld\n",
-		  state2str(gl->gl_state),
-		  gl->gl_name.ln_type,
-		  (unsigned long long)gl->gl_name.ln_number,
-		  gflags2str(gflags_buf, gl),
-		  state2str(gl->gl_target),
-		  state2str(gl->gl_demote_state), dtime,
-		  atomic_read(&gl->gl_ail_count),
-		  atomic_read(&gl->gl_revokes),
-		  (int)gl->gl_lockref.count, gl->gl_hold_time);
+	gfs2_print_dbg(seq, "G:  s:%s n:%u/%llx f:%s t:%s d:%s/%llu a:%d v:%d "
+		       "r:%d m:%ld w:%d R:%d %d:"
+		       "%02d%02d%02d%02d%02d%02d%02d%02d "
+		       "%02d%02d%02d%02d%02d%02d%02d%02d "
+		       "%02d%02d%02d%02d%02d%02d%02d%02d "
+		       "%02d%02d%02d%02d%02d%02d%02d%02d "
+		       "%02d%02d%02d%02d%02d%02d%02d%02d "
+		       "%02d%02d%02d%02d%02d%02d%02d%02d "
+		       "%02d%02d%02d%02d%02d%02d%02d%02d "
+		       "%02d%02d%02d%02d%02d%02d%02d%02d\n",
+		       state2str(gl->gl_state),
+		       gl->gl_name.ln_type,
+		       (unsigned long long)gl->gl_name.ln_number,
+		       gflags2str(gflags_buf, gl),
+		       state2str(gl->gl_target),
+		       state2str(gl->gl_demote_state), dtime,
+		       atomic_read(&gl->gl_ail_count),
+		       atomic_read(&gl->gl_revokes),
+		       (int)gl->gl_lockref.count, gl->gl_hold_time, gl->gl_whoq,
+		       gl->gl_reply, gl->gl_getputs,
+		       gl->gl_getputhist[0],
+		       gl->gl_getputhist[1],
+		       gl->gl_getputhist[2],
+		       gl->gl_getputhist[3],
+		       gl->gl_getputhist[4],
+		       gl->gl_getputhist[5],
+		       gl->gl_getputhist[6],
+		       gl->gl_getputhist[7],
+
+		       gl->gl_getputhist[8],
+		       gl->gl_getputhist[9],
+		       gl->gl_getputhist[10],
+		       gl->gl_getputhist[11],
+		       gl->gl_getputhist[12],
+		       gl->gl_getputhist[13],
+		       gl->gl_getputhist[14],
+		       gl->gl_getputhist[15],
+
+		       gl->gl_getputhist[16],
+		       gl->gl_getputhist[17],
+		       gl->gl_getputhist[18],
+		       gl->gl_getputhist[19],
+		       gl->gl_getputhist[20],
+		       gl->gl_getputhist[21],
+		       gl->gl_getputhist[22],
+		       gl->gl_getputhist[23],
+
+		       gl->gl_getputhist[24],
+		       gl->gl_getputhist[25],
+		       gl->gl_getputhist[26],
+		       gl->gl_getputhist[27],
+		       gl->gl_getputhist[28],
+		       gl->gl_getputhist[29],
+		       gl->gl_getputhist[30],
+		       gl->gl_getputhist[31],
+
+		       gl->gl_getputhist[32],
+		       gl->gl_getputhist[33],
+		       gl->gl_getputhist[34],
+		       gl->gl_getputhist[35],
+		       gl->gl_getputhist[36],
+		       gl->gl_getputhist[37],
+		       gl->gl_getputhist[38],
+		       gl->gl_getputhist[39],
+
+		       gl->gl_getputhist[40],
+		       gl->gl_getputhist[41],
+		       gl->gl_getputhist[42],
+		       gl->gl_getputhist[43],
+		       gl->gl_getputhist[44],
+		       gl->gl_getputhist[45],
+		       gl->gl_getputhist[46],
+		       gl->gl_getputhist[47],
+
+		       gl->gl_getputhist[48],
+		       gl->gl_getputhist[49],
+		       gl->gl_getputhist[50],
+		       gl->gl_getputhist[51],
+		       gl->gl_getputhist[52],
+		       gl->gl_getputhist[53],
+		       gl->gl_getputhist[54],
+		       gl->gl_getputhist[55],
+
+		       gl->gl_getputhist[56],
+		       gl->gl_getputhist[57],
+		       gl->gl_getputhist[58],
+		       gl->gl_getputhist[59],
+		       gl->gl_getputhist[60],
+		       gl->gl_getputhist[61],
+		       gl->gl_getputhist[62],
+		       gl->gl_getputhist[63]);
 
 	list_for_each_entry(gh, &gl->gl_holders, gh_list) {
 		error = dump_holder(seq, gh);
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h
index 6cb4a44ce8c8..182f8c23ed26 100644
--- a/fs/gfs2/glock.h
+++ b/fs/gfs2/glock.h
@@ -180,8 +180,8 @@ static inline struct address_space *gfs2_glock2aspace(struct gfs2_glock *gl)
 
 extern int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
 			  const struct gfs2_glock_operations *glops,
-			  int create, struct gfs2_glock **glp);
-extern void gfs2_glock_put(struct gfs2_glock *gl);
+			  int create, struct gfs2_glock **glp, int caller);
+extern void gfs2_glock_put(struct gfs2_glock *gl, int caller);
 extern void gfs2_holder_init(struct gfs2_glock *gl, unsigned int state,
 			     u16 flags, struct gfs2_holder *gh);
 extern void gfs2_holder_reinit(unsigned int state, u16 flags,
@@ -196,7 +196,7 @@ extern void gfs2_glock_dq_uninit(struct gfs2_holder *gh);
 extern int gfs2_glock_nq_num(struct gfs2_sbd *sdp, u64 number,
 			     const struct gfs2_glock_operations *glops,
 			     unsigned int state, u16 flags,
-			     struct gfs2_holder *gh);
+			     struct gfs2_holder *gh, int caller);
 extern int gfs2_glock_nq_m(unsigned int num_gh, struct gfs2_holder *ghs);
 extern void gfs2_glock_dq_m(unsigned int num_gh, struct gfs2_holder *ghs);
 extern int gfs2_dump_glock(struct seq_file *seq, const struct gfs2_glock *gl);
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index d61cffef9466..f36f236af4e9 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -552,6 +552,9 @@ static void iopen_go_callback(struct gfs2_glock *gl, bool remote)
 	if (gl->gl_demote_state == LM_ST_UNLOCKED &&
 	    gl->gl_state == LM_ST_SHARED && ip) {
 		gl->gl_lockref.count++;
+		gl->gl_getputhist[gl->gl_getputs++] = 9;
+		if (gl->gl_getputs > GETPUTHIST)
+			gl->gl_getputs = 0;
 		if (queue_work(gfs2_delete_workqueue, &gl->gl_delete) == 0)
 			gl->gl_lockref.count--;
 	}
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 68baadc43264..9e16cc7d50e4 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -324,6 +324,8 @@ enum {
 	GLF_INODE_CREATING		= 16, /* Inode creation occurring */
 };
 
+#define GETPUTHIST 64
+
 struct gfs2_glock {
 	struct hlist_bl_node gl_list;
 	unsigned long gl_flags;		/* GLF_... */
@@ -358,6 +360,9 @@ struct gfs2_glock {
 	struct work_struct gl_delete;
 	struct rcu_head gl_rcu;
 	struct rhash_head gl_node;
+	int gl_whoq;
+	char gl_getputhist[GETPUTHIST];
+	int gl_getputs;
 };
 
 #define GFS2_MIN_LVB_SIZE 32	/* Min size of LVB that gfs2 supports */
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 82106f9575e9..a8bddd0e960b 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -141,12 +141,12 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type,
 		struct gfs2_sbd *sdp = GFS2_SB(inode);
 		ip->i_no_formal_ino = no_formal_ino;
 
-		error = gfs2_glock_get(sdp, no_addr, &gfs2_inode_glops, CREATE, &ip->i_gl);
+		error = gfs2_glock_get(sdp, no_addr, &gfs2_inode_glops, CREATE, &ip->i_gl, 20);
 		if (unlikely(error))
 			goto fail;
 		ip->i_gl->gl_object = ip;
 
-		error = gfs2_glock_get(sdp, no_addr, &gfs2_iopen_glops, CREATE, &io_gl);
+		error = gfs2_glock_get(sdp, no_addr, &gfs2_iopen_glops, CREATE, &io_gl, 21);
 		if (unlikely(error))
 			goto fail_put;
 
@@ -175,7 +175,7 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type,
 			goto fail_put;
 
 		ip->i_iopen_gh.gh_gl->gl_object = ip;
-		gfs2_glock_put(io_gl);
+		gfs2_glock_put(io_gl, 68);
 		io_gl = NULL;
 
 		if (type == DT_UNKNOWN) {
@@ -206,7 +206,7 @@ fail_refresh:
 	gfs2_holder_uninit(&ip->i_iopen_gh);
 fail_put:
 	if (io_gl)
-		gfs2_glock_put(io_gl);
+		gfs2_glock_put(io_gl, 69);
 	if (gfs2_holder_initialized(&i_gh))
 		gfs2_glock_dq_uninit(&i_gh);
 	ip->i_gl->gl_object = NULL;
@@ -660,7 +660,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
 	if (error)
 		goto fail_free_inode;
 
-	error = gfs2_glock_get(sdp, ip->i_no_addr, &gfs2_inode_glops, CREATE, &ip->i_gl);
+	error = gfs2_glock_get(sdp, ip->i_no_addr, &gfs2_inode_glops, CREATE, &ip->i_gl, 24);
 	if (error)
 		goto fail_free_inode;
 
@@ -676,7 +676,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
 	init_dinode(dip, ip, symname);
 	gfs2_trans_end(sdp);
 
-	error = gfs2_glock_get(sdp, ip->i_no_addr, &gfs2_iopen_glops, CREATE, &io_gl);
+	error = gfs2_glock_get(sdp, ip->i_no_addr, &gfs2_iopen_glops, CREATE, &io_gl, 25);
 	if (error)
 		goto fail_gunlock2;
 
@@ -687,7 +687,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
 		goto fail_gunlock2;
 
 	ip->i_iopen_gh.gh_gl->gl_object = ip;
-	gfs2_glock_put(io_gl);
+	gfs2_glock_put(io_gl, 74);
 	gfs2_set_iop(inode);
 	insert_inode_hash(inode);
 
@@ -727,7 +727,7 @@ fail_gunlock2:
 	gfs2_glock_dq_uninit(ghs + 1);
 fail_free_inode:
 	if (ip->i_gl)
-		gfs2_glock_put(ip->i_gl);
+		gfs2_glock_put(ip->i_gl, 76);
 	gfs2_rsqa_delete(ip, NULL);
 fail_gunlock:
 	gfs2_glock_dq_uninit(ghs);
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index b966e7e1e39e..1874aedc0c15 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -387,7 +387,7 @@ static int init_locking(struct gfs2_sbd *sdp, struct gfs2_holder *mount_gh,
 	error = gfs2_glock_nq_num(sdp,
 				  GFS2_MOUNT_LOCK, &gfs2_nondisk_glops,
 				  LM_ST_EXCLUSIVE, LM_FLAG_NOEXP | GL_NOCACHE,
-				  mount_gh);
+				  mount_gh, 11);
 	if (error) {
 		fs_err(sdp, "can't acquire mount glock: %d\n", error);
 		goto fail;
@@ -397,21 +397,21 @@ static int init_locking(struct gfs2_sbd *sdp, struct gfs2_holder *mount_gh,
 				  GFS2_LIVE_LOCK, &gfs2_nondisk_glops,
 				  LM_ST_SHARED,
 				  LM_FLAG_NOEXP | GL_EXACT,
-				  &sdp->sd_live_gh);
+				  &sdp->sd_live_gh, 12);
 	if (error) {
 		fs_err(sdp, "can't acquire live glock: %d\n", error);
 		goto fail_mount;
 	}
 
 	error = gfs2_glock_get(sdp, GFS2_RENAME_LOCK, &gfs2_nondisk_glops,
-			       CREATE, &sdp->sd_rename_gl);
+			       CREATE, &sdp->sd_rename_gl, 26);
 	if (error) {
 		fs_err(sdp, "can't create rename glock: %d\n", error);
 		goto fail_live;
 	}
 
 	error = gfs2_glock_get(sdp, GFS2_TRANS_LOCK, &gfs2_trans_glops,
-			       CREATE, &sdp->sd_trans_gl);
+			       CREATE, &sdp->sd_trans_gl, 27);
 	if (error) {
 		fs_err(sdp, "can't create transaction glock: %d\n", error);
 		goto fail_rename;
@@ -420,9 +420,9 @@ static int init_locking(struct gfs2_sbd *sdp, struct gfs2_holder *mount_gh,
 	return 0;
 
 fail_trans:
-	gfs2_glock_put(sdp->sd_trans_gl);
+	gfs2_glock_put(sdp->sd_trans_gl, 77);
 fail_rename:
-	gfs2_glock_put(sdp->sd_rename_gl);
+	gfs2_glock_put(sdp->sd_rename_gl, 78);
 fail_live:
 	gfs2_glock_dq_uninit(&sdp->sd_live_gh);
 fail_mount:
@@ -461,7 +461,7 @@ static int init_sb(struct gfs2_sbd *sdp, int silent)
 	int ret;
 
 	ret = gfs2_glock_nq_num(sdp, GFS2_SB_LOCK, &gfs2_meta_glops,
-				LM_ST_SHARED, 0, &sb_gh);
+				LM_ST_SHARED, 0, &sb_gh, 13);
 	if (ret) {
 		fs_err(sdp, "can't acquire superblock glock: %d\n", ret);
 		return ret;
@@ -747,7 +747,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
 		error = gfs2_glock_nq_num(sdp, sdp->sd_lockstruct.ls_jid,
 					  &gfs2_journal_glops,
 					  LM_ST_EXCLUSIVE, LM_FLAG_NOEXP,
-					  &sdp->sd_journal_gh);
+					  &sdp->sd_journal_gh, 14);
 		if (error) {
 			fs_err(sdp, "can't acquire journal glock: %d\n", error);
 			goto fail_jindex;
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index e3f54b09777d..ec6f0e9551c6 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -134,7 +134,7 @@ static void gfs2_qd_dispose(struct list_head *list)
 		gfs2_assert_warn(sdp, !qd->qd_slot_count);
 		gfs2_assert_warn(sdp, !qd->qd_bh_count);
 
-		gfs2_glock_put(qd->qd_gl);
+		gfs2_glock_put(qd->qd_gl, 79);
 		atomic_dec(&sdp->sd_quota_count);
 
 		/* Delete it from the common reclaim list */
@@ -218,7 +218,7 @@ static struct gfs2_quota_data *qd_alloc(unsigned hash, struct gfs2_sbd *sdp, str
 	qd->qd_hash = hash;
 
 	error = gfs2_glock_get(sdp, qd2index(qd),
-			      &gfs2_quota_glops, CREATE, &qd->qd_gl);
+			      &gfs2_quota_glops, CREATE, &qd->qd_gl, 28);
 	if (error)
 		goto fail;
 
@@ -281,7 +281,7 @@ static int qd_get(struct gfs2_sbd *sdp, struct kqid qid,
 	spin_unlock(&qd_lock);
 
 	if (qd) {
-		gfs2_glock_put(new_qd->qd_gl);
+		gfs2_glock_put(new_qd->qd_gl, 80);
 		kmem_cache_free(gfs2_quotad_cachep, new_qd);
 	}
 
@@ -1453,7 +1453,7 @@ void gfs2_quota_cleanup(struct gfs2_sbd *sdp)
 		gfs2_assert_warn(sdp, !qd->qd_slot_count);
 		gfs2_assert_warn(sdp, !qd->qd_bh_count);
 
-		gfs2_glock_put(qd->qd_gl);
+		gfs2_glock_put(qd->qd_gl, 81);
 		call_rcu(&qd->qd_rcu, gfs2_qd_dealloc);
 
 		spin_lock(&qd_lock);
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index 56dea445d7fa..21809953eb6a 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -471,7 +471,7 @@ void gfs2_recover_func(struct work_struct *work)
 		error = gfs2_glock_nq_num(sdp, jd->jd_jid, &gfs2_journal_glops,
 					  LM_ST_EXCLUSIVE,
 					  LM_FLAG_NOEXP | LM_FLAG_TRY | GL_NOCACHE,
-					  &j_gh);
+					  &j_gh, 15);
 		switch (error) {
 		case 0:
 			break;
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 1e6a443a7c59..683ee00e95fb 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -689,7 +689,7 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp)
 			gl->gl_object = NULL;
 			spin_unlock(&gl->gl_spin);
 			gfs2_glock_add_to_lru(gl);
-			gfs2_glock_put(gl);
+			gfs2_glock_put(gl, 82);
 		}
 
 		gfs2_free_clones(rgd);
@@ -880,7 +880,7 @@ static int read_rindex_entry(struct gfs2_inode *ip)
 		goto fail;
 
 	error = gfs2_glock_get(sdp, rgd->rd_addr,
-			       &gfs2_rgrp_glops, CREATE, &rgd->rd_gl);
+			       &gfs2_rgrp_glops, CREATE, &rgd->rd_gl, 30);
 	if (error)
 		goto fail;
 
@@ -897,7 +897,7 @@ static int read_rindex_entry(struct gfs2_inode *ip)
 	}
 
 	error = 0; /* someone else read in the rgrp; free it and ignore it */
-	gfs2_glock_put(rgd->rd_gl);
+	gfs2_glock_put(rgd->rd_gl, 83);
 
 fail:
 	kfree(rgd->rd_bits);
@@ -1754,7 +1754,7 @@ static void try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked, u64 skip
 			continue;
 		*last_unlinked = block;
 
-		error = gfs2_glock_get(sdp, block, &gfs2_iopen_glops, CREATE, &gl);
+		error = gfs2_glock_get(sdp, block, &gfs2_iopen_glops, CREATE, &gl, 31);
 		if (error)
 			continue;
 
@@ -1768,7 +1768,7 @@ static void try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked, u64 skip
 		ip = gl->gl_object;
 
 		if (ip || queue_work(gfs2_delete_workqueue, &gl->gl_delete) == 0)
-			gfs2_glock_put(gl);
+			gfs2_glock_put(gl, 84);
 		else
 			found++;
 
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 3aa059d1e962..76e4602b29fb 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -910,8 +910,8 @@ restart:
 	iput(sdp->sd_rindex);
 	iput(sdp->sd_quota_inode);
 
-	gfs2_glock_put(sdp->sd_rename_gl);
-	gfs2_glock_put(sdp->sd_trans_gl);
+	gfs2_glock_put(sdp->sd_rename_gl, 85);
+	gfs2_glock_put(sdp->sd_trans_gl, 86);
 
 	if (!sdp->sd_args.ar_spectator) {
 		gfs2_glock_dq_uninit(&sdp->sd_journal_gh);
@@ -1587,7 +1587,7 @@ out:
 	ip->i_gl->gl_object = NULL;
 	flush_delayed_work(&ip->i_gl->gl_work);
 	gfs2_glock_add_to_lru(ip->i_gl);
-	gfs2_glock_put(ip->i_gl);
+	gfs2_glock_put(ip->i_gl, 89);
 	ip->i_gl = NULL;
 	if (gfs2_holder_initialized(&ip->i_iopen_gh)) {
 		ip->i_iopen_gh.gh_gl->gl_object = NULL;
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 351fd3d5b059..93360ef21bf5 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -247,11 +247,11 @@ static ssize_t demote_rq_store(struct gfs2_sbd *sdp, const char *buf, size_t len
 		return -EINVAL;
 	if (!test_and_set_bit(SDF_DEMOTE, &sdp->sd_flags))
 		fs_info(sdp, "demote interface used\n");
-	rv = gfs2_glock_get(sdp, glnum, glops, 0, &gl);
+	rv = gfs2_glock_get(sdp, glnum, glops, 0, &gl, 34);
 	if (rv)
 		return rv;
 	gfs2_glock_cb(gl, glmode);
-	gfs2_glock_put(gl);
+	gfs2_glock_put(gl, 90);
 	return len;
 }
 

Reply via email to