public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@steeleye.com>
To: Mike Anderson <andmike@us.ibm.com>
Cc: SCSI Mailing List <linux-scsi@vger.kernel.org>, greg@kroah.com
Subject: Re: [PATCH] update sd to use kref and fix open/release race
Date: 21 Apr 2004 15:10:51 -0400	[thread overview]
Message-ID: <1082568881.1728.22.camel@mulgrave> (raw)
In-Reply-To: <20040413171208.GA2550@us.ibm.com>

On Tue, 2004-04-13 at 12:12, Mike Anderson wrote:
> Did we decide through the thread on this issue that we will not allow a
> rmmod to happen anymore unless you manually delete the children devices
> off the host? In using scsi_debug I am not able to rmmod until I delete
> all the children (i.e. sd's).

Well, I don't think anything was decided.  However, it's a consequence
of the compound reference strategy because now we hold a scsi_device for
the life of the ULD object.

> The parent child hierarchy should be held in place through kobject_add /
> kobject_get of the parent so I would believe that the extra
> scsi_device_get should not be needed.

In the ULD?  It's just simpler to do it that way.

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.

To conform to the existing model, we can simply move the scsi_device_get
and scsi_device_put under the semaphore in the ULD get and put
routines.  This adds some assymmetry because now the put in sd_remove()
can't be the uld wrappered put, it would have to be a direct kref put
(with the semaphore), but it's doable.

James



  reply	other threads:[~2004-04-21 19:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-09 13:52 [PATCH] update sd to use kref and fix open/release race James Bottomley
2004-04-09 16:56 ` Patrick Mansfield
2004-04-09 17:17   ` Patrick Mansfield
2004-04-09 19:19     ` James Bottomley
2004-04-09 19:32       ` Greg KH
2004-04-09 19:57       ` Patrick Mansfield
2004-04-13 17:12 ` Mike Anderson
2004-04-21 19:10   ` James Bottomley [this message]
2004-04-22  5:57     ` Mike Anderson
2004-04-22  6:56       ` viro

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=1082568881.1728.22.camel@mulgrave \
    --to=james.bottomley@steeleye.com \
    --cc=andmike@us.ibm.com \
    --cc=greg@kroah.com \
    --cc=linux-scsi@vger.kernel.org \
    /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