Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

storvsc: Use the specified target ID in device lookup

The current code assumes that there is only one target in device lookup.
Fix this bug. This will alow us to correctly handle hot reomoval of
LUNs.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Alex Ng <alexng@microsoft.com>
Tested-by: Vivek Yadav <vyadav@microsoft.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

K. Y. Srinivasan and committed by
Martin K. Petersen
98441221 d791a8c6

+5 -5
+5 -5
drivers/scsi/storvsc_drv.c
··· 478 478 struct storvsc_scan_work { 479 479 struct work_struct work; 480 480 struct Scsi_Host *host; 481 - uint lun; 481 + u8 lun; 482 + u8 tgt_id; 482 483 }; 483 484 484 485 static void storvsc_device_scan(struct work_struct *work) 485 486 { 486 487 struct storvsc_scan_work *wrk; 487 - uint lun; 488 488 struct scsi_device *sdev; 489 489 490 490 wrk = container_of(work, struct storvsc_scan_work, work); 491 - lun = wrk->lun; 492 491 493 - sdev = scsi_device_lookup(wrk->host, 0, 0, lun); 492 + sdev = scsi_device_lookup(wrk->host, 0, wrk->tgt_id, wrk->lun); 494 493 if (!sdev) 495 494 goto done; 496 495 scsi_rescan_device(&sdev->sdev_gendev); ··· 540 541 if (!scsi_host_get(wrk->host)) 541 542 goto done; 542 543 543 - sdev = scsi_device_lookup(wrk->host, 0, 0, wrk->lun); 544 + sdev = scsi_device_lookup(wrk->host, 0, wrk->tgt_id, wrk->lun); 544 545 545 546 if (sdev) { 546 547 scsi_remove_device(sdev); ··· 940 941 941 942 wrk->host = host; 942 943 wrk->lun = vm_srb->lun; 944 + wrk->tgt_id = vm_srb->target_id; 943 945 INIT_WORK(&wrk->work, process_err_fn); 944 946 schedule_work(&wrk->work); 945 947 }