From: Darrick J. Wong Date: Mon, 1 Jun 2015 01:17:08 +0000 (+1000) Subject: xfs_repair: validate superblock against known v5 feature flags X-Git-Tag: v3.2.3-rc2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a98b22b6a4135041e2a82b966cd7d8e606c2b958;p=thirdparty%2Fxfsprogs-dev.git xfs_repair: validate superblock against known v5 feature flags Apparently xfs_repair running on a v5 filesystem doesn't check the compat, rocompat, or incompat feature flags for bits that it doesn't know about, which means that old xfs_repairs can wreak havoc. So, strengthen the checks to prevent repair from "repairing" anything it doesn't understand. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Reviewed-by: Fanael Linithien Signed-off-by: Dave Chinner --- diff --git a/repair/versions.c b/repair/versions.c index c1dff72a8..10bcd2963 100644 --- a/repair/versions.c +++ b/repair/versions.c @@ -175,6 +175,20 @@ _("WARNING: you have disallowed superblock-feature-bits-allowed\n" } } + /* Look for V5 feature flags we don't know about */ + if (XFS_SB_VERSION_NUM(sb) >= XFS_SB_VERSION_5 && + (xfs_sb_has_compat_feature(sb, XFS_SB_FEAT_COMPAT_UNKNOWN) || + xfs_sb_has_ro_compat_feature(sb, XFS_SB_FEAT_RO_COMPAT_UNKNOWN) || + xfs_sb_has_incompat_feature(sb, XFS_SB_FEAT_INCOMPAT_UNKNOWN))) { + do_warn( +_("Superblock has unknown compat/rocompat/incompat features (0x%x/0x%x/0x%x).\n" + "Using a more recent xfs_repair is recommended.\n"), + sb->sb_features_compat & XFS_SB_FEAT_COMPAT_UNKNOWN, + sb->sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_UNKNOWN, + sb->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_UNKNOWN); + return 1; + } + if (xfs_sb_version_hasattr(sb)) { if (!fs_attributes_allowed) { if (!no_modify) {