Re: Re: BUG in: Driver core: convert block from raw kobjects to core devices (fwd)



Alan Stern wrote:
On Mon, 5 Nov 2007, Greg KH wrote:

On Mon, Nov 05, 2007 at 04:49:21PM -0500, Alan Stern wrote:
Greg:

So what's our status? Do you think it's worthwhile adding the
"drop reference to parent kobject at remove time instead of release
time" patch?
No.

I still need to take the time and read this thread and find the real
problem here. The fact that the issue does not show up for other,
non-scsi block devices, makes me feel this is a scsi-specific problem
with how it deals with the driver model, but I need to take the time to
sit down and figure it out for sure.

[ .. ]

Thus we have a cycle:

1&2: request_queue isn't released before scsi_device;

3: scsi_device isn't released before gendisk;

4: gendisk isn't released before request_queue.

The dependency in 1&2 is hard-coded into the SCSI core. If I
understand correctly, the core really does need the request_queue to
hang around as long as the scsi_device is still present. According to
James Bottomley, any block device driver should be expected to have a
similar requirement.

This is actually true, but as other block device drivers create the
LUN (or the equivalent thereof), the request queue, and the block device
at the same time or under control of the driver itself they don't have
this problem.
It's only due to the decoupling of the block driver from the underlying
device (ie sd driver and scsi_device) when this problem arises.

But the dependencies in 3 and 4 are unnecessary. They are artifacts,
caused by the fact that a kobject doesn't drop its reference to its
parent until it is released. If instead the reference to the parent
were dropped when the kobject was removed then 3 and 4 wouldn't apply.

And should be okay as the device isn't accessible from userland
anyway after doing a device_del(). And the implication is that it's
going to be remove soon entirely. So we're just moving the timing
of the eventual call to the ->release() function; the events will
be triggered by device_del() and won't be changed.
And if some device actually requires a reference to the parent
during ->release() it can as well acquire it manually and shouldn't
rely on the core logic to do that automatically.

Cheers,

Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@xxxxxxx +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: Re: BUG in: Driver core: convert block from raw kobjects to core devices (fwd)
    ... any block device driver should be expected to have a ... but as other block device drivers create the ... All that matters is that the block device's reference to ... If instead the reference to the parent ...
    (Linux-Kernel)
  • Re: Re: BUG in: Driver core: convert block from raw kobjects to core devices (fwd)
    ... The dependency in 1&2 is hard-coded into the SCSI core. ... but as other block device drivers create the ... at the same time or under control of the driver itself they don't have ... If instead the reference to the parent ...
    (Linux-Kernel)
  • Re: owner of class
    ... >> terminate a given object but because I've created circular reference, ... > Public Sub AttachParent ... > Then each class you need to know it's parent object can simply implement ... > Private Sub IParentTrack_AttachParent ...
    (microsoft.public.vb.general.discussion)
  • Re: Can objects be passed around as in Java?
    ... > Each oMACdefn contains oFUNCTdefn objects of class clsFUNCTdefn5A. ... > main line doesn't seem to pass me a good wsWorksheet, ... Public) object variable to retain the reference. ... Public Property Get Parent() As clsMACdefn5A ...
    (microsoft.public.excel.programming)
  • Re: Getting components name from notification parameter?
    ... >> Does Freeing it also clear the reference? ... is that the outer object has no need to know about the inner object. ... > but still demands a parent window on startup. ... TTranslate is a TComponent, not a TWinControl. ...
    (alt.comp.lang.borland-delphi)