]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: better reporting of metadata media errors
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 1 Nov 2019 20:16:40 +0000 (16:16 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Fri, 1 Nov 2019 20:16:40 +0000 (16:16 -0400)
When we report bad metadata, we inexplicably report the physical address
in units of sectors, whereas for file data we report file offsets in
units of bytes.  Fix the metadata reporting units to match the file data
units (i.e. bytes) and skip the printf for all other cases.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
man/man8/xfs_scrub.8
scrub/phase6.c

index 18948a4e3303eeb4cc329a63ba1ec6d00f70a988..e881ae76acb323d77b6b37add6c83423d2d92c57 100644 (file)
@@ -101,6 +101,10 @@ Read all file data extents to look for disk errors.
 will issue O_DIRECT reads to the block device directly.
 If the block device is a SCSI disk, it will instead issue READ VERIFY commands
 directly to the disk.
+If media errors are found, the error report will include the disk offset, in
+bytes.
+If the media errors affect a file, the report will also include the inode
+number and file offset, in bytes.
 These actions will confirm that all file data blocks can be read from storage.
 .SH OPTIMIZATIONS
 Optimizations supported by this program include, but are not limited to:
index 5aeef1cb26b9a839c77625f8b2efe604ba6a1764..1c4a21070bdf857f49cd3d07d5540512decb4e4c 100644 (file)
@@ -368,7 +368,7 @@ xfs_check_rmap_error_report(
        void                    *arg)
 {
        const char              *type;
-       char                    buf[32];
+       char                    buf[DESCR_BUFSZ];
        uint64_t                err_physical = *(uint64_t *)arg;
        uint64_t                err_off;
 
@@ -377,14 +377,12 @@ xfs_check_rmap_error_report(
        else
                err_off = 0;
 
-       snprintf(buf, 32, _("disk offset %"PRIu64),
-                       (uint64_t)BTOBB(map->fmr_physical + err_off));
-
+       /* Report special owners */
        if (map->fmr_flags & FMR_OF_SPECIAL_OWNER) {
+               snprintf(buf, DESCR_BUFSZ, _("disk offset %"PRIu64),
+                               (uint64_t)map->fmr_physical + err_off);
                type = xfs_decode_special_owner(map->fmr_owner);
-               str_error(ctx, buf,
-_("%s failed read verification."),
-                               type);
+               str_error(ctx, buf, _("media error in %s."), type);
        }
 
        /*