All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: chandan.babu@gmail.com, linux-xfs@vger.kernel.org, sandeen@sandeen.net
Subject: Re: [PATCH 2/3] xfs: don't allow log recovery when unknown rocompat bits are set
Date: Fri, 25 Aug 2023 11:07:56 +1000	[thread overview]
Message-ID: <ZOf+7PqbeHj1Qs3y@dread.disaster.area> (raw)
In-Reply-To: <169291930662.220104.8435560164784332097.stgit@frogsfrogsfrogs>

On Thu, Aug 24, 2023 at 04:21:46PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Don't allow log recovery to proceed on a readonly mount if the primary
> superblock advertises unknown rocompat bits.  We used to allow this, but
> due to a misunderstanding between Dave and Darrick back in 2016, we
> cannot do that anymore.  The XFS_SB_FEAT_RO_COMPAT_RMAPBT feature (4.8)
> protects RUI log items, and the REFLINK feature (4.9) protects CUI/BUI
> log items, which is why we can't allow older kernels to recover them.

Ok, this would work for kernels that don't know waht the
REFLINK/RMAP features are, but upstream kernels will never fail to
recover these items because these are known ROCOMPAT bits.

The reason this problem exists is that we've accidentally
conflated RO_COMPAT with LOG_INCOMPAT. If RUI/CUI/BUI creation had
of set a log incompat bit whenever they are used (similar to the
new ATTRI stuff setting log incompat bits), then older kernels
would not have allow log recovery even if the reflink/rmap RO_COMPAT
features were set and they didn't understand them.

However, we can't do that on current kernels because then older
kernels that understand reflink/rmap just fine would see an unknown
log incompat bit and refuse to replay the log. So it comes back to
how we handle unknown ROCOMPAT flags on older kernels, not current
upstream kernels.

i.e. this patch needs to be backported to kernels that don't know
anything about RMAP/REFLINK to be useful to anyone. i.e. kernels
older than 4.9 that don't know what rmap/reflink are.  I suspect
that there are very few supported kernels that old that this might
get backported to.

Hence I wonder if this change is necessary at all.  If we can
guarantee that anything adding a new log item type to the journal
sets a LOG_INCOMPAT flag, then we don't need to change the RO_COMPAT
handling in current kernels to avoid log recovery at all - the
existing LOG_INCOMPAT flag handling will do that for us....

Yes, we can have a new feature that is RO_COMPAT + LOG_INCOMPAT; the
reflink and rmap features should have been defined this way as
that's where we went wrong. It's too late to set LOG_INCOMPAT for
them, and so the only way to fix old supported kernels is to prevent
log recovery when unknown RO_COMPAT bits are set.

Hence I don't see this solution as necessary for any kernel recent
enough to support rmap/reflink, nor do I see it necessary to protect
against making the same mistake about RO_COMPAT features in the
future. Everyone now knows that a log format change requires
LOG_INCOMPAT, not RO_COMPAT, so we should not be making that mistake
again.....

Thoughts?

-Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2023-08-25  1:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-24 23:21 [PATCHSET 0/3] xfs: fix ro mounting with unknown rocompat features Darrick J. Wong
2023-08-24 23:21 ` [PATCH 1/3] xfs: allow inode inactivation during a ro mount log recovery Darrick J. Wong
2023-08-24 23:21 ` [PATCH 2/3] xfs: don't allow log recovery when unknown rocompat bits are set Darrick J. Wong
2023-08-25  1:07   ` Dave Chinner [this message]
2023-08-25  4:04     ` Darrick J. Wong
2023-08-28 19:08       ` Darrick J. Wong
2023-08-28 21:47         ` Dave Chinner
2023-08-29  3:10           ` Darrick J. Wong
2023-08-24 23:21 ` [PATCH 3/3] xfs: log is not writable if we have unknown rocompat features Darrick J. Wong
2023-08-25  1:08   ` Dave Chinner
2023-08-24 23:27 ` [PATCH 4/3] xfs/270: actually test file readability Darrick J. Wong
2023-08-24 23:28 ` [PATCH 5/3] xfs/270: actually test log recovery with unknown rocompat features 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=ZOf+7PqbeHj1Qs3y@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=chandan.babu@gmail.com \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.