public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: linux-scsi@vger.kernel.org
Subject: Re: Two questions on scsi_device_{get,put}
Date: Tue, 12 Aug 2003 10:43:33 +0200	[thread overview]
Message-ID: <20030812084333.GA7457@lst.de> (raw)
In-Reply-To: <20030811203734.GB1323@beaverton.ibm.com>

On Mon, Aug 11, 2003 at 01:37:34PM -0700, Mike Anderson wrote:
> my_devices should be redundant now with shost_gendev.children. Will we
> not have consistency issues with LDM managing a list with r/w sema and
> my_devices being managed with spinlocks.

The problem is that we need to access my_devices in IRQ context which
is impossible with the semaphore-protected shost_gendev.children.
Thus I'd prefer to use my_devices over the scsi code for consistency.

> > But after your changes it's using the class r/w semaphore for
> > synchronisation.  What it this protecting except sdev->access_count?
> 
> Yes, access_count is what is being protected. The r/w semaphore could be
> changed to spinlock protection if needed.

or atomic_t.  Or even better killed at all - if we can do the device_del
imediately it's not needed anymore.

> > Also what's the reason we can't do the device_del directly but have
> > to do it in scsi_device_put?
> 
> When we converted the upper level drivers to the driver model the probe
> / remove routines get called in response to device_add and device_delete
> calls respectively. 
> 
> The problem I ran into was in sd_remove when we call del_gendisk.
> del_gendisk calls delete_partition which is bad if we are still using
> the block device.
> 
> I think maybe the gendisk kobject should have a release function, but
> that would touch quite a few files and I had not discussed this with Al /
> others.

That sounds like the way to go.  Care to bring it up on lkml or should I?

> > A final nitpick:  you're losing a module refernece for some failure
> > pathes of scsi_module_get.
> 
> By scsi_module_get do you mean try_module_get on the host module? I see
> that I have a ref leak on failure of get_device in scsi_device_get.

Sorry, I don't have the code in front of me currently.  I'll f'up on
this once I have.


      reply	other threads:[~2003-08-12  8:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-08 12:59 Two questions on scsi_device_{get,put} Christoph Hellwig
2003-08-11 20:37 ` Mike Anderson
2003-08-12  8:43   ` Christoph Hellwig [this message]

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=20030812084333.GA7457@lst.de \
    --to=hch@lst.de \
    --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