From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: chandanbabu@kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 8/9] xfs: collapse the ->create_done functions
Date: Mon, 4 Dec 2023 10:51:31 -0800 [thread overview]
Message-ID: <20231204185131.GZ361584@frogsfrogsfrogs> (raw)
In-Reply-To: <20231204052403.GD26448@lst.de>
On Mon, Dec 04, 2023 at 06:24:03AM +0100, Christoph Hellwig wrote:
> > +static struct xfs_log_item *
> > +xfs_attr_create_done(
> > + struct xfs_trans *tp,
> > + struct xfs_log_item *intent,
> > + unsigned int count)
> > {
> > - struct xfs_attrd_log_item *attrdp;
> > + struct xfs_attri_log_item *attrip;
> > + struct xfs_attrd_log_item *attrdp;
> >
> > - ASSERT(tp != NULL);
> > + if (!intent)
> > + return NULL;
> > +
> > + attrip = ATTRI_ITEM(intent);
>
> How can we end up with a NULL intent here?
static struct xfs_log_item *
xfs_attr_create_intent(
struct xfs_trans *tp,
struct list_head *items,
unsigned int count,
bool sort)
{
struct xfs_mount *mp = tp->t_mountp;
struct xfs_attri_log_item *attrip;
struct xfs_attr_intent *attr;
struct xfs_da_args *args;
ASSERT(count == 1);
/*
* Each attr item only performs one attribute operation at a time, so
* this is a list of one
*/
attr = list_first_entry_or_null(items, struct xfs_attr_intent,
xattri_list);
args = attr->xattri_da_args;
>>> if (!(args->op_flags & XFS_DA_OP_LOGGED))
return NULL;
If the caller doesn't set XFS_DA_OP_LOGGED, then this function returns
NULL for "no log intent item". The LOGGED flag gets set sometimes:
int
xfs_attr_change(
struct xfs_da_args *args)
{
struct xfs_mount *mp = args->dp->i_mount;
bool use_logging = false;
int error;
ASSERT(!(args->op_flags & XFS_DA_OP_LOGGED));
if (xfs_attr_want_log_assist(mp)) {
error = xfs_attr_grab_log_assist(mp);
if (error)
return error;
>>> args->op_flags |= XFS_DA_OP_LOGGED;
use_logging = true;
}
But only on a V5 filesystem with a debug kernel and only if
xfs_globals.larp is set.
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
}
> The intent passed in is
> always ->dfp_intent and I don't think that can be NULL. No other
> implementation of ->create_done checks for it either.
If xfs_attr_create_intent returns NULL, then xfs_attr_create_done won't
create a done item either. xfs_defer_finish_one will walk through the
state machine as always, but the operation won't be restarted by
recovery since the higher level operation state was not recorded in the
log.
--D
> Otherwise looks good:
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
>
next prev parent reply other threads:[~2023-12-04 18:51 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-03 19:00 [PATCHSET 0/9] xfs: continue removing defer item boilerplate Darrick J. Wong
2023-12-03 19:02 ` [PATCH 1/9] xfs: don't set XFS_TRANS_HAS_INTENT_DONE when there's no ATTRD log item Darrick J. Wong
2023-12-04 5:08 ` Christoph Hellwig
2023-12-04 18:43 ` Darrick J. Wong
2023-12-04 19:44 ` Christoph Hellwig
2023-12-04 20:34 ` Darrick J. Wong
2023-12-03 19:03 ` [PATCH 2/9] xfs: hoist intent done flag setting to ->finish_item callsite Darrick J. Wong
2023-12-04 5:10 ` Christoph Hellwig
2023-12-03 19:03 ` [PATCH 3/9] xfs: collapse the ->finish_item helpers Darrick J. Wong
2023-12-04 5:11 ` Christoph Hellwig
2023-12-03 19:03 ` [PATCH 4/9] xfs: hoist ->create_intent boilerplate to its callsite Darrick J. Wong
2023-12-04 5:11 ` Christoph Hellwig
2023-12-03 19:04 ` [PATCH 5/9] xfs: use xfs_defer_create_done for the relogging operation Darrick J. Wong
2023-12-04 5:19 ` Christoph Hellwig
2023-12-03 19:04 ` [PATCH 6/9] xfs: clean out XFS_LI_DIRTY setting boilerplate from ->iop_relog Darrick J. Wong
2023-12-04 5:20 ` Christoph Hellwig
2023-12-03 19:04 ` [PATCH 7/9] xfs: hoist xfs_trans_add_item calls to defer ops functions Darrick J. Wong
2023-12-04 5:21 ` Christoph Hellwig
2023-12-03 19:04 ` [PATCH 8/9] xfs: collapse the ->create_done functions Darrick J. Wong
2023-12-04 5:24 ` Christoph Hellwig
2023-12-04 18:51 ` Darrick J. Wong [this message]
2023-12-04 19:46 ` Christoph Hellwig
2023-12-04 20:02 ` Darrick J. Wong
2023-12-03 19:05 ` [PATCH 9/9] xfs: move ->iop_relog to struct xfs_defer_op_type Darrick J. Wong
2023-12-04 5:25 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2023-12-07 2:22 [PATCHSET v2 0/9] xfs: continue removing defer item boilerplate Darrick J. Wong
2023-12-07 2:27 ` [PATCH 8/9] xfs: collapse the ->create_done functions 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=20231204185131.GZ361584@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=chandanbabu@kernel.org \
--cc=hch@lst.de \
--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