]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_repair: validate superblock against known v5 feature flags
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 1 Jun 2015 01:17:08 +0000 (11:17 +1000)
committerDave Chinner <david@fromorbit.com>
Mon, 1 Jun 2015 01:17:08 +0000 (11:17 +1000)
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 <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Fanael Linithien <fanael4@gmail.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
repair/versions.c

index c1dff72a8906d3386fe7cd511549a7b9a1ca27a7..10bcd2963081bf23a42851765d71f52a2657d681 100644 (file)
@@ -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)  {