Re: [Patch] take 4: Correct issue with midlayer scsi target allocation and transports that create the targets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 ))
-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux