From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 7/7] split up xlog_recover_process_iunlinks
Date: Tue, 28 Oct 2008 18:17:50 +1100 [thread overview]
Message-ID: <20081028071750.GV4985@disturbed> (raw)
In-Reply-To: <20081027133938.GH1109@infradead.org>
On Mon, Oct 27, 2008 at 09:39:38AM -0400, Christoph Hellwig wrote:
> Split out the body of the main loop into a separate helper to make the
> code readable.
>
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
.....
> Index: linux-2.6-xfs/fs/xfs/xfs_log_recover.c
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/xfs_log_recover.c 2008-10-25 13:22:29.000000000 +0200
> +++ linux-2.6-xfs/fs/xfs/xfs_log_recover.c 2008-10-25 13:26:44.000000000 +0200
> @@ -3147,6 +3147,70 @@ out_error:
> return;
> }
>
> +STATIC xfs_agino_t
> +xlog_recover_process_one_iunlink(
> + struct xfs_mount *mp,
> + xfs_agnumber_t agno,
> + xfs_agino_t agino,
> + int bucket)
> +{
> + struct xfs_buf *ibp;
> + struct xfs_dinode *dip;
> + struct xfs_inode *ip;
> + xfs_ino_t ino;
> + int error;
> +
> + ino = XFS_AGINO_TO_INO(mp, agno, agino);
> + error = xfs_iget(mp, NULL, ino, 0, 0, &ip, 0);
> + if (error)
> + goto fail;
> +
> + /*
> + * Get the on disk inode to find the next inode in the bucket.
> + */
> + ASSERT(ip != NULL);
> + error = xfs_itobp(mp, NULL, ip, &dip, &ibp, 0, 0, XFS_BUF_LOCK);
> + if (error)
> + goto fail;
Jumping to 'fail' at this point leaks the xfs_inode returned from
xfs_iget(). Hmmmm - it appears the original code leaked too....
Also, I don't think we need the assert for ip, either. If it's NULL
then we'll panic immediately on entering xfs_itobp().
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2008-10-28 7:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-27 13:39 [PATCH 7/7] split up xlog_recover_process_iunlinks Christoph Hellwig
2008-10-28 7:17 ` Dave Chinner [this message]
2008-10-28 9:14 ` Christoph Hellwig
2008-10-28 21:51 ` Dave Chinner
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=20081028071750.GV4985@disturbed \
--to=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=xfs@oss.sgi.com \
/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