RE: [PATCH V5 01/17] scsi: fixing the "type" for well known LUs

Elliott, Robert (Server Storage)
2014-09-24T20:51:19Z

> From: Christoph Hellwig [mailto:hch@infradead.org]
...
> On Wed, Sep 24, 2014 at 06:13:57PM +0300, Dolev Raviv wrote:
> > From: Subhash Jadavani <subhashj@codeaurora.org>
> >
> > Some devices may respond with wrong type for well-known logical units.
> > This patch forces well-known type for devices which doesn't report it
> > correct.
>
> This looks fine to me, as the well known LUN addresses seem to be nailed
> down nicely in t10, but let's see if Martin or Robert disagree..
>
...
> > diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
> > index 56675db..a34db9e 100644
> > --- a/drivers/scsi/scsi_scan.c
> > +++ b/drivers/scsi/scsi_scan.c
> > @@ -805,6 +805,14 @@ static int scsi_add_lun(struct scsi_device *sdev,
> unsigned char *inq_result,
> > } else {
> > sdev->type = (inq_result[0] & 0x1f);
> > sdev->removable = (inq_result[1] & 0x80) >> 7;
> > +
> > + /*
> > + * some devices may respond with wrong type for
> > + * well-known logical units. Force well-known type
> > + * to enumerate them correctly.
> > + */
> > + if (scsi_is_wlun(sdev->lun))
> > + sdev->type = TYPE_WLUN;
> > }
...

My only concern is that the peripheral device type was included
at the outset in spc3r01 in 2001, so a design that can't get this
right might have other problems. A print might be justified
to report something is amiss:

if (scsi_is_wlun(sdev->lun) && sdev->type != TYPE_WLUN) {
sdev_printk(KERN_WARNING, sdev,
"%s: correcting incorrect peripheral device type 0x%x for W-LUN 0x%16phN\n",
__func__, sdev->type, sdev->lun);
sdev->type = TYPE_WLUN;
}

---
Rob Elliott HP Server Storage