Skip to contentSkip to conversation

gfs2: Change more BUG_ON to GLOCK_BUG_ON

PATCH New Bob Peterson 1 participant 1 message Jan 24, 2022 GFS2 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gfs2: Change more BUG_ON to GLOCK_BUG_ON

This patch changes some BUG_ON calls to GLOCK_BUG_ON so we get more information to help with debugging when reservation problems occur.

---
 fs/gfs2/rgrp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/gfs2/rgrp.c +3 -3
index 9b04a570c582..e14520b451db 100644
@@ -49,7 +49,7 @@ static inline struct gfs2_bitmap *rbm_bi(const struct gfs2_rbm *rbm)
 
 static inline u64 gfs2_rbm_to_block(const struct gfs2_rbm *rbm)
 {
-	BUG_ON(rbm->offset >= rbm->rgd->rd_data);
+	GLOCK_BUG_ON(rbm->rgd->rd_gl, rbm->offset >= rbm->rgd->rd_data);
 	return rbm->rgd->rd_data0 + (rbm_bi(rbm)->bi_start * GFS2_NBBY) +
 		rbm->offset;
 }
@@ -1492,7 +1492,7 @@ static void rs_insert(struct gfs2_inode *ip)
 	struct gfs2_blkreserv *rs = &ip->i_res;
 	struct gfs2_rgrpd *rgd = rs->rs_rgd;
 
-	BUG_ON(gfs2_rs_active(rs));
+	GLOCK_BUG_ON(rgd->rd_gl, gfs2_rs_active(rs));
 
 	spin_lock(&rgd->rd_rsspin);
 	newn = &rgd->rd_rstree.rb_node;
@@ -2426,7 +2426,7 @@ int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks,
 	u32 minext = 1;
 	int error = -ENOSPC;
 
-	BUG_ON(ip->i_res.rs_reserved < *nblocks);
+	GLOCK_BUG_ON(rbm.rgd->rd_gl, ip->i_res.rs_reserved < *nblocks);
 
 	rgrp_lock_local(rbm.rgd);
 	if (gfs2_rs_active(&ip->i_res)) {
Signature · 1 line
2.34.1