From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Brian Foster <bfoster@redhat.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/2] xfs: trylock underlying buffer on dquot flush
Date: Fri, 27 Mar 2020 08:45:28 -0700 [thread overview]
Message-ID: <20200327154527.GJ29339@magnolia> (raw)
In-Reply-To: <20200326131703.23246-2-bfoster@redhat.com>
On Thu, Mar 26, 2020 at 09:17:02AM -0400, Brian Foster wrote:
> A dquot flush currently blocks on the buffer lock for the underlying
> dquot buffer. In turn, this causes xfsaild to block rather than
> continue processing other items in the meantime. Update
> xfs_qm_dqflush() to trylock the buffer, similar to how inode buffers
> are handled, and return -EAGAIN if the lock fails. Fix up any
> callers that don't currently handle the error properly.
>
> Signed-off-by: Brian Foster <bfoster@redhat.com>
Is xfs_qm_dquot_isolate returning LRU_RETRY an acceptable resolution (as
opposed to, say, LRU_SKIP) for xfs_qm_dqflush returning -EAGAIN?
--D
> ---
> fs/xfs/xfs_dquot.c | 6 +++---
> fs/xfs/xfs_dquot_item.c | 3 ++-
> fs/xfs/xfs_qm.c | 14 +++++++++-----
> 3 files changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
> index 711376ca269f..af2c8e5ceea0 100644
> --- a/fs/xfs/xfs_dquot.c
> +++ b/fs/xfs/xfs_dquot.c
> @@ -1105,8 +1105,8 @@ xfs_qm_dqflush(
> * Get the buffer containing the on-disk dquot
> */
> error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dqp->q_blkno,
> - mp->m_quotainfo->qi_dqchunklen, 0, &bp,
> - &xfs_dquot_buf_ops);
> + mp->m_quotainfo->qi_dqchunklen, XBF_TRYLOCK,
> + &bp, &xfs_dquot_buf_ops);
> if (error)
> goto out_unlock;
>
> @@ -1177,7 +1177,7 @@ xfs_qm_dqflush(
>
> out_unlock:
> xfs_dqfunlock(dqp);
> - return -EIO;
> + return error;
> }
>
> /*
> diff --git a/fs/xfs/xfs_dquot_item.c b/fs/xfs/xfs_dquot_item.c
> index cf65e2e43c6e..baad1748d0d1 100644
> --- a/fs/xfs/xfs_dquot_item.c
> +++ b/fs/xfs/xfs_dquot_item.c
> @@ -189,7 +189,8 @@ xfs_qm_dquot_logitem_push(
> if (!xfs_buf_delwri_queue(bp, buffer_list))
> rval = XFS_ITEM_FLUSHING;
> xfs_buf_relse(bp);
> - }
> + } else if (error == -EAGAIN)
> + rval = XFS_ITEM_LOCKED;
>
> spin_lock(&lip->li_ailp->ail_lock);
> out_unlock:
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index de1d2c606c14..68c778d25c48 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -121,12 +121,11 @@ xfs_qm_dqpurge(
> {
> struct xfs_mount *mp = dqp->q_mount;
> struct xfs_quotainfo *qi = mp->m_quotainfo;
> + int error = -EAGAIN;
>
> xfs_dqlock(dqp);
> - if ((dqp->dq_flags & XFS_DQ_FREEING) || dqp->q_nrefs != 0) {
> - xfs_dqunlock(dqp);
> - return -EAGAIN;
> - }
> + if ((dqp->dq_flags & XFS_DQ_FREEING) || dqp->q_nrefs != 0)
> + goto out_unlock;
>
> dqp->dq_flags |= XFS_DQ_FREEING;
>
> @@ -139,7 +138,6 @@ xfs_qm_dqpurge(
> */
> if (XFS_DQ_IS_DIRTY(dqp)) {
> struct xfs_buf *bp = NULL;
> - int error;
>
> /*
> * We don't care about getting disk errors here. We need
> @@ -149,6 +147,8 @@ xfs_qm_dqpurge(
> if (!error) {
> error = xfs_bwrite(bp);
> xfs_buf_relse(bp);
> + } else if (error == -EAGAIN) {
> + goto out_unlock;
> }
> xfs_dqflock(dqp);
> }
> @@ -174,6 +174,10 @@ xfs_qm_dqpurge(
>
> xfs_qm_dqdestroy(dqp);
> return 0;
> +
> +out_unlock:
> + xfs_dqunlock(dqp);
> + return error;
> }
>
> /*
> --
> 2.21.1
>
next prev parent reply other threads:[~2020-03-27 15:47 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-26 13:17 [PATCH 0/2] xfs: a couple AIL pushing trylock fixes Brian Foster
2020-03-26 13:17 ` [PATCH 1/2] xfs: trylock underlying buffer on dquot flush Brian Foster
2020-03-27 12:59 ` Christoph Hellwig
2020-03-27 15:45 ` Darrick J. Wong [this message]
2020-03-27 16:44 ` Brian Foster
2020-03-27 16:46 ` Brian Foster
2020-03-27 17:04 ` Darrick J. Wong
2020-03-27 16:50 ` Darrick J. Wong
2020-03-29 22:46 ` Dave Chinner
2020-03-29 23:01 ` Dave Chinner
2020-03-30 12:15 ` Brian Foster
2020-03-31 0:04 ` Dave Chinner
2020-03-31 11:46 ` Brian Foster
2020-03-26 13:17 ` [PATCH 2/2] xfs: return locked status of inode buffer on xfsaild push Brian Foster
2020-03-27 13:00 ` Christoph Hellwig
2020-03-27 15:39 ` Darrick J. Wong
2020-03-27 15:32 ` [PATCH 0/2] xfs: a couple AIL pushing trylock fixes Darrick J. Wong
2020-03-27 16:44 ` Brian Foster
2020-03-29 16:43 ` 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=20200327154527.GJ29339@magnolia \
--to=darrick.wong@oracle.com \
--cc=bfoster@redhat.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