mirror of https://gitee.com/openkylin/linux.git
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: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
This commit is contained in:
parent
badb55ec20
commit
8dc88ac68d
|
@ -457,24 +457,24 @@ void gfs2_rgrp_verify(struct gfs2_rgrpd *rgd)
|
|||
}
|
||||
|
||||
if (count[0] != rgd->rd_free) {
|
||||
if (gfs2_consist_rgrpd(rgd))
|
||||
fs_err(sdp, "free data mismatch: %u != %u\n",
|
||||
count[0], rgd->rd_free);
|
||||
gfs2_lm(sdp, "free data mismatch: %u != %u\n",
|
||||
count[0], rgd->rd_free);
|
||||
gfs2_consist_rgrpd(rgd);
|
||||
return;
|
||||
}
|
||||
|
||||
tmp = rgd->rd_data - rgd->rd_free - rgd->rd_dinodes;
|
||||
if (count[1] != tmp) {
|
||||
if (gfs2_consist_rgrpd(rgd))
|
||||
fs_err(sdp, "used data mismatch: %u != %u\n",
|
||||
count[1], tmp);
|
||||
gfs2_lm(sdp, "used data mismatch: %u != %u\n",
|
||||
count[1], tmp);
|
||||
gfs2_consist_rgrpd(rgd);
|
||||
return;
|
||||
}
|
||||
|
||||
if (count[2] + count[3] != rgd->rd_dinodes) {
|
||||
if (gfs2_consist_rgrpd(rgd))
|
||||
fs_err(sdp, "used metadata mismatch: %u != %u\n",
|
||||
count[2] + count[3], rgd->rd_dinodes);
|
||||
gfs2_lm(sdp, "used metadata mismatch: %u != %u\n",
|
||||
count[2] + count[3], rgd->rd_dinodes);
|
||||
gfs2_consist_rgrpd(rgd);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
* @rgd: The resource group descriptor
|
||||
|
@ -814,11 +803,20 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd)
|
|||
}
|
||||
bi = rgd->rd_bits + (length - 1);
|
||||
if ((bi->bi_start + bi->bi_bytes) * GFS2_NBBY != rgd->rd_data) {
|
||||
if (gfs2_consist_rgrpd(rgd)) {
|
||||
gfs2_rindex_print(rgd);
|
||||
fs_err(sdp, "start=%u len=%u offset=%u\n",
|
||||
bi->bi_start, bi->bi_bytes, bi->bi_offset);
|
||||
}
|
||||
gfs2_lm(sdp,
|
||||
"ri_addr = %llu\n"
|
||||
"ri_length = %u\n"
|
||||
"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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue