]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: don't report media errors for space with unknowable owner
authorDarrick J. Wong <djwong@kernel.org>
Fri, 12 Jan 2024 02:07:04 +0000 (18:07 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 12 Jan 2024 02:08:46 +0000 (18:08 -0800)
On filesystems that don't have the reverse mapping feature enabled, the
GETFSMAP call cannot tell us much about the owner of a space extent --
we're limited to static fs metadata, free space, or "unknown".  In this
case, nothing is corrupt, so str_corrupt is not an appropriate logging
function.  Relax this to str_info so that the user sees a notice that
media errors have been found so that the user knows something bad
happened even if the directory tree walker cannot find the file owning
the space where the media error was found.

Filesystems with rmap enabled are never supposed to return OWN_UNKNOWN
from a GETFSMAP report, so continue to report that as a corruption.
This fixes a regression in xfs/556.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
scrub/phase6.c

index 33c3c8bde3ccd5554645cd76873232473bf381af..99a32bc796207731547e8be0ec252ddd98a33316 100644 (file)
@@ -397,7 +397,18 @@ report_ioerr_fsmap(
                snprintf(buf, DESCR_BUFSZ, _("disk offset %"PRIu64),
                                (uint64_t)map->fmr_physical + err_off);
                type = decode_special_owner(map->fmr_owner);
-               str_corrupt(ctx, buf, _("media error in %s."), type);
+               /*
+                * On filesystems that don't store reverse mappings, the
+                * GETFSMAP call returns OWNER_UNKNOWN for allocated space.
+                * We'll have to let the directory tree walker find the file
+                * that lost data.
+                */
+               if (!(ctx->mnt.fsgeom.flags & XFS_FSOP_GEOM_FLAGS_RMAPBT) &&
+                   map->fmr_owner == XFS_FMR_OWN_UNKNOWN) {
+                       str_info(ctx, buf, _("media error detected."));
+               } else {
+                       str_corrupt(ctx, buf, _("media error in %s."), type);
+               }
        }
 
        /* Report extent maps */