Commit 8dc88ac6 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Bob Peterson

gfs2: Report errors before withdraw

In gfs2_rgrp_verify and compute_bitstructs, make sure to report errors before
withdrawing the filesystem: otherwise, when we withdraw first and withdraw is
configured to panic, we'll never get to the error reporting.
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
parent badb55ec
...@@ -457,24 +457,24 @@ void gfs2_rgrp_verify(struct gfs2_rgrpd *rgd) ...@@ -457,24 +457,24 @@ void gfs2_rgrp_verify(struct gfs2_rgrpd *rgd)
} }
if (count[0] != rgd->rd_free) { if (count[0] != rgd->rd_free) {
if (gfs2_consist_rgrpd(rgd)) gfs2_lm(sdp, "free data mismatch: %u != %u\n",
fs_err(sdp, "free data mismatch: %u != %u\n", count[0], rgd->rd_free);
count[0], rgd->rd_free); gfs2_consist_rgrpd(rgd);
return; return;
} }
tmp = rgd->rd_data - rgd->rd_free - rgd->rd_dinodes; tmp = rgd->rd_data - rgd->rd_free - rgd->rd_dinodes;
if (count[1] != tmp) { if (count[1] != tmp) {
if (gfs2_consist_rgrpd(rgd)) gfs2_lm(sdp, "used data mismatch: %u != %u\n",
fs_err(sdp, "used data mismatch: %u != %u\n", count[1], tmp);
count[1], tmp); gfs2_consist_rgrpd(rgd);
return; return;
} }
if (count[2] + count[3] != rgd->rd_dinodes) { if (count[2] + count[3] != rgd->rd_dinodes) {
if (gfs2_consist_rgrpd(rgd)) gfs2_lm(sdp, "used metadata mismatch: %u != %u\n",
fs_err(sdp, "used metadata mismatch: %u != %u\n", count[2] + count[3], rgd->rd_dinodes);
count[2] + count[3], rgd->rd_dinodes); gfs2_consist_rgrpd(rgd);
return; return;
} }
} }
...@@ -733,17 +733,6 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp) ...@@ -733,17 +733,6 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp)
} }
} }
static void gfs2_rindex_print(const struct gfs2_rgrpd *rgd)
{
struct gfs2_sbd *sdp = rgd->rd_sbd;
fs_info(sdp, "ri_addr = %llu\n", (unsigned long long)rgd->rd_addr);
fs_info(sdp, "ri_length = %u\n", rgd->rd_length);
fs_info(sdp, "ri_data0 = %llu\n", (unsigned long long)rgd->rd_data0);
fs_info(sdp, "ri_data = %u\n", rgd->rd_data);
fs_info(sdp, "ri_bitbytes = %u\n", rgd->rd_bitbytes);
}
/** /**
* gfs2_compute_bitstructs - Compute the bitmap sizes * gfs2_compute_bitstructs - Compute the bitmap sizes
* @rgd: The resource group descriptor * @rgd: The resource group descriptor
...@@ -814,11 +803,20 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd) ...@@ -814,11 +803,20 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd)
} }
bi = rgd->rd_bits + (length - 1); bi = rgd->rd_bits + (length - 1);
if ((bi->bi_start + bi->bi_bytes) * GFS2_NBBY != rgd->rd_data) { if ((bi->bi_start + bi->bi_bytes) * GFS2_NBBY != rgd->rd_data) {
if (gfs2_consist_rgrpd(rgd)) { gfs2_lm(sdp,
gfs2_rindex_print(rgd); "ri_addr = %llu\n"
fs_err(sdp, "start=%u len=%u offset=%u\n", "ri_length = %u\n"
bi->bi_start, bi->bi_bytes, bi->bi_offset); "ri_data0 = %llu\n"
} "ri_data = %u\n"
"ri_bitbytes = %u\n"
"start=%u len=%u offset=%u\n",
(unsigned long long)rgd->rd_addr,
rgd->rd_length,
(unsigned long long)rgd->rd_data0,
rgd->rd_data,
rgd->rd_bitbytes,
bi->bi_start, bi->bi_bytes, bi->bi_offset);
gfs2_consist_rgrpd(rgd);
return -EIO; return -EIO;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment