From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH v3 10/17] xfs: acquire ->ail_lock from xfs_trans_ail_delete()
Date: Fri, 1 May 2020 07:25:21 -0400 [thread overview]
Message-ID: <20200501112521.GD40250@bfoster> (raw)
In-Reply-To: <20200430185250.GK6742@magnolia>
On Thu, Apr 30, 2020 at 11:52:50AM -0700, Darrick J. Wong wrote:
> On Wed, Apr 29, 2020 at 01:21:46PM -0400, Brian Foster wrote:
> > Several callers acquire the lock just prior to the call. Callers
> > that require ->ail_lock for other purposes already check IN_AIL
> > state and thus don't require the additional shutdown check in the
> > helper. Push the lock down into xfs_trans_ail_delete(), open code
> > the instances that still acquire it, and remove the unnecessary ailp
> > parameter.
> >
> > Signed-off-by: Brian Foster <bfoster@redhat.com>
>
> Ahh, this and the next few patches are a split of a larger patch from
> the last posting. So I guess the point of this is to reduce parameter
> passing and get rid of the SHUTDOWN_* flags?
>
Yeah, the point is just to simplify and ultimately combine these two odd
helpers into one. It was originally easier for me to work it all out in
one change/patch, but Christoph preferred to see it split up. Ultimately
it's easier for a reviewer to squash multiple simple patches than take a
potentially confusing one apart, so I broke it back out into these 3 or
4...
Brian
> Looks decent to me, regardless...
>
> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
>
> --D
>
> > ---
> > fs/xfs/xfs_buf_item.c | 27 +++++++++++----------------
> > fs/xfs/xfs_dquot.c | 6 ++++--
> > fs/xfs/xfs_trans_ail.c | 3 ++-
> > fs/xfs/xfs_trans_priv.h | 14 ++++++++------
> > 4 files changed, 25 insertions(+), 25 deletions(-)
> >
> > diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
> > index 1f7acffc99ba..06e306b49283 100644
> > --- a/fs/xfs/xfs_buf_item.c
> > +++ b/fs/xfs/xfs_buf_item.c
> > @@ -410,7 +410,6 @@ xfs_buf_item_unpin(
> > {
> > struct xfs_buf_log_item *bip = BUF_ITEM(lip);
> > xfs_buf_t *bp = bip->bli_buf;
> > - struct xfs_ail *ailp = lip->li_ailp;
> > int stale = bip->bli_flags & XFS_BLI_STALE;
> > int freed;
> >
> > @@ -452,10 +451,10 @@ xfs_buf_item_unpin(
> > }
> >
> > /*
> > - * If we get called here because of an IO error, we may
> > - * or may not have the item on the AIL. xfs_trans_ail_delete()
> > - * will take care of that situation.
> > - * xfs_trans_ail_delete() drops the AIL lock.
> > + * If we get called here because of an IO error, we may or may
> > + * not have the item on the AIL. xfs_trans_ail_delete() will
> > + * take care of that situation. xfs_trans_ail_delete() drops
> > + * the AIL lock.
> > */
> > if (bip->bli_flags & XFS_BLI_STALE_INODE) {
> > xfs_buf_do_callbacks(bp);
> > @@ -463,8 +462,7 @@ xfs_buf_item_unpin(
> > list_del_init(&bp->b_li_list);
> > bp->b_iodone = NULL;
> > } else {
> > - spin_lock(&ailp->ail_lock);
> > - xfs_trans_ail_delete(ailp, lip, SHUTDOWN_LOG_IO_ERROR);
> > + xfs_trans_ail_delete(lip, SHUTDOWN_LOG_IO_ERROR);
> > xfs_buf_item_relse(bp);
> > ASSERT(bp->b_log_item == NULL);
> > }
> > @@ -1205,22 +1203,19 @@ xfs_buf_iodone(
> > struct xfs_buf *bp,
> > struct xfs_log_item *lip)
> > {
> > - struct xfs_ail *ailp = lip->li_ailp;
> > -
> > ASSERT(BUF_ITEM(lip)->bli_buf == bp);
> >
> > xfs_buf_rele(bp);
> >
> > /*
> > - * If we are forcibly shutting down, this may well be
> > - * off the AIL already. That's because we simulate the
> > - * log-committed callbacks to unpin these buffers. Or we may never
> > - * have put this item on AIL because of the transaction was
> > - * aborted forcibly. xfs_trans_ail_delete() takes care of these.
> > + * If we are forcibly shutting down, this may well be off the AIL
> > + * already. That's because we simulate the log-committed callbacks to
> > + * unpin these buffers. Or we may never have put this item on AIL
> > + * because of the transaction was aborted forcibly.
> > + * xfs_trans_ail_delete() takes care of these.
> > *
> > * Either way, AIL is useless if we're forcing a shutdown.
> > */
> > - spin_lock(&ailp->ail_lock);
> > - xfs_trans_ail_delete(ailp, lip, SHUTDOWN_CORRUPT_INCORE);
> > + xfs_trans_ail_delete(lip, SHUTDOWN_CORRUPT_INCORE);
> > xfs_buf_item_free(BUF_ITEM(lip));
> > }
> > diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
> > index ffe607733c50..5fb65f43b980 100644
> > --- a/fs/xfs/xfs_dquot.c
> > +++ b/fs/xfs/xfs_dquot.c
> > @@ -1021,6 +1021,7 @@ xfs_qm_dqflush_done(
> > struct xfs_dq_logitem *qip = (struct xfs_dq_logitem *)lip;
> > struct xfs_dquot *dqp = qip->qli_dquot;
> > struct xfs_ail *ailp = lip->li_ailp;
> > + xfs_lsn_t tail_lsn;
> >
> > /*
> > * We only want to pull the item from the AIL if its
> > @@ -1034,10 +1035,11 @@ xfs_qm_dqflush_done(
> > ((lip->li_lsn == qip->qli_flush_lsn) ||
> > test_bit(XFS_LI_FAILED, &lip->li_flags))) {
> >
> > - /* xfs_trans_ail_delete() drops the AIL lock. */
> > spin_lock(&ailp->ail_lock);
> > if (lip->li_lsn == qip->qli_flush_lsn) {
> > - xfs_trans_ail_delete(ailp, lip, SHUTDOWN_CORRUPT_INCORE);
> > + /* xfs_ail_update_finish() drops the AIL lock */
> > + tail_lsn = xfs_ail_delete_one(ailp, lip);
> > + xfs_ail_update_finish(ailp, tail_lsn);
> > } else {
> > /*
> > * Clear the failed state since we are about to drop the
> > diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
> > index 2574d01e4a83..cfba691664c7 100644
> > --- a/fs/xfs/xfs_trans_ail.c
> > +++ b/fs/xfs/xfs_trans_ail.c
> > @@ -864,13 +864,14 @@ xfs_ail_delete_one(
> > */
> > void
> > xfs_trans_ail_delete(
> > - struct xfs_ail *ailp,
> > struct xfs_log_item *lip,
> > int shutdown_type)
> > {
> > + struct xfs_ail *ailp = lip->li_ailp;
> > struct xfs_mount *mp = ailp->ail_mount;
> > xfs_lsn_t tail_lsn;
> >
> > + spin_lock(&ailp->ail_lock);
> > if (!test_bit(XFS_LI_IN_AIL, &lip->li_flags)) {
> > spin_unlock(&ailp->ail_lock);
> > if (!XFS_FORCED_SHUTDOWN(mp)) {
> > diff --git a/fs/xfs/xfs_trans_priv.h b/fs/xfs/xfs_trans_priv.h
> > index 35655eac01a6..e4362fb8d483 100644
> > --- a/fs/xfs/xfs_trans_priv.h
> > +++ b/fs/xfs/xfs_trans_priv.h
> > @@ -94,8 +94,7 @@ xfs_trans_ail_update(
> > xfs_lsn_t xfs_ail_delete_one(struct xfs_ail *ailp, struct xfs_log_item *lip);
> > void xfs_ail_update_finish(struct xfs_ail *ailp, xfs_lsn_t old_lsn)
> > __releases(ailp->ail_lock);
> > -void xfs_trans_ail_delete(struct xfs_ail *ailp, struct xfs_log_item *lip,
> > - int shutdown_type);
> > +void xfs_trans_ail_delete(struct xfs_log_item *lip, int shutdown_type);
> >
> > static inline void
> > xfs_trans_ail_remove(
> > @@ -103,13 +102,16 @@ xfs_trans_ail_remove(
> > int shutdown_type)
> > {
> > struct xfs_ail *ailp = lip->li_ailp;
> > + xfs_lsn_t tail_lsn;
> >
> > spin_lock(&ailp->ail_lock);
> > - /* xfs_trans_ail_delete() drops the AIL lock */
> > - if (test_bit(XFS_LI_IN_AIL, &lip->li_flags))
> > - xfs_trans_ail_delete(ailp, lip, shutdown_type);
> > - else
> > + /* xfs_ail_update_finish() drops the AIL lock */
> > + if (test_bit(XFS_LI_IN_AIL, &lip->li_flags)) {
> > + tail_lsn = xfs_ail_delete_one(ailp, lip);
> > + xfs_ail_update_finish(ailp, tail_lsn);
> > + } else {
> > spin_unlock(&ailp->ail_lock);
> > + }
> > }
> >
> > void xfs_ail_push(struct xfs_ail *, xfs_lsn_t);
> > --
> > 2.21.1
> >
>
next prev parent reply other threads:[~2020-05-01 11:25 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-29 17:21 [PATCH v3 00/17] xfs: flush related error handling cleanups Brian Foster
2020-04-29 17:21 ` [PATCH v3 01/17] xfs: refactor failed buffer resubmission into xfsaild Brian Foster
2020-04-30 17:26 ` Darrick J. Wong
2020-04-29 17:21 ` [PATCH v3 02/17] xfs: factor out buffer I/O failure code Brian Foster
2020-04-30 18:16 ` Darrick J. Wong
2020-05-01 7:43 ` Christoph Hellwig
2020-04-29 17:21 ` [PATCH v3 03/17] xfs: simplify inode flush error handling Brian Foster
2020-04-30 18:37 ` Darrick J. Wong
2020-05-01 9:17 ` Christoph Hellwig
2020-05-01 10:17 ` Christoph Hellwig
2020-05-01 17:43 ` Darrick J. Wong
2020-05-01 17:50 ` Christoph Hellwig
2020-05-01 11:22 ` Brian Foster
2020-04-29 17:21 ` [PATCH v3 04/17] xfs: remove unnecessary shutdown check from xfs_iflush() Brian Foster
2020-04-30 18:37 ` Darrick J. Wong
2020-04-29 17:21 ` [PATCH v3 05/17] xfs: reset buffer write failure state on successful completion Brian Foster
2020-04-30 18:41 ` Darrick J. Wong
2020-05-01 7:44 ` Christoph Hellwig
2020-04-29 17:21 ` [PATCH v3 06/17] xfs: refactor ratelimited buffer error messages into helper Brian Foster
2020-04-30 18:42 ` Darrick J. Wong
2020-05-01 7:44 ` Christoph Hellwig
2020-04-29 17:21 ` [PATCH v3 07/17] xfs: ratelimit unmount time per-buffer I/O error alert Brian Foster
2020-04-30 18:43 ` Darrick J. Wong
2020-04-30 22:07 ` Dave Chinner
2020-05-01 11:24 ` Brian Foster
2020-05-01 7:48 ` Christoph Hellwig
2020-04-29 17:21 ` [PATCH v3 08/17] xfs: fix duplicate verification from xfs_qm_dqflush() Brian Foster
2020-04-30 18:45 ` Darrick J. Wong
2020-05-01 11:24 ` Brian Foster
2020-04-29 17:21 ` [PATCH v3 09/17] xfs: abort consistently on dquot flush failure Brian Foster
2020-04-30 18:46 ` Darrick J. Wong
2020-04-29 17:21 ` [PATCH v3 10/17] xfs: acquire ->ail_lock from xfs_trans_ail_delete() Brian Foster
2020-04-30 18:52 ` Darrick J. Wong
2020-05-01 11:25 ` Brian Foster [this message]
2020-05-01 7:50 ` Christoph Hellwig
2020-04-29 17:21 ` [PATCH v3 11/17] xfs: use delete helper for items expected to be in AIL Brian Foster
2020-04-30 18:54 ` Darrick J. Wong
2020-05-01 7:56 ` Christoph Hellwig
2020-04-29 17:21 ` [PATCH v3 12/17] xfs: drop unused shutdown parameter from xfs_trans_ail_remove() Brian Foster
2020-04-30 18:56 ` Darrick J. Wong
2020-05-01 7:57 ` Christoph Hellwig
2020-04-29 17:21 ` [PATCH v3 13/17] xfs: combine xfs_trans_ail_[remove|delete]() Brian Foster
2020-04-30 18:58 ` Darrick J. Wong
2020-05-01 8:01 ` Christoph Hellwig
2020-05-01 8:00 ` Christoph Hellwig
2020-05-01 11:25 ` Brian Foster
2020-04-29 17:21 ` [PATCH v3 14/17] xfs: remove unused iflush stale parameter Brian Foster
2020-04-30 18:58 ` Darrick J. Wong
2020-04-29 17:21 ` [PATCH v3 15/17] xfs: random buffer write failure errortag Brian Foster
2020-04-30 18:59 ` Darrick J. Wong
2020-05-01 8:02 ` Christoph Hellwig
2020-04-29 17:21 ` [PATCH v3 16/17] xfs: remove unused shutdown types Brian Foster
2020-04-30 18:59 ` Darrick J. Wong
2020-04-29 17:21 ` [PATCH v3 17/17] xfs: remove unused iget_flags param from xfs_imap_to_bp() Brian Foster
2020-04-30 19:00 ` Darrick J. Wong
2020-05-01 8:03 ` Christoph Hellwig
2020-05-01 11:25 ` Brian Foster
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=20200501112521.GD40250@bfoster \
--to=bfoster@redhat.com \
--cc=darrick.wong@oracle.com \
--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;
as well as URLs for NNTP newsgroup(s).