public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Chinner <dgc@sgi.com>
To: Christoph Hellwig <hch@lst.de>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 4/10] sort out opening and closing of the block devices
Date: Mon, 12 May 2008 12:04:21 +1000	[thread overview]
Message-ID: <20080512020421.GW155679365@sgi.com> (raw)
In-Reply-To: <20080501220105.GD2315@lst.de>

On Fri, May 02, 2008 at 12:01:05AM +0200, Christoph Hellwig wrote:
> +STATIC int
> +xfs_open_devices(
> +	struct xfs_mount	*mp,
> +	struct xfs_mount_args	*args)
> +{
> +	struct block_device	*ddev = mp->m_super->s_bdev;
> +	struct block_device	*logdev = NULL, *rtdev = NULL;
> +	int			error;
> +
> +	/*
> +	 * Open real time and log devices - order is important.
> +	 */
> +	if (args->logname[0]) {
> +		error = xfs_blkdev_get(mp, args->logname, &logdev);
> +		if (error)
> +			goto out;
> +	}
> +
> +	if (args->rtname[0]) {
> +		error = xfs_blkdev_get(mp, args->rtname, &rtdev);
> +		if (error)
> +			goto out_close_logdev;
> +
> +		if (rtdev == ddev || rtdev == logdev) {
> +			cmn_err(CE_WARN,
> +	"XFS: Cannot mount filesystem with identical rtdev and ddev/logdev.");

error needs to be set to something here.

> +			goto out_close_rtdev;
> +		}
> +	}
> +
> +	/*
> +	 * Setup xfs_mount buffer target pointers
> +	 */
> +	error = ENOMEM;
> +	mp->m_ddev_targp = xfs_alloc_buftarg(ddev, 0);
> +	if (!mp->m_ddev_targp)
> +		goto out_close_rtdev;
> +
> +	if (rtdev) {
> +		mp->m_rtdev_targp = xfs_alloc_buftarg(rtdev, 1);
> +		if (!mp->m_rtdev_targp)
> +			goto out_free_ddev_targ;
> +	}
> +
> +	if (logdev && logdev != ddev) {
> +		mp->m_logdev_targp = xfs_alloc_buftarg(logdev, 1);
> +		if (!mp->m_logdev_targp)
> +			goto out_free_rtdev_targ;
> +	} else {
> +		mp->m_logdev_targp = mp->m_ddev_targp;
> +	}
> +
> +	return 0;
> +
> + out_free_rtdev_targ:
> +	if (mp->m_rtdev_targp)
> +		xfs_free_buftarg(mp->m_rtdev_targp);
> + out_free_ddev_targ:
> +	xfs_free_buftarg(mp->m_ddev_targp);
> + out_close_rtdev:
> +	if (mp->m_rtdev_targp)
> +		xfs_blkdev_put(mp->m_rtdev_targp->bt_bdev);

And that looks broken - we either haven't allocated m_rtdev_targp
yet or we've freed it above.

incremental patch to fix is fine...

Cheers,

Dave.
-- 
Dave Chinner
Principal Engineer
SGI Australian Software Group

  reply	other threads:[~2008-05-12  2:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-01 22:01 [PATCH 4/10] sort out opening and closing of the block devices Christoph Hellwig
2008-05-12  2:04 ` David Chinner [this message]
2008-05-12  6:02   ` Christoph Hellwig

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=20080512020421.GW155679365@sgi.com \
    --to=dgc@sgi.com \
    --cc=hch@lst.de \
    --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