Skip to content

Commit 45341ca

Browse files
Subhash JadavaniChristoph Hellwig
authored andcommitted
scsi: fix the type for well known LUs
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. Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org> Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org> Signed-off-by: Dolev Raviv <draviv@codeaurora.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent db525fc commit 45341ca

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

‎drivers/scsi/scsi_scan.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,19 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
815815
} else {
816816
sdev->type = (inq_result[0] & 0x1f);
817817
sdev->removable = (inq_result[1] & 0x80) >> 7;
818+
819+
/*
820+
* some devices may respond with wrong type for
821+
* well-known logical units. Force well-known type
822+
* to enumerate them correctly.
823+
*/
824+
if (scsi_is_wlun(sdev->lun) && sdev->type != TYPE_WLUN) {
825+
sdev_printk(KERN_WARNING, sdev,
826+
"%s: correcting incorrect peripheral device type 0x%x for W-LUN 0x%16xhN\n",
827+
__func__, sdev->type, (unsigned int)sdev->lun);
828+
sdev->type = TYPE_WLUN;
829+
}
830+
818831
}
819832

820833
if (sdev->type == TYPE_RBC || sdev->type == TYPE_ROM) {

‎include/scsi/scsi.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ static inline int scsi_status_is_good(int status)
333333
#define TYPE_RBC 0x0e
334334
#define TYPE_OSD 0x11
335335
#define TYPE_ZBC 0x14
336+
#define TYPE_WLUN 0x1e /* well-known logical unit */
336337
#define TYPE_NO_LUN 0x7f
337338

338339
/* SCSI protocols; these are taken from SPC-3 section 7.5 */

0 commit comments

Comments
 (0)