From: Hannes Reinecke <hare@suse.de>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Greg KH <greg@kroah.com>, Kay Sievers <kay.sievers@vrfy.org>,
Kernel development list <linux-kernel@vger.kernel.org>
Subject: Re: Re: BUG in: Driver core: convert block from raw kobjects to core devices (fwd)
Date: Wed, 07 Nov 2007 13:21:28 +0100 [thread overview]
Message-ID: <4731ADC8.3040208@suse.de> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0711061419090.8694-100000@iolanthe.rowland.org>
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@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
next prev parent reply other threads:[~2007-11-07 12:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1193848942.6621.18.camel@lov.site>
2007-11-05 21:49 ` BUG in: Driver core: convert block from raw kobjects to core devices (fwd) Alan Stern
2007-11-05 21:59 ` Greg KH
2007-11-06 19:49 ` Alan Stern
2007-11-07 12:21 ` Hannes Reinecke [this message]
2007-11-07 15:54 ` Alan Stern
2007-11-07 19:36 ` Kay Sievers
2007-11-07 20:00 ` Alan Stern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4731ADC8.3040208@suse.de \
--to=hare@suse.de \
--cc=greg@kroah.com \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox