The print command of the xfs_db would cause segfault on a corrupted or CRC error block, fix it by bailing out the print when encountered a corrupted or CRC error block, below is an example to reproduce the segfault: mkfs.xfs -f /dev/sda1 xfs_db -r -c "agf 0" -c "addr rmaproot" -c "p" /dev/sda1 Metadata CRC error detected at xfs_rmapbt block 0x0/0x1000 Segmentation fault (core dumped) Signed-off-by: Shan Hai <shan.hai@xxxxxxxxxx> --- db/print.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/db/print.c b/db/print.c index e31372f..08bb39a 100644 --- a/db/print.c +++ b/db/print.c @@ -69,11 +69,19 @@ print_f( char **argv) { pfunc_t pf; + int err; if (cur_typ == NULL) { dbprintf(_("no current type\n")); return 0; } + + err = iocur_top->bp->b_error; + if ((err == -EFSCORRUPTED) || (err == -EFSBADCRC)) { + dbprintf(_("data corrupted or CRC error\n")); + return 0; + } + pf = cur_typ->pfunc; if (pf == NULL) { dbprintf(_("no print function for type %s\n"), cur_typ->name); -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html