Re: [PATCH] update sd to use kref and fix open/release race

viro
2004-04-22T06:56:04Z

On Wed, Apr 21, 2004 at 10:57:45PM -0700, Mike Anderson wrote:
> James Bottomley [James.Bottomley@SteelEye.com] wrote:
> > The slight problem in all this is that the module refcounting model is
> > different from the device one (in modules, you can't send a deletion
> > (rmmod) unless your "ref" count is zero).
> >
> > The best fix would be to move the module model over to the device model.
> > So you can rmmod at any point, removal triggers the appropriate
> > scsi_remove_device etc calls and the rmmod command hangs around until
> > it's safe to remove the module ... for SCSI we could do this before the
> > device references are dropped because there's a point where we can
> > guarantee no more commands will be sent to the host adapter.

Or we could just admit that there is more to life than a plain refcount.

> Yes it would be good to convert the module model someday. We already
> allow today to hot unplug an adapter with the module ref count positive
> and cover almost the same code paths as a rmmod.

I bow to your stunning power of observation. Of *course* all modules are
like that - so obviously that it would be an unpardonable waste of time to
explore what else might be out there. If some isolated pathological cases
do not fit that model, they are better off broken, really.

Sheesh...