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>
Subject: Re: [PATCH] correct module refcounting
Date: 28 Oct 2003 18:42:11 -0600	[thread overview]
Message-ID: <1067388134.1788.59.camel@mulgrave> (raw)
In-Reply-To: <20031029001724.GA2029@beaverton.ibm.com>

On Tue, 2003-10-28 at 18:17, Mike Anderson wrote:
> > I also think we probably want to move sdev_gendev population into
> > scsi_allocate_sdev.  Note this will change how we do initial scans
> > because now we'll be using the generic device release infrastructure to
> > free even temporary devices.  Unless anyone has a better idea...?
> > 
> 
> If we do this we will need to do a two phase init of the sdev_gendev
> like we do with the host. Otherwise every device_register will cause the
> sd_probe to be called.

well...we really already have this: slave_alloc and slave_configure, so
I think we may be able to slot it into the infrastructure.

> > Finally, when this is done, we can take a device reference over both
> > scsi_get_command/scsi_put_command and also within the scsi_request_fn so
> > we know the device can never be released while it has outstanding
> > commands or while we are running its queues.
> > 
> 
> What case of IO in-flight post a upper level driver release call are you
> trying to protect. Do you think these extra atomic_incs will have any
> negative impact.

It's more symmetry...since the elimination of scsi_device.access_count
we've been moving over to relying on the generic device reference
counting.  This would just be an extension.

I don't think an atomic_inc is particularly expensive compared with the
slab allocation of the commmand.

> > +	if (!try_module_get(sdev->host->hostt->module))
> > +		goto out;
> > +
> >  	sdev = kmalloc(sizeof(*sdev), GFP_ATOMIC);
> >  	if (!sdev)
> >  		goto out;
> 
> Shouldn't this chunk be after the setting of sdev. I applied your patch
> and it oops on me. After I moved it I am booted, but I have not done any
> adds / deletes.

Cut and paste error.  That should read if
(!try_module_get(shost->hostt->module))

but it should be before the kmalloc.

James



  reply	other threads:[~2003-10-29  0:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-28 21:46 [PATCH] correct module refcounting James Bottomley
2003-10-29  0:17 ` Mike Anderson
2003-10-29  0:42   ` James Bottomley [this message]
2003-10-29  1:46     ` Mike Anderson
2003-10-31 12:18 ` Christoph Hellwig
2003-10-31 15:00   ` James Bottomley

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=1067388134.1788.59.camel@mulgrave \
    --to=james.bottomley@steeleye.com \
    --cc=andmike@us.ibm.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