Skip to contentSkip to conversation

gfs2: print fsid when rgrp errors are found

PATCH New Bob Peterson 2 participants 2 messages Oct 4, 2018 1 message not in the archive GFS2 file system

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 gfs2: print fsid when rgrp errors are found

In reply to a message not in the archive

Hi,

This patch allows gfs2_setbit to provide useful debug information when bitmap errors are encountered. It now provides the file system id so you can tell which mount point the error occurred, as well as the intended block and the bitmap's block number.

---
 fs/gfs2/rgrp.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
fs/gfs2/rgrp.c +9 -5
index fc181c81cca2..506d09d70b8a 100644
@@ -101,12 +101,16 @@ static inline void gfs2_setbit(const struct gfs2_rbm *rbm, bool do_clone,
 	cur_state = (*byte1 >> bit) & GFS2_BIT_MASK;
 
 	if (unlikely(!valid_change[new_state * 4 + cur_state])) {
-		pr_warn("buf_blk = 0x%x old_state=%d, new_state=%d\n",
+		struct gfs2_sbd *sdp = rbm->rgd->rd_sbd;
+
+		fs_warn(sdp, "buf_blk = 0x%x old_state=%d, new_state=%d\n",
 			rbm->offset, cur_state, new_state);
-		pr_warn("rgrp=0x%llx bi_start=0x%x\n",
-			(unsigned long long)rbm->rgd->rd_addr, bi->bi_start);
-		pr_warn("bi_offset=0x%x bi_len=0x%x\n",
-			bi->bi_offset, bi->bi_len);
+		fs_warn(sdp, "rgrp=0x%llx bi_start=0x%x biblk: 0x%llx\n",
+			(unsigned long long)rbm->rgd->rd_addr, bi->bi_start,
+			(unsigned long long)bi->bi_bh->b_blocknr);
+		fs_warn(sdp, "bi_offset=0x%x bi_len=0x%x block=0x%llx\n",
+			bi->bi_offset, bi->bi_len,
+			(unsigned long long)gfs2_rbm_to_block(rbm));
 		dump_stack();
 		gfs2_consist_rgrpd(rbm->rgd);
 		return;
#2 lore raw

PATCH 1/1 gfs2: print fsid when rgrp errors are found

Hi,

Presumably the other calls to pr_warn have the same issue? Perhaps we should just get rid of pr_warn completely unless there are cases where a super block is not available to pass to fs_warn,

Steve.

Quoted 39 lines · Bob Peterson

Hi,

This patch allows gfs2_setbit to provide useful debug information when bitmap errors are encountered. It now provides the file system id so you can tell which mount point the error occurred, as well as the intended block and the bitmap's block number.

---
  fs/gfs2/rgrp.c | 14 +++++++++-----
  1 file changed, 9 insertions(+), 5 deletions(-)
fs/gfs2/rgrp.c +9 -5
index fc181c81cca2..506d09d70b8a 100644
@@ -101,12 +101,16 @@ static inline void gfs2_setbit(const struct gfs2_rbm *rbm, bool do_clone,
  	cur_state = (*byte1 >> bit) & GFS2_BIT_MASK;
 
  	if (unlikely(!valid_change[new_state * 4 + cur_state])) {
-		pr_warn("buf_blk = 0x%x old_state=%d, new_state=%d\n",
+		struct gfs2_sbd *sdp = rbm->rgd->rd_sbd;
+
+		fs_warn(sdp, "buf_blk = 0x%x old_state=%d, new_state=%d\n",
  			rbm->offset, cur_state, new_state);
-		pr_warn("rgrp=0x%llx bi_start=0x%x\n",
-			(unsigned long long)rbm->rgd->rd_addr, bi->bi_start);
-		pr_warn("bi_offset=0x%x bi_len=0x%x\n",
-			bi->bi_offset, bi->bi_len);
+		fs_warn(sdp, "rgrp=0x%llx bi_start=0x%x biblk: 0x%llx\n",
+			(unsigned long long)rbm->rgd->rd_addr, bi->bi_start,
+			(unsigned long long)bi->bi_bh->b_blocknr);
+		fs_warn(sdp, "bi_offset=0x%x bi_len=0x%x block=0x%llx\n",
+			bi->bi_offset, bi->bi_len,
+			(unsigned long long)gfs2_rbm_to_block(rbm));
  		dump_stack();
  		gfs2_consist_rgrpd(rbm->rgd);
  		return;