public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Patrick Mansfield <patmans@us.ibm.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: James.Smart@Emulex.Com, linux-scsi@vger.kernel.org
Subject: Re: [Patch] take 4: Correct issue with midlayer scsi target allocation and transports that create the targets
Date: Tue, 14 Jun 2005 15:54:33 -0700	[thread overview]
Message-ID: <20050614225433.GA16140@us.ibm.com> (raw)
In-Reply-To: <20050614223535.GA6834@infradead.org>

On Tue, Jun 14, 2005 at 11:35:35PM +0100, Christoph Hellwig wrote:
> On Tue, Jun 14, 2005 at 03:17:00PM -0700, Patrick Mansfield wrote:

> > @@ -1190,10 +1199,15 @@ struct scsi_device *__scsi_add_device(st
> >  				      uint id, uint lun, void *hostdata)
> >  {
> >  	struct scsi_device *sdev;
> > -	struct device *parent = &shost->shost_gendev;
> > +	struct device *parent;
> >  	int res;
> > -	struct scsi_target *starget = scsi_alloc_target(parent, channel, id);
> > +	struct scsi_target *starget;
> >  
> > +	parent = scsi_target_parent(shost, channel, id);
> > +	if (!parent)
> > +		return ERR_PTR(-ENODEV);
> > +
> 
> scsi_add_device is a library function for LLDDs, thus it does not need
> this fix.  If we want LLDDs with objects below the target to use them
> in the future we should probably change the prototype so it takes a parent
> object.

> >  int scsi_scan_host_selected(struct Scsi_Host *shost, unsigned int channel,
> > @@ -1432,8 +1453,12 @@ struct scsi_device *scsi_get_host_dev(st
> >  {
> >  	struct scsi_device *sdev;
> >  	struct scsi_target *starget;
> > +	struct device *parent;
> >  
> > -	starget = scsi_alloc_target(&shost->shost_gendev, 0, shost->this_id);
> > +	parent = scsi_target_parent(shost, 0, shost->this_id);
> > +	if (!parent)
> > +		return NULL;
> > +	starget = scsi_alloc_target(parent, 0, shost->this_id);
> 
> scsi_get_host_dev is a library function for LLDDs and does not need to
> care about this.

But if the transport is like FC or iSCSI, the eventual calls to
scsi_alloc_sdev() will fail (for qlogic, ->slave_alloc returns ENXIO) or
somehow be incorrect, so why not change these?

> > +	list_for_each_entry(rport, &fc_host_rports(shost), peers)
> > +		if ((rport->channel == channel) &&
> > +		    (rport->scsi_target_id == id)) {
> 
> lots of superflous braces ;-)

OK ))

  reply	other threads:[~2005-06-14 22:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-11  2:24 [Patch] Correct issue with midlayer scsi target allocation and transports that create the targets James.Smart
2005-06-11 15:37 ` Christoph Hellwig
2005-06-11 18:15   ` Patrick Mansfield
2005-06-11 18:18     ` Christoph Hellwig
2005-06-14 22:17   ` [Patch] take 4: " Patrick Mansfield
2005-06-14 22:35     ` Christoph Hellwig
2005-06-14 22:54       ` Patrick Mansfield [this message]
2005-06-17 11:11         ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2005-06-17 13:08 James.Smart

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=20050614225433.GA16140@us.ibm.com \
    --to=patmans@us.ibm.com \
    --cc=James.Smart@Emulex.Com \
    --cc=hch@infradead.org \
    --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