All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: James Bottomley <James.Bottomley@SteelEye.com>,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi_device refcounting and list lockdown
Date: Tue, 28 Oct 2003 10:07:55 +0100	[thread overview]
Message-ID: <20031028090755.GB7370@lst.de> (raw)
In-Reply-To: <20031028023235.GE1151@beaverton.ibm.com>

On Mon, Oct 27, 2003 at 06:32:35PM -0800, Mike Anderson wrote:
> > +	/*
> > +	 * Ok, this look a bit strange.  We always look for the first device
> > +	 * on the list as scsi_remove_device removes them from it - thus we
> > +	 * also have to release the lock.
> > +	 * We don't need to get another reference to the device before
> > +	 * releasing the lock as we already own the reference from
> > +	 * scsi_register_device that's release in scsi_remove_device.  And
> > +	 * after that we don't look at sdev anymore.
> > +	 */
> > +	spin_lock_irqsave(shost->host_lock, flags);
> > +	list_for_each_entry_safe(sdev, tmp, &shost->__devices, siblings) {
> > +		spin_unlock_irqrestore(shost->host_lock, flags);
> >  		scsi_remove_device(sdev);
> > +		spin_lock_irqsave(shost->host_lock, flags);
> >  	}
> > +	spin_unlock_irqrestore(shost->host_lock, flags);
> >  }
> >  
> >  /*
> 
> Do we still have issues with other callers of scsi_remove_device?

Well, the other callers aren't walking the list until it's empty but
just remove a single device which is fine with the existing constructs.

> >  void scsi_remove_device(struct scsi_device *sdev)
> >  {
> > -	struct class *class = class_get(&sdev_class);
> > -
> >  	class_device_unregister(&sdev->sdev_classdev);
> > -
> > -	if (class) {
> > -		down_write(&class->subsys.rwsem);
> > -		set_bit(SDEV_DEL, &sdev->sdev_state);
> > -		if (sdev->host->hostt->slave_destroy)
> > -			sdev->host->hostt->slave_destroy(sdev);
> > -		device_del(&sdev->sdev_gendev);
> > -		up_write(&class->subsys.rwsem);
> > -	}
> > -
> > +	if (sdev->host->hostt->slave_destroy)
> > +		sdev->host->hostt->slave_destroy(sdev);
> > +	device_del(&sdev->sdev_gendev);
> >  	put_device(&sdev->sdev_gendev);
> > -
> > -	class_put(&sdev_class);
> >  }
> >  
> 
> Don't we still want to set SDEV_DEL to keep callers to scsi_device_get
> from do more gets.

Indeed!  James, can you add this back when applying?


  reply	other threads:[~2003-10-28  9:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-27 15:57 [PATCH] scsi_device refcounting and list lockdown Christoph Hellwig
2003-10-28  0:01 ` Randy.Dunlap
2003-10-28  9:06   ` Christoph Hellwig
2003-10-28 20:45     ` [PATCH] [v2] aha152x cmnd->device oops Randy.Dunlap
2003-10-28 22:50       ` Mike Christie
2003-10-28 22:50         ` Randy.Dunlap
2003-10-29  0:26         ` Randy.Dunlap
2003-10-29 12:20           ` Juergen E. Fischer
2003-10-29 14:58             ` James Bottomley
2003-10-29 17:56               ` Juergen E. Fischer
2003-10-29 18:10                 ` James Bottomley
2003-10-30 21:19                   ` Juergen E. Fischer
2003-10-29 13:42       ` Christoph Hellwig
2003-10-28  2:32 ` [PATCH] scsi_device refcounting and list lockdown Mike Anderson
2003-10-28  9:07   ` Christoph Hellwig [this message]
2003-10-28 15:52     ` James Bottomley
2003-10-28 17:37       ` Christoph Hellwig
2003-10-30 22:41 ` James Bottomley
2003-10-31  9:11   ` Christoph Hellwig
2003-11-14 11:50 ` Christoph Hellwig

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=20031028090755.GB7370@lst.de \
    --to=hch@lst.de \
    --cc=James.Bottomley@SteelEye.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.