From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Allison Henderson <allison.henderson@oracle.com>,
xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH 1/2] xfs: fix TOCTOU race involving the new logged xattrs control knob
Date: Mon, 6 Jun 2022 11:25:31 +1000 [thread overview]
Message-ID: <20220606012531.GP1098723@dread.disaster.area> (raw)
In-Reply-To: <Yp1FjrXqwcAgMYg/@magnolia>
On Sun, Jun 05, 2022 at 05:08:46PM -0700, Darrick J. Wong wrote:
> On Mon, Jun 06, 2022 at 08:47:43AM +1000, Dave Chinner wrote:
> > On Sun, Jun 05, 2022 at 09:37:01AM -0700, Darrick J. Wong wrote:
> > > --- a/fs/xfs/xfs_xattr.c
> > > +++ b/fs/xfs/xfs_xattr.c
> > > @@ -68,6 +68,18 @@ xfs_attr_rele_log_assist(
> > > xlog_drop_incompat_feat(mp->m_log);
> > > }
> > >
> > > +#ifdef DEBUG
> > > +static inline bool
> > > +xfs_attr_want_log_assist(
> > > + struct xfs_mount *mp)
> > > +{
> > > + /* Logged xattrs require a V5 super for log_incompat */
> > > + return xfs_has_crc(mp) && xfs_globals.larp;
> > > +}
> > > +#else
> > > +# define xfs_attr_want_log_assist(mp) false
> > > +#endif
> >
> > If you are moving this code, let's clean it up a touch so that it
> > is the internal logic that is conditional, not the function itself.
> >
> > static inline bool
> > xfs_attr_want_log_assist(
> > struct xfs_mount *mp)
> > {
> > #ifdef DEBUG
> > /* Logged xattrs require a V5 super for log_incompat */
> > return xfs_has_crc(mp) && xfs_globals.larp;
> > #else
> > return false;
> > #endif
> > }
>
> I don't mind turning this into a straight function move. I'd figured
> that Linus' style preference is usually against putting conditional
> compilation inside functions, but for a static inline I really don't
> care either way.
Well, for conditional helper functions, having the static inline for
type checking in all builds is better than having a macro that makes
it go away silently when those build options are not turned on.
Better would probably be:
if (!IS_ENABLED(CONFIG_XFS_DEBUG))
return false;
/* Logged xattrs require a V5 super for log_incompat */
return xfs_has_crc(mp) && xfs_globals.larp;
And all the ifdef mess goes away at that point.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
prev parent reply other threads:[~2022-06-06 1:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-05 16:37 [PATCH 1/2] xfs: fix TOCTOU race involving the new logged xattrs control knob Darrick J. Wong
2022-06-05 16:40 ` [PATCH 2/2] xfs: fix variable state usage " Darrick J. Wong
2022-06-05 22:26 ` Dave Chinner
2022-06-05 22:47 ` [PATCH 1/2] xfs: fix TOCTOU race involving the new logged xattrs " Dave Chinner
2022-06-06 0:08 ` Darrick J. Wong
2022-06-06 1:25 ` Dave Chinner [this message]
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=20220606012531.GP1098723@dread.disaster.area \
--to=david@fromorbit.com \
--cc=allison.henderson@oracle.com \
--cc=djwong@kernel.org \
--cc=linux-xfs@vger.kernel.org \
/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