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]
Date:	Mon, 24 Nov 2008 13:18:51 +0900
From:	Tejun Heo <tj@...nel.org>
To:	NeilBrown <neilb@...e.de>
CC:	linux-kernel@...r.kernel.org, linux-raid@...r.kernel.org,
	Al Viro <viro@...iv.linux.org.uk>,
	Doug Ledford <dledford@...hat.com>, Greg KH <greg@...ah.com>
Subject: Re: [PATCH 1/2] md: make devices disappear when they are no longer
 needed.

(cc'ing Greg)

NeilBrown wrote:
> Currently md devices, once created, never disappear until the module
> is unloaded.  This is essentially because the gendisk holds a
> reference to the mddev, and the mddev holds a reference to the
> gendisk, this a circular reference.
> 
> If we drop the reference from mddev to gendisk, then we need to ensure
> that the mddev is destroyed when the gendisk is destroyed.  However it
> is not possible to hook into the gendisk destruction process to enable
> this.
> 
> So we drop the reference from the gendisk to the mddev and destroy the
> gendisk when the mddev gets destroyed.  However this has a
> complication.
> Between the call
>    __blkdev_get->get_gendisk->kobj_lookup->md_probe
> and the call
>    __blkdev_get->md_open
> 
> there is no obvious way to hold a reference on the mddev any more, so
> unless something is done, it will disappear and gendisk will be
> destroyed prematurely.
> 
> Also, once we decide to destroy the mddev, there will be an unlockable
> moment before the gendisk is unlinked (blk_unregister_region) during
> which a new reference to the gendisk can be created.  We need to
> ensure that this reference can not be used.  i.e. the ->open must
> fail.

Ah... I'm not really sure I'm following all of this correctly but would
it be possible to just add ->release to genhd and do regular reference
counting rather than this complex dancing?  ->release was recently added
to cdev so it'll be nicely parallel.

Thanks.

-- 
tejun
--
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