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

Eric Sandeen sandeen at sandeen.net
Wed May 27 09:54:31 CDT 2015


On 5/27/15 12:45 AM, Darrick J. Wong wrote:
> 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.

Thanks.  That's a bit more wordy, but probably better, in the end.

Reviewed-by: Eric Sandeen <sandeen at redhat.com>

> 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);
> +			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);
> +			issue_warning = 1;
> +		}
> +		if (issue_warning)
> +			return 1;
> +	}
> +
>  	if (xfs_sb_version_hasattr(sb))  {
>  		if (!fs_attributes_allowed)  {
>  			if (!no_modify)  {
> 
> _______________________________________________
> xfs mailing list
> xfs at oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
> 



More information about the xfs mailing list