aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/storvsc_drv.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-01-09storvsc: force SPC-3 compliance on win8 and win8 r2 hostsK. Y. Srinivasan1-0/+13
On win8 and win8 r2 hosts force SPC-3 compliance for MSFT virtual disks. Ubuntu has been carrying a similar patch outside the tree for a while now. Starting with win10, the host will support SPC-3 compliance. Based on all the testing that has been done on win8 and win8 r2 hosts, we are comfortable claiming SPC-3 compliance on these hosts as well. This will enable TRIM support on these hosts. Suggested by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Long Li <longli@microsoft.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2015-01-09storvsc: fix a bug in storvsc limitsK. Y. Srinivasan1-3/+12
Commit 4cd83ecdac20d30725b4f96e5d7814a1e290bc7e changed the limits to reflect the values on the host. It turns out that WS2008R2 cannot correctly handle these new limits. Fix this bug by setting the limits based on the host. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Long Li <longli@microsoft.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2015-01-09storvsc: force discovery of LUNs that may have been removed.K. Y. Srinivasan1-0/+26
The host asks the guest to scan when a LUN is removed or added. The only way a guest can identify the removed LUN is when an I/O is attempted on a removed LUN - the SRB status code indicates that the LUN is invalid. We currently handle this SRB status and remove the device. Rather than waiting for an I/O to remove the device, force the discovery of LUNs that may have been removed prior to discovering LUNs that may have been added. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Long Li <longli@microsoft.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2015-01-09storvsc: in responce to a scan event, scan the hostK. Y. Srinivasan1-12/+7
The virtual HBA that storvsc implements can support multiple channels and targets. So, scan the host when the host notifies that a scan is needed. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Long Li <longli@microsoft.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2015-01-09storvsc: use cmd_size to allocate per-command dataChristoph Hellwig1-111/+8
STORVSC uses its own momory pool to manage device request data. However, the SCSI layer already has a mechanisim for allocating additional memory for each command issued to device driver. This patch removes the memory pool in STORVSC and makes it use SCSI layer to allocate memory for device request data. Reviewed-by: Long Li <longli@microsoft.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-12-15storvsc: ring buffer failures may result in I/O freezeLong Li1-4/+3
When ring buffer returns an error indicating retry, storvsc may not return a proper error code to SCSI when bounce buffer is not used. This has introduced I/O freeze on RAID running atop storvsc devices. This patch fixes it by always returning a proper error code. Signed-off-by: Long Li <longli@microsoft.com> Reviewed-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Christoph Hellwig <hch@lst.de> cc: stable@vger.kernel.org
2014-11-24scsi: drop reason argument from ->change_queue_depthChristoph Hellwig1-1/+1
Drop the now unused reason argument from the ->change_queue_depth method. Also add a return value to scsi_adjust_queue_depth, and rename it to scsi_change_queue_depth now that it can be used as the default ->change_queue_depth implementation. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Reviewed-by: Hannes Reinecke <hare@suse.de>
2014-11-12scsi: don't set tagging state from scsi_adjust_queue_depthChristoph Hellwig1-2/+1
Remove the tagged argument from scsi_adjust_queue_depth, and just let it handle the queue depth. For most drivers those two are fairly separate, given that most modern drivers don't care about the SCSI "tagged" status of a command at all, and many old drivers allow queuing of multiple untagged commands in the driver. Instead we start out with the ->simple_tags flag set before calling ->slave_configure, which is how all drivers actually looking at ->simple_tags except for one worke anyway. The one other case looks broken, but I've kept the behavior as-is for now. Except for that we only change ->simple_tags from the ->change_queue_type, and when rejecting a tag message in a single driver, so keeping this churn out of scsi_adjust_queue_depth is a clear win. Now that the usage of scsi_adjust_queue_depth is more obvious we can also remove all the trivial instances in ->slave_alloc or ->slave_configure that just set it to the cmd_per_lun default. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
2014-11-12scsi: use sdev as argument for sense code printingHannes Reinecke1-1/+2
We should be using the standard dev_printk() variants for sense code printing. [hch: remove __scsi_print_sense call in xen-scsiback, Acked by Juergen] [hch: folded bracing fix from Dan Carpenter] Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Robert Elliott <elliott@hp.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-09-22storvsc: get rid of overly verbose warning messagesK. Y. Srinivasan1-12/+0
Get rid of the warning messages since they will clutter up various system logs and are of questionable value to the end user. For debugging purposes, this information can be gotten by setting the scsi log level appropriately. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-07-25Drivers: add blist flagsK. Y. Srinivasan1-0/+10
Add blist flags to permit the reading of the VPD pages even when the target may claim SPC-2 compliance. MSFT targets currently claim SPC-2 compliance while they implement post SPC-2 features. With this patch we can correctly handle WRITE_SAME_16 issues. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-07-25drivers: scsi: storvsc: Correctly handle TEST_UNIT_READY failureK. Y. Srinivasan1-0/+7
On some Windows hosts on FC SANs, TEST_UNIT_READY can return SRB_STATUS_ERROR. Correctly handle this. Note that there is sufficient sense information to support scsi error handling even in this case. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Cc: <stable@vger.kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-07-25drivers: scsi: storvsc: Set srb_flags in all casesK. Y. Srinivasan1-7/+5
Correctly set SRB flags for all valid I/O directions. Some IHV drivers on the Windows host require this. The host validates the command and SRB flags prior to passing the command down to native driver stack. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Cc: <stable@vger.kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-07-25Drivers: scsi: storvsc: Implement a eh_timed_out handlerK. Y. Srinivasan1-0/+12
On Azure, we have seen instances of unbounded I/O latencies. To deal with this issue, implement handler that can reset the timeout. Note that the host gaurantees that it will respond to each command that has been issued. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Cc: <stable@vger.kernel.org> [hch: added a better comment explaining the issue] Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-07-25Drivers: scsi: storvsc: Fix a bug in handling VMBUS protocol versionK. Y. Srinivasan1-7/+10
Based on the negotiated VMBUS protocol version, we adjust the size of the storage protocol messages. The two sizes we currently handle are pre-win8 and post-win8. In WS2012 R2, we are negotiating higher VMBUS protocol version than the win8 version. Make adjustments to correctly handle this. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Cc: <stable@vger.kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-07-25Drivers: scsi: storvsc: Filter commands based on the storage protocol versionK. Y. Srinivasan1-3/+13
Going forward it is possible that some of the commands that are not currently implemented will be implemented on future Windows hosts. Even if they are not implemented, we are told the host will corrrectly handle unsupported commands (by returning appropriate return code and sense information). Make command filtering depend on the host version. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Cc: <stable@vger.kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-07-25Drivers: scsi: storvsc: Set cmd_per_lun to reflect value supported by the HostK. Y. Srinivasan1-1/+1
Set cmd_per_lun to reflect value supported by the Host. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Cc: <stable@vger.kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-07-25Drivers: scsi: storvsc: Change the limits to reflect the values on the hostK. Y. Srinivasan1-16/+31
Hyper-V hosts can support multiple targets and multiple channels and larger number of LUNs per target. Update the code to reflect this. With this patch we can correctly enumerate all the paths in a multi-path storage environment. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Cc: <stable@vger.kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-03-12[SCSI] storvsc: NULL pointer dereference fixAles Novak1-0/+3
If the initialization of storvsc fails, the storvsc_device_destroy() causes NULL pointer dereference. storvsc_bus_scan() scsi_scan_target() __scsi_scan_target() scsi_probe_and_add_lun(hostdata=NULL) scsi_alloc_sdev(hostdata=NULL) sdev->hostdata = hostdata now the host allocation fails __scsi_remove_device(sdev) calls sdev->host->hostt->slave_destroy() == storvsc_device_destroy(sdev) access of sdev->hostdata->request_mempool Signed-off-by: Ales Novak <alnovak@suse.cz> Signed-off-by: Thomas Abraham <tabraham@suse.com> Reviewed-by: Jiri Kosina <jkosina@suse.cz> Acked-by: K. Y. Srinivasan <kys@microsoft.com> Cc: stable@vger.kernel.org Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-11-29[SCSI] Disable WRITE SAME for RAID and virtual host adapter driversMartin K. Petersen1-0/+1
Some host adapters do not pass commands through to the target disk directly. Instead they provide an emulated target which may or may not accurately report its capabilities. In some cases the physical device characteristics are reported even when the host adapter is processing commands on the device's behalf. This can lead to adapter firmware hangs or excessive I/O errors. This patch disables WRITE SAME for devices connected to host adapters that provide an emulated target. Driver writers can disable WRITE SAME by setting the no_write_same flag in the host adapter template. [jejb: fix up rejections due to eh_deadline patch] Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Cc: stable@kernel.org Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-08-02Drivers: hv: remove HV_DRV_VERSIONOlaf Hering1-1/+0
Remove HV_DRV_VERSION, it has no meaning for upstream drivers. Initially it was supposed to show the "Linux Integration Services" version, now it is not in sync anymore with the out-of-tree drivers available from the MSFT website. The only place where a version string is still required is the KVP command "IntegrationServicesVersion" which is handled by tools/hv/hv_kvp_daemon.c. To satisfy such KVP request from the host pass the current string to the daemon during KVP userland registration. Signed-off-by: Olaf Hering <olaf@aepfle.de> Acked-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-08[SCSI] storvsc: Increase the value of STORVSC_MAX_IO_REQUESTSK. Y. Srinivasan1-1/+1
Increase the value of STORVSC_MAX_IO_REQUESTS to 200 requests. The current ringbuffer size can support this higher value. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-07-08[SCSI] storvsc: Support FC devicesK. Y. Srinivasan1-0/+6
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-07-08[SCSI] storvsc: Implement multi-channel supportK. Y. Srinivasan1-4/+127
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-06-26[SCSI] storvsc: Update the storage protocol to win8 levelK. Y. Srinivasan1-35/+168
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-06-26[SCSI] storvsc: Increase the value of scsi timeout for storvsc devicesK. Y. Srinivasan1-0/+7
The standard scsi timeout is not appropriate in some of the environments where Hyper-V is deployed. Set this timeout appropriately for all devices managed by this driver. On cloud environments where storage latencies may be unbounded, having the scsi layer initiating recovery can be problematic since (a) the host is already implementing a variety of recovery strategies and (b) implementing a recovery strategy at the VM level may be more appropriate in cases where storage latencies exceed a certain threshold. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-03-02Merge tag 'scsi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsiLinus Torvalds1-42/+95
Pull SCSI updates from James Bottomley: "This is an assorted set of stragglers into the merge window with driver updates for qla2xxx, megaraid_sas, storvsc and ufs. It also includes pulls of the uapi tree (all the remaining SCSI pieces) and the fcoe tree (updates to fcoe and libfc)" * tag 'scsi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (81 commits) [SCSI] ufs: Separate PCI code into glue driver [SCSI] ufs: Segregate PCI Specific Code [SCSI] scsi: fix lpfc build when wmb() is defined as mb() [SCSI] storvsc: Handle dynamic resizing of the device [SCSI] storvsc: Restructure error handling code on command completion [SCSI] storvsc: avoid usage of WRITE_SAME [SCSI] aacraid: suppress two GCC warnings [SCSI] hpsa: check for dma_mapping_error in hpsa_passthru ioctls [SCSI] hpsa: reorganize error handling in hpsa_passthru_ioctl [SCSI] hpsa: check for dma_mapping_error in hpsa_map_sg_chain_block [SCSI] hpsa: Check for dma_mapping_error for all code paths using fill_cmd [SCSI] hpsa: Check for dma_mapping_error in hpsa_map_one [SCSI] dc395x: uninitialized variable in device_alloc() [SCSI] Fix range check in scsi_host_dif_capable() [SCSI] storvsc: Initialize the sglist [SCSI] mpt2sas: Add support for OEM specific controller [SCSI] ipr: Fix oops while resetting an ipr adapter [SCSI] fnic: Fnic Trace Utility [SCSI] fnic: New debug flags and debug log messages [SCSI] fnic: fnic driver may hit BUG_ON on device reset ...
2013-02-24[SCSI] storvsc: Handle dynamic resizing of the deviceK. Y. Srinivasan1-0/+31
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>
2013-02-24[SCSI] storvsc: Restructure error handling code on command completionK. Y. Srinivasan1-42/+59
In preparation for handling additional sense codes, restructure and cleanup the error handling code in the command completion code path. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-02-24[SCSI] storvsc: avoid usage of WRITE_SAMEOlaf Hering1-0/+4
Set scsi_device->no_write_same because the host does not support it. Also blacklist WRITE_SAME to avoid (and log) accident usage. If the guest uses the ext4 filesystem, storvsc hangs while it prints these messages in an endless loop: ... [ 161.459523] hv_storvsc vmbus_0_1: cmd 0x41 scsi status 0x2 srb status 0x6 [ 161.462157] sd 2:0:0:0: [sda] [ 161.463135] Sense Key : No Sense [current] [ 161.464983] sd 2:0:0:0: [sda] [ 161.465899] Add. Sense: No additional sense information [ 161.468211] hv_storvsc vmbus_0_1: cmd 0x41 scsi status 0x2 srb status 0x6 [ 161.475766] sd 2:0:0:0: [sda] [ 161.476728] Sense Key : No Sense [current] [ 161.478284] sd 2:0:0:0: [sda] [ 161.479441] Add. Sense: No additional sense information ... This happens with a guest running on Windows Server 2012, but happens to work while running on Windows Server 2008. WRITE_SAME isnt really supported by both versions, so disable the command usage globally. Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-02-24[SCSI] storvsc: Initialize the sglistK. Y. Srinivasan1-0/+1
Properly initialize scatterlist before using it. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Cc: stable@vger.kernel.org Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-01-25Drivers: scsi: storvsc: Use the consolidated GUID definitionK. Y. Srinivasan1-6/+6
Use the consolidated GUID definitions in the Hyper-V storage driver. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-09[SCSI] storvsc: Account for in-transit packets in the RESET pathK. Y. Srinivasan1-0/+5
Properly account for I/O in transit before returning from the RESET call. In the absense of this patch, we could have a situation where the host may respond to a command that was issued prior to the issuance of the RESET command at some arbitrary time after responding to the RESET command. Currently, the host does not do anything with the RESET command. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Cc: stable@vger.kernel.org Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-04-25[SCSI] storvsc: Properly handle errors from the hostK. Y. Srinivasan1-5/+15
Hyper-V cannot process some commands like ATA_12 and ATA_16. It also returns a very generic error when this happens (SRB_STATUS_ERROR). Most of the time we treat SRB_STATUS_ERROR as DID_TARGET_FAILURE which causes error handler retry, but in the case of pass through commands, they'll never succeed (and the error handler will offline the device), so put a discriminating block in the command completion routing and send the SRB_STATUS_ERROR upwards with DID_PASSTHROUGH for commands we know should not be retried. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-03-21Merge branch 'kmap_atomic' of git://github.com/congwang/linuxLinus Torvalds1-26/+26
Pull kmap_atomic cleanup from Cong Wang. It's been in -next for a long time, and it gets rid of the (no longer used) second argument to k[un]map_atomic(). Fix up a few trivial conflicts in various drivers, and do an "evil merge" to catch some new uses that have come in since Cong's tree. * 'kmap_atomic' of git://github.com/congwang/linux: (59 commits) feature-removal-schedule.txt: schedule the deprecated form of kmap_atomic() for removal highmem: kill all __kmap_atomic() [swarren@nvidia.com: highmem: Fix ARM build break due to __kmap_atomic rename] drbd: remove the second argument of k[un]map_atomic() zcache: remove the second argument of k[un]map_atomic() gma500: remove the second argument of k[un]map_atomic() dm: remove the second argument of k[un]map_atomic() tomoyo: remove the second argument of k[un]map_atomic() sunrpc: remove the second argument of k[un]map_atomic() rds: remove the second argument of k[un]map_atomic() net: remove the second argument of k[un]map_atomic() mm: remove the second argument of k[un]map_atomic() lib: remove the second argument of k[un]map_atomic() power: remove the second argument of k[un]map_atomic() kdb: remove the second argument of k[un]map_atomic() udf: remove the second argument of k[un]map_atomic() ubifs: remove the second argument of k[un]map_atomic() squashfs: remove the second argument of k[un]map_atomic() reiserfs: remove the second argument of k[un]map_atomic() ocfs2: remove the second argument of k[un]map_atomic() ntfs: remove the second argument of k[un]map_atomic() ...
2012-02-13Staging: hv: storvsc: Move the storage driver out of the staging areaK. Y. Srinivasan1-0/+1548
The storage driver (storvsc_drv.c) handles all block storage devices assigned to Linux guests hosted on Hyper-V. This driver has been in the staging tree for a while and this patch moves it out of the staging area. James was willing to apply this patch during the 3.3-rc phase and a decision was taken to defer this to 3.4 since Greg had queued up a bunch of storvsc patches for 3.4. Now that Greg has applied all of the pending storvsc patches, I am sending this patch to move this driver out of staging. Based on James' recommendation, this patch gets rid of the unneeded files in the staging/hv directory. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Acked-by: James Bottomley <JBottomley@Parallels.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>