public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Fanael Linithien <fanael4@gmail.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH v2 1/5] xfs_repair: refuse to run if we don't recognize version or feature flags
Date: Wed, 27 May 2015 09:42:31 -0700	[thread overview]
Message-ID: <20150527164231.GC10175@birch.djwong.org> (raw)
In-Reply-To: <5565E064.8060105@gmail.com>

On Wed, May 27, 2015 at 05:19:00PM +0200, Fanael Linithien 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.
> >
> > 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?

Err, yes.  Thank you for catching all these.  No more patching past 10pm for
me.... :)

--D

> 
> > +            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@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2015-05-27 16:42 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-26 22:51 [PATCH 0/5] xfsprogs May 2015 patchbomb Darrick J. Wong
2015-05-26 22:51 ` [PATCH 1/5] xfs_repair: refuse to run if we don't recognize version or feature flags Darrick J. Wong
2015-05-26 23:49   ` Eric Sandeen
2015-05-27  5:45   ` [PATCH v2 " Darrick J. Wong
2015-05-27 14:54     ` Eric Sandeen
2015-05-27 15:16       ` Eric Sandeen
2015-05-27 15:27         ` Eric Sandeen
2015-05-27 16:04           ` Fanael Linithien
2015-05-27 16:26             ` Eric Sandeen
2015-05-27 17:17             ` Darrick J. Wong
2015-05-27 15:19     ` Fanael Linithien
2015-05-27 16:42       ` Darrick J. Wong [this message]
2015-05-27 18:15   ` [PATCH v3 " Darrick J. Wong
2015-05-27 18:42     ` Fanael Linithien
2015-05-26 22:51 ` [PATCH 2/5] xfs_repair: better checking of v5 metadata fields Darrick J. Wong
2015-05-26 23:58   ` Dave Chinner
2015-05-27  5:44   ` [PATCH v2 " Darrick J. Wong
2015-05-31 21:32     ` Dave Chinner
2015-05-26 22:51 ` [PATCH 3/5] xfs_repair: ensure .. is set to a sane ino value when rebuilding dir Darrick J. Wong
2015-05-26 22:51 ` [PATCH 4/5] xfs_db: enable blockget for v5 filesystems Darrick J. Wong
2015-05-26 23:07   ` Eric Sandeen
2015-05-26 23:13     ` Darrick J. Wong
2015-05-26 23:14   ` [PATCH v2 " Darrick J. Wong
2015-05-26 22:51 ` [PATCH 5/5] xfs_db: enable blocktrash for checksummed filesystems Darrick J. Wong
2015-05-28  5:08   ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150527164231.GC10175@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=fanael4@gmail.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox