linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luben Tuikov <luben_tuikov@adaptec.com>
To: James Bottomley <James.Bottomley@SteelEye.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	Mike Anderson <andmike@us.ibm.com>,
	SCSI development list <linux-scsi@vger.kernel.org>
Subject: Re: Synchronizing scsi_remove_host and the error handler
Date: Mon, 08 Aug 2005 14:24:04 -0400	[thread overview]
Message-ID: <42F7A344.8070905@adaptec.com> (raw)
In-Reply-To: <1123451837.5020.22.camel@mulgrave>

On 08/07/05 17:57, James Bottomley wrote:
> Alan Stern wrote:
>>The only resource that matters for this discussion is associated with the
>>LLD itself, not with any of its hosts: the host template.  Once the SCSI
>>core has released all references to the template, it can't call the LLD
>>any more.  The problem is that the LLD has no way to know when all the
>>references have been dropped.  This suggests that the entire problem could
>>be solved by adding a kref to struct scsi_host_template.
>>
>>Would you agree to a patch adding such a kref?
> 
> 
> Well, not really.  The host template usually exists as a variable in the
> module, so its lifetime is tied to the lifetime of the module.  Adding a
> kref wouldn't help because it will still be freed when the module is
> removed.  If there's a case where the template is being freed
> prematurely because the module is being removed, then we have the module
> refcounting wrong somewhere.  Have you run across such a case?

Hmm, I think Alan has a point.

>From object point of view, who is the parent and who is the child
when talking about LLDD/module and the host template?

The reason is that the host template could be simulated on behalf
of the underlying transport (as is the case for USB).

So, it could be the case that the host template _should_ be
removed but the entity which removed it should stay, and that
entity wants to know when the host template is to be removed.

(Actually it doesn't, but setting the release method in the
kobj_ktype would do wonders. ;-) )

In which case, it does make sense to include a kset to the
host template (since it has many children), and anyone
using/manipulating it does kset_get().  When that entity
is done with the host template it does a kset_put().

Such entities could be the managing layer above, error
handling, etc.

Another solution, just as good, is to use the template
_only_ for the registration call, as a _template_, and
as soon as the registration call has returned, the
caller (LLDD/module) can free the template.  After all,
it is only a template.

Then the managing layer allocates the actual host struct
and "gives" it to the LLDD.  The LLDD goes a kset_get()
on it while it lives, and when it is to die, it does a
kset_put().  And if it gets a method call, it would
error it out, after the put...

Either way, event relationship must be very well defined.

	Luben






  reply	other threads:[~2005-08-08 18:24 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-07 14:59 Synchronizing scsi_remove_host and the error handler Alan Stern
2005-08-07 15:36 ` James Bottomley
2005-08-07 18:43   ` Alan Stern
2005-08-07 21:57     ` James Bottomley
2005-08-08 18:24       ` Luben Tuikov [this message]
2005-08-08 19:54         ` Mike Anderson
2005-08-08 20:25           ` Luben Tuikov
2005-08-08 20:06       ` Mike Anderson
2005-08-07 22:15     ` Stefan Richter
2005-08-08 20:41       ` Alan Stern
2005-08-08 21:36         ` Mike Anderson
2005-08-08 22:36           ` Alan Stern
2005-08-08 23:10             ` Stefan Richter
2005-08-09 14:23               ` Alan Stern
2005-08-09 19:37                 ` Stefan Richter
2005-08-09 20:07                   ` Alan Stern
2005-08-09 20:45                     ` Stefan Richter
2005-08-08 23:59             ` Stefan Richter
2005-08-09 14:40               ` Alan Stern
2005-08-09 18:21                 ` Stefan Richter
2005-08-09 18:49                   ` Alan Stern
2005-08-08 21:49         ` Stefan Richter
2005-08-08 22:20         ` Luben Tuikov
2005-08-08 22:30           ` Alan Stern
2005-08-09  0:49             ` Luben Tuikov
2005-08-09 14:50               ` Alan Stern
2005-08-08 22:23         ` James Bottomley
2005-08-08 22:40           ` Alan Stern
2005-08-08 18:07   ` Luben Tuikov
2005-08-08 18:04 ` Luben Tuikov

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=42F7A344.8070905@adaptec.com \
    --to=luben_tuikov@adaptec.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=andmike@us.ibm.com \
    --cc=linux-scsi@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;
as well as URLs for NNTP newsgroup(s).