]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
xfs: release dquot buffer after dqflush failure
authorYingjie Gao <gaoyingjie@uniontech.com>
Thu, 25 Jun 2026 13:16:23 +0000 (21:16 +0800)
committerCarlos Maiolino <cem@kernel.org>
Wed, 1 Jul 2026 09:35:50 +0000 (11:35 +0200)
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>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_qm.c

index aa0d2976f1c3f8b72b22cf0bfb136239839794ed..896b24f87ac9d5563779b5b049ab8b01efaa28c5 100644 (file)
@@ -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);