Commit f39854a3 authored by Darrick J. Wong's avatar Darrick J. Wong Committed by Carlos Maiolino
Browse files

xfs: mark data structures corrupt on EIO and ENODATA



I learned a few things this year: first, blk_status_to_errno can return
ENODATA for critical media errors; and second, the scrub code doesn't
mark data structures as corrupt on ENODATA or EIO.

Currently, scrub failing to capture these errors isn't all that
impactful -- the checking code will exit to userspace with EIO/ENODATA,
and xfs_scrub will log a complaint and exit with nonzero status.  Most
people treat fsck tools failing as a sign that the fs is corrupt, but
online fsck should mark the metadata bad and keep moving.

Cc: stable@vger.kernel.org # v4.15
Fixes: 4700d229 ("xfs: create helpers to record and deal with scrub problems")
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarCarlos Maiolino <cem@kernel.org>
parent 102f444b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -42,6 +42,8 @@ __xchk_btree_process_error(
		break;
	case -EFSBADCRC:
	case -EFSCORRUPTED:
	case -EIO:
	case -ENODATA:
		/* Note the badness but don't abort. */
		sc->sm->sm_flags |= errflag;
		*error = 0;
+4 −0
Original line number Diff line number Diff line
@@ -103,6 +103,8 @@ __xchk_process_error(
		break;
	case -EFSBADCRC:
	case -EFSCORRUPTED:
	case -EIO:
	case -ENODATA:
		/* Note the badness but don't abort. */
		sc->sm->sm_flags |= errflag;
		*error = 0;
@@ -177,6 +179,8 @@ __xchk_fblock_process_error(
		break;
	case -EFSBADCRC:
	case -EFSCORRUPTED:
	case -EIO:
	case -ENODATA:
		/* Note the badness but don't abort. */
		sc->sm->sm_flags |= errflag;
		*error = 0;
+2 −0
Original line number Diff line number Diff line
@@ -45,6 +45,8 @@ xchk_da_process_error(
		break;
	case -EFSBADCRC:
	case -EFSCORRUPTED:
	case -EIO:
	case -ENODATA:
		/* Note the badness but don't abort. */
		sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
		*error = 0;