lkml.org 
[lkml]   [2008]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] md: make devices disappear when they are no longer needed.
On Mon, Nov 24, 2008 at 02:34:30PM +0900, Tejun Heo wrote:
> > Maybe...
> >
> > If genhd.c:disk_release called e.g.
> > disk->fops->final_put(disk)
> >
> > then I could possibly link in to that to destroy the md state when the
> > gendisk finally disappears.
> >
> > When I want to kill the gendisk I would call blk_unregister_region
> > directly (not through del_gendisk) to allow it to disappear.
> > If md_probe then gets called before the final_put, I'd need to
> > call blk_register_region again to re-install it.
> >
> > I think that would work.
> >
> > Would 'block_device_operations' be the right place for this
> > 'final_put' or 'final_release' ??
>
> I suppose so. Maybe just void (*release)(struct gendisk *) but Jens is
> the maintainer. Jens, what do you think?

First of all, release is already taken (with exactly that argument, BTW).
And doing that at freeing gendisk is a bad idea - md.ko might have been
long gone by the time you've got there, not to mention anything else...
IOW, it's too late; once the damn thing is not opened anymore (and nobody
is the middle of trying to open it), the module might be dead and gone,
so all uses of ->private_data and ->fops are illegal after that point.


\
 
 \ /
  Last update: 2008-11-24 07:27    [W:0.062 / U:0.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site