Commit 5dab2daa authored by Darrick J. Wong's avatar Darrick J. Wong
Browse files

xfs: fix di_metatype field of inodes that won't load



Make sure that the di_metatype field is at least set plausibly so that
later scrubbers could set the real type.

Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent aec2eb7d
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -443,8 +443,13 @@ xchk_dinode(
		break;
	case 2:
	case 3:
		if (!xfs_dinode_is_metadir(dip) && dip->di_metatype)
		if (xfs_dinode_is_metadir(dip)) {
			if (be16_to_cpu(dip->di_metatype) >= XFS_METAFILE_MAX)
				xchk_ino_set_corrupt(sc, ino);
		} else {
			if (dip->di_metatype != 0)
				xchk_ino_set_corrupt(sc, ino);
		}

		if (dip->di_mode == 0 && sc->ip)
			xchk_ino_set_corrupt(sc, ino);
+5 −1
Original line number Diff line number Diff line
@@ -526,9 +526,13 @@ xrep_dinode_nlinks(
		return;
	}

	if (!xfs_dinode_is_metadir(dip))
	if (xfs_dinode_is_metadir(dip)) {
		if (be16_to_cpu(dip->di_metatype) >= XFS_METAFILE_MAX)
			dip->di_metatype = cpu_to_be16(XFS_METAFILE_UNKNOWN);
	} else {
		dip->di_metatype = 0;
	}
}

/* Fix any conflicting flags that the verifiers complain about. */
STATIC void