瀏覽代碼

[SCSI] SCSI core: better initialization for sdev->scsi_level

This patch will affect the CDB in INQUIRY commands sent to LUNs above 0 
when LUN-0 reports a scsi_level of 0; the LUN bits will no longer be set 
in the second byte of the CDB.  This is as it should be.  Nevertheless, 
it's possible that some wacky device might be adversely affected.  I doubt 
anyone will complain...

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Alan Stern 18 年之前
父節點
當前提交
7c9d6f16f5
共有 2 個文件被更改,包括 2 次插入1 次删除
  1. 1 0
      drivers/scsi/scsi_scan.c
  2. 1 1
      drivers/scsi/scsi_sysfs.c

+ 1 - 0
drivers/scsi/scsi_scan.c

@@ -385,6 +385,7 @@ static struct scsi_target *scsi_alloc_target(struct device *parent,
 	INIT_LIST_HEAD(&starget->siblings);
 	INIT_LIST_HEAD(&starget->devices);
 	starget->state = STARGET_RUNNING;
+	starget->scsi_level = SCSI_2;
  retry:
 	spin_lock_irqsave(shost->host_lock, flags);
 

+ 1 - 1
drivers/scsi/scsi_sysfs.c

@@ -922,7 +922,7 @@ void scsi_sysfs_device_initialize(struct scsi_device *sdev)
 	snprintf(sdev->sdev_classdev.class_id, BUS_ID_SIZE,
 		 "%d:%d:%d:%d", sdev->host->host_no,
 		 sdev->channel, sdev->id, sdev->lun);
-	sdev->scsi_level = SCSI_2;
+	sdev->scsi_level = starget->scsi_level;
 	transport_setup_device(&sdev->sdev_gendev);
 	spin_lock_irqsave(shost->host_lock, flags);
 	list_add_tail(&sdev->same_target_siblings, &starget->devices);