From: "Darrick J. Wong" <djwong@kernel.org>
To: Yingjie Gao <gaoyingjie@uniontech.com>
Cc: Carlos Maiolino <cem@kernel.org>,
linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] xfs: release dquot buffer after dqflush failure
Date: Thu, 25 Jun 2026 10:55:19 -0700 [thread overview]
Message-ID: <20260625175519.GF6078@frogsfrogsfrogs> (raw)
In-Reply-To: <20260625131623.3261735-1-gaoyingjie@uniontech.com>
On Thu, Jun 25, 2026 at 09:16:23PM +0800, Yingjie Gao wrote:
> xfs_qm_dqpurge() gets a locked buffer from xfs_dquot_use_attached_buf().
> If xfs_qm_dqflush() fails, the error path skips xfs_buf_relse() and then
> calls xfs_dquot_detach_buf(), which tries to lock the same buffer again.
>
> Release the buffer after xfs_qm_dqflush() returns so the error path drops
> the caller hold and unlocks the buffer before the dquot is detached,
> matching the other dqflush callers.
>
> Fixes: a40fe30868ba ("xfs: separate dquot buffer reads from xfs_dqflush")
> Cc: stable@vger.kernel.org # v6.13+
> Signed-off-by: Yingjie Gao <gaoyingjie@uniontech.com>
Looks fine, though scanning this function further, I suspect that "goto
out_funlock" in the "resurrect the refcount from the dead" isn't quite
right either.
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> fs/xfs/xfs_qm.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index aa0d2976f1c3..896b24f87ac9 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -166,10 +166,9 @@ xfs_qm_dqpurge(
> * does it on success.
> */
> error = xfs_qm_dqflush(dqp, bp);
> - if (!error) {
> + if (!error)
> error = xfs_bwrite(bp);
> - xfs_buf_relse(bp);
> - }
> + xfs_buf_relse(bp);
> xfs_dqflock(dqp);
> }
> xfs_dquot_detach_buf(dqp);
> --
> 2.20.1
>
>
next prev parent reply other threads:[~2026-06-25 17:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-25 13:16 Yingjie Gao
2026-06-25 17:55 ` Darrick J. Wong [this message]
2026-06-26 13:40 ` Yingjie Gao
2026-07-01 12:50 ` Carlos Maiolino
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=20260625175519.GF6078@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=cem@kernel.org \
--cc=gaoyingjie@uniontech.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=stable@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