lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101104150657.GB32504@redhat.com>
Date:	Thu, 4 Nov 2010 11:06:58 -0400
From:	Mike Snitzer <snitzer@...hat.com>
To:	device-mapper development <dm-devel@...hat.com>
Cc:	axboe@...nel.dk, hch@...radead.org, linux-kernel@...r.kernel.org,
	petero2@...ia.com, schwidefsky@...ibm.com,
	heiko.carstens@...ibm.com, jack@...e.cz, akpm@...ux-foundation.org,
	adilger.kernel@...ger.ca, tytso@....edu, mfasheh@...e.com,
	joel.becker@...cle.com, aelder@....com, drbd-dev@...ts.linbit.com,
	neilb@...e.de, leochen@...adcom.com, sbranden@...adcom.com,
	chris.mason@...cle.com, swhiteho@...hat.com,
	shaggy@...ux.vnet.ibm.com, joern@...fs.org,
	konishi.ryusuke@....ntt.co.jp, reiserfs-devel@...r.kernel.org,
	viro@...iv.linux.org.uk, Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH 3/5] block: simplify holder symlink handling

On Mon, Nov 01 2010 at 12:15pm -0400,
Tejun Heo <tj@...nel.org> wrote:

> Code to manage symlinks in /sys/block/*/{holders|slaves} are overly
> complex with multiple holder considerations, redundant extra
> references to all involved kobjects, unused generic kobject holder
> support and unnecessary mixup with bd_claim/release functionalities.
> 
> Strip it down to what's necessary (single gendisk holder) and make it
> use a separate interface.  This is a step for cleaning up
> bd_claim/release.  This patch makes dm-table slightly more complex but
> it will be simplified again with further changes.
> 
> Signed-off-by: Tejun Heo <tj@...nel.org>
> Cc: Neil Brown <neilb@...e.de>
> Cc: dm-devel@...hat.com

Acked-by: Mike Snitzer <snitzer@...hat.com>

> ---
>  drivers/md/dm-table.c |   23 +++-
>  drivers/md/md.c       |    4 +-
>  fs/block_dev.c        |  322 +++++++------------------------------------------
>  include/linux/fs.h    |   16 ++-
>  4 files changed, 74 insertions(+), 291 deletions(-)
> 
> diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
> index 90267f8..2c876ff 100644
> --- a/drivers/md/dm-table.c
> +++ b/drivers/md/dm-table.c
> @@ -328,12 +328,22 @@ static int open_dev(struct dm_dev_internal *d, dev_t dev,
>  	bdev = open_by_devnum(dev, d->dm_dev.mode);
>  	if (IS_ERR(bdev))
>  		return PTR_ERR(bdev);
> -	r = bd_claim_by_disk(bdev, _claim_ptr, dm_disk(md));
> -	if (r)
> +
> +	r = bd_claim(bdev, _claim_ptr);
> +	if (r) {
>  		blkdev_put(bdev, d->dm_dev.mode);
> -	else
> -		d->dm_dev.bdev = bdev;
> -	return r;
> +		return r;
> +	}
> +
> +	r = bd_link_disk_holder(bdev, dm_disk(md));
> +	if (r) {
> +		bd_release(bdev);
> +		blkdev_put(bdev, d->dm_dev.mode);
> +		return r;
> +	}
> +
> +	d->dm_dev.bdev = bdev;
> +	return 0;
>  }
>  
>  /*
> @@ -344,7 +354,8 @@ static void close_dev(struct dm_dev_internal *d, struct mapped_device *md)
>  	if (!d->dm_dev.bdev)
>  		return;
>  
> -	bd_release_from_disk(d->dm_dev.bdev, dm_disk(md));
> +	bd_unlink_disk_holder(d->dm_dev.bdev);
> +	bd_release(d->dm_dev.bdev);
>  	blkdev_put(d->dm_dev.bdev, d->dm_dev.mode);
>  	d->dm_dev.bdev = NULL;
>  }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ