xfs
[Top] [All Lists]

Re: [PATCH v3 1/5] xfs_repair: refuse to run if we don't recognize versi

To: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx>
Subject: Re: [PATCH v3 1/5] xfs_repair: refuse to run if we don't recognize version or feature flags
From: Fanael Linithien <fanael4@xxxxxxxxx>
Date: Wed, 27 May 2015 20:42:27 +0200
Cc: david@xxxxxxxxxxxxx, Eric Sandeen <sandeen@xxxxxxxxxxx>, xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=2Gtb4ohaejRaJ6tSBM4SG2hmFrr9HEcITBXZkoSFw4U=; b=HcFcVqHC6UwpV+KfkExyAeWXWbZiVO45qjPlp400RE1rYlgInSUtwH3XTVbYdOVhkg q9xzdtsj1dm8FYDr+EutcXQ3xju6rXZQVbkaIM8v9yaKekw7NgmaLdkqWiYZmnxMbvo0 D04CEYw6ZNPRN7V4v+yUorPm2fi7nCiZaym+llBT7wLuzzYjWNGjmmcGqwsz8XvfjXcc umKvVT8T+1rzdBLPw93T2NmkLCX8BUPnkwUjXHC9OSsSiDBhtI4CYyvXahhiHo7dh2YO CFmOF8mFQ9l2isI3zsaVRiVuH71YnJHbjejdyrelR30FjgGLdCQfuyYMvJxrIQOCM/r1 cDBw==
In-reply-to: <20150527181503.GE10175@xxxxxxxxxxxxxxxx>
References: <20150526225132.26434.82404.stgit@xxxxxxxxxxxxxxxx> <20150527181503.GE10175@xxxxxxxxxxxxxxxx>
2015-05-27 20:15 GMT+02:00 Darrick J. Wong <darrick.wong@xxxxxxxxxx>:
> 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.
>
> v2: Move the complaint code after the version number check, and print
> the actual feature bits that we don't recognize.
>
> v3: Fix some copy-pasta errors, and simpify the warning messages.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> ---

Reviewed-by: Fanael Linithien <fanael4@xxxxxxxxx>

>  repair/versions.c |   14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/repair/versions.c b/repair/versions.c
> index c1dff72..10bcd29 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)  {

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