From: Eric Sandeen Date: Thu, 5 Feb 2015 23:25:13 +0000 (+1100) Subject: xfs_repair: fix max block offset test X-Git-Tag: v3.2.3-rc1~39 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7511a9cf1f6e5e49d5c86c6d0f8e1bccfff912a2;p=thirdparty%2Fxfsprogs-dev.git xfs_repair: fix max block offset test Eryu pointed out that in fstest xfs/071, we find corruption reported at the end. This test attempts to do IO at the maximum possible offsets, and repair yields: inode 1027 - extent offset too large - start 70, count 1, offset 2251799813685247 correcting nextents for inode 1027 bad data fork in inode 1027 would have cleared inode 1027 Repair is complaining that an extent *starts* at the maximum block, but AFAICT, starting there is just fine, as long as we also end there. i.e. a one-block extent at the limit is just fine. So change the xfs_repair test to allow this situation. Also, the warning text is a bit unclear, mixing in the physical block w/ the logical block... rearrange that a little to make it obvious. Reported-by: Eryu Guan Signed-off-by: Eric Sandeen Reviewed-by: Brian Foster Signed-off-by: Dave Chinner --- diff --git a/repair/dinode.c b/repair/dinode.c index 73e4b9eb3..5d9094b3d 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -667,12 +667,14 @@ _("inode %" PRIu64 " - bad extent overflows - start %" PRIu64 ", " irec.br_startoff); goto done; } - if (irec.br_startoff >= fs_max_file_offset) { + /* Ensure this extent does not extend beyond the max offset */ + if (irec.br_startoff + irec.br_blockcount - 1 > + fs_max_file_offset) { do_warn( -_("inode %" PRIu64 " - extent offset too large - start %" PRIu64 ", " - "count %" PRIu64 ", offset %" PRIu64 "\n"), - ino, irec.br_startblock, irec.br_blockcount, - irec.br_startoff); +_("inode %" PRIu64 " - extent exceeds max offset - start %" PRIu64 ", " + "count %" PRIu64 ", physical block %" PRIu64 "\n"), + ino, irec.br_startoff, irec.br_blockcount, + irec.br_startblock); goto done; }