aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/storvsc_drv.c
diff options
context:
space:
mode:
authorK. Y. Srinivasan <kys@microsoft.com>2013-02-21 15:04:53 -0500
committerJames Bottomley <JBottomley@Parallels.com>2013-02-24 04:41:23 -0500
commit6781209e7621a900fe83b3c09b1a02ec1a947c75 (patch)
tree42b74459179a2432ad342517f854842c4f3c8d22 /drivers/scsi/storvsc_drv.c
parentc50bd4481707cef2a81c648f6e28e7a0a5f21129 (diff)
[SCSI] storvsc: Handle dynamic resizing of the device
Handle LUN size changes by re-scanning the device. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/storvsc_drv.c')
-rw-r--r--drivers/scsi/storvsc_drv.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 95c759fe071a..5dd6c49bfa7e 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -201,6 +201,7 @@ enum storvsc_request_type {
201#define SRB_STATUS_AUTOSENSE_VALID 0x80 201#define SRB_STATUS_AUTOSENSE_VALID 0x80
202#define SRB_STATUS_INVALID_LUN 0x20 202#define SRB_STATUS_INVALID_LUN 0x20
203#define SRB_STATUS_SUCCESS 0x01 203#define SRB_STATUS_SUCCESS 0x01
204#define SRB_STATUS_ABORTED 0x02
204#define SRB_STATUS_ERROR 0x04 205#define SRB_STATUS_ERROR 0x04
205 206
206/* 207/*
@@ -295,6 +296,25 @@ struct storvsc_scan_work {
295 uint lun; 296 uint lun;
296}; 297};
297 298
299static void storvsc_device_scan(struct work_struct *work)
300{
301 struct storvsc_scan_work *wrk;
302 uint lun;
303 struct scsi_device *sdev;
304
305 wrk = container_of(work, struct storvsc_scan_work, work);
306 lun = wrk->lun;
307
308 sdev = scsi_device_lookup(wrk->host, 0, 0, lun);
309 if (!sdev)
310 goto done;
311 scsi_rescan_device(&sdev->sdev_gendev);
312 scsi_device_put(sdev);
313
314done:
315 kfree(wrk);
316}
317
298static void storvsc_bus_scan(struct work_struct *work) 318static void storvsc_bus_scan(struct work_struct *work)
299{ 319{
300 struct storvsc_scan_work *wrk; 320 struct storvsc_scan_work *wrk;
@@ -791,7 +811,18 @@ static void storvsc_handle_error(struct vmscsi_request *vm_srb,
791 do_work = true; 811 do_work = true;
792 process_err_fn = storvsc_remove_lun; 812 process_err_fn = storvsc_remove_lun;
793 break; 813 break;
814 case (SRB_STATUS_ABORTED | SRB_STATUS_AUTOSENSE_VALID):
815 if ((asc == 0x2a) && (ascq == 0x9)) {
816 do_work = true;
817 process_err_fn = storvsc_device_scan;
818 /*
819 * Retry the I/O that trigerred this.
820 */
821 set_host_byte(scmnd, DID_REQUEUE);
822 }
823 break;
794 } 824 }
825
795 if (!do_work) 826 if (!do_work)
796 return; 827 return;
797 828