xfs
[Top] [All Lists]

[PATCH 1/5] xfs_repair: refuse to run if we don't recognize version or f

To: david@xxxxxxxxxxxxx, darrick.wong@xxxxxxxxxx
Subject: [PATCH 1/5] xfs_repair: refuse to run if we don't recognize version or feature flags
From: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx>
Date: Tue, 26 May 2015 15:51:32 -0700
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20150526225126.26434.69010.stgit@xxxxxxxxxxxxxxxx>
References: <20150526225126.26434.69010.stgit@xxxxxxxxxxxxxxxx>
User-agent: StGit/0.17.1-dirty
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@xxxxxxxxxx>
---
 repair/versions.c |    7 +++++++
 1 file changed, 7 insertions(+)


diff --git a/repair/versions.c b/repair/versions.c
index c1dff72..e60574d 100644
--- a/repair/versions.c
+++ b/repair/versions.c
@@ -141,6 +141,13 @@ parse_sb_version(xfs_sb_t *sb)
                }
        }
 
+       /* Look for V5 feature flags we don't know about */
+       if (XFS_SB_VERSION_NUM(sb) >= XFS_SB_VERSION_5 &&
+           (xfs_sb_has_ro_compat_feature(sb, XFS_SB_FEAT_RO_COMPAT_UNKNOWN) ||
+            xfs_sb_has_incompat_feature(sb, XFS_SB_FEAT_INCOMPAT_UNKNOWN) ||
+            xfs_sb_has_compat_feature(sb, XFS_SB_FEAT_COMPAT_UNKNOWN)))
+               issue_warning = 1;
+
        if (issue_warning)  {
                do_warn(
 _("This filesystem uses feature(s) not yet supported in this release.\n"

<Prev in Thread] Current Thread [Next in Thread>