xfs
[Top] [All Lists]

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

To: xfs@xxxxxxxxxxx
Subject: Re: [PATCH v2 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 17:19:00 +0200
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:in-reply-to:content-type:content-transfer-encoding; bh=wTHXOnK2jDCNHUC50W048b0nCU4LRU1FWffY4XXyr24=; b=GoQtZYbnxFxxftysQnYqMsq5ys7qaAz1wesCPcqozuP1I+OivEW28ap7tPtYz+vwCN u3C8UVx/6uH7oD9U7MzHPemnbTD3LXHWvntpRETyTvulVwt9BgOv6gPGbXg60GFPi26D /KK/kWjZGN9sMETQtyog93hWi2RdB7JPvzi5wBEFXCTpqDxfWgcL/8I/erl7uHOElk9x 9IfxpyRFpOwzMZLMo/Wlt/euny3C038e9wT+XXq73OM+74KrpM3A93pXA7E7KIeCWdmp drOgt6wgmBFkzyoLhBpMYxT2WJJ1Re8dxcxBx5KRgCU3Sy5fC+qhTEVsRYx8FxHC3yVE jmOQ==
In-reply-to: <20150527054536.GB10175@xxxxxxxxxxxxxxxx>
In-reply-to: <20150527054536.GB10175@xxxxxxxxxxxxxxxx>
References: <20150527054536.GB10175@xxxxxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
> 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.
>
> Signed-off-by: Darrick J. Wong <darrick.wong at oracle.com>
> ---
>  repair/versions.c |   33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
>
> diff --git a/repair/versions.c b/repair/versions.c
> index c1dff72..dbe41a4 100644
> --- a/repair/versions.c
> +++ b/repair/versions.c
> @@ -175,6 +175,39 @@ _("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) {
> +        if (xfs_sb_has_ro_compat_feature(sb,
> +                XFS_SB_FEAT_RO_COMPAT_UNKNOWN)) {
> +            do_warn(
> +_("Superblock has unknown read-only compatible features (0x%x) enabled.\n"
> +"Using a more recent xfs_repair is recommended.\n"),
> +                sb->sb_features_ro_compat &
> +                        XFS_SB_FEAT_RO_COMPAT_UNKNOWN);
> +            issue_warning = 1;
> +        }
> +        if (xfs_sb_has_incompat_feature(sb,
> +                XFS_SB_FEAT_INCOMPAT_UNKNOWN)) {
> +            do_warn(
> +_("Superblock has unknown read-only compatible features (0x%x) enabled.\n"
> +"Using a more recent xfs_repair is recommended.\n"),
> +                sb->sb_features_ro_compat &
> +                        XFS_SB_FEAT_RO_COMPAT_UNKNOWN);

Copy/paste error, do you mean incompat?

> +            issue_warning = 1;
> +        }
> +        if (xfs_sb_has_compat_feature(sb,
> +                XFS_SB_FEAT_COMPAT_UNKNOWN)) {
> +            do_warn(
> +_("Superblock has unknown compatible features (0x%x) enabled.\n"
> +"Using a more recent xfs_repair is recommended.\n"),
> +                sb->sb_features_ro_compat &
> +                        XFS_SB_FEAT_RO_COMPAT_UNKNOWN);

compat here?

> +            issue_warning = 1;
> +        }
> +        if (issue_warning)
> +            return 1;
> +    }
> +
>      if (xfs_sb_version_hasattr(sb))  {
>          if (!fs_attributes_allowed)  {
>              if (!no_modify)  {

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