From: Dave Chinner <david@fromorbit.com>
To: Brian Foster <bfoster@redhat.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs: fix xfs_ifree() error handling to not leak perag ref
Date: Sat, 28 May 2022 08:42:58 +1000 [thread overview]
Message-ID: <20220527224258.GU1098723@dread.disaster.area> (raw)
In-Reply-To: <20220527133428.2291945-1-bfoster@redhat.com>
On Fri, May 27, 2022 at 09:34:28AM -0400, Brian Foster wrote:
> For some reason commit 9a5280b312e2e ("xfs: reorder iunlink remove
> operation in xfs_ifree") replaced a jump to the exit path in the
> event of an xfs_difree() error with a direct return, which skips
Reason: the patchset that the fix was promoted from had moved all
the pag handling out of xfs_ifree to the caller, so direct return
was, in fact, the correct behaviour in the code it originated from.
The patch applied to upstream with no errors or fuzz, and I had
completely forgotten that somewhere in the ~50 patches in the stack
before that fix had completely reworked unlink pag handling...
How did you find this? I haven't noticed any specific increase in
unmount perag accounting leaks as a result of this, so I'm curious
as to how you noticed it and isolated it to this specific bug.
> Restore the original code to drop the reference on error.
>
> Fixes: 9a5280b312e2e ("xfs: reorder iunlink remove operation in xfs_ifree")
> Signed-off-by: Brian Foster <bfoster@redhat.com>
> ---
> fs/xfs/xfs_inode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index b2879870a17e..52d6f2c7d58b 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -2622,7 +2622,7 @@ xfs_ifree(
> */
> error = xfs_difree(tp, pag, ip->i_ino, &xic);
> if (error)
> - return error;
> + goto out;
Looks good,
Reviewed-by: Dave Chinner <dchinner@redhat.com>
--
Dave Chinner
david@fromorbit.com
prev parent reply other threads:[~2022-05-27 22:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-27 13:34 [PATCH] xfs: fix xfs_ifree() error handling to not leak perag ref Brian Foster
2022-05-27 16:12 ` Darrick J. Wong
2022-05-27 22:42 ` Dave Chinner [this message]
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=20220527224258.GU1098723@dread.disaster.area \
--to=david@fromorbit.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