hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/scsi/storvsc_drv.c
....@@ -1014,6 +1014,22 @@
10141014 }
10151015
10161016 /*
1017
+ * Check for "Operating parameters have changed"
1018
+ * due to Hyper-V changing the VHD/VHDX BlockSize
1019
+ * when adding/removing a differencing disk. This
1020
+ * causes discard_granularity to change, so do a
1021
+ * rescan to pick up the new granularity. We don't
1022
+ * want scsi_report_sense() to output a message
1023
+ * that a sysadmin wouldn't know what to do with.
1024
+ */
1025
+ if ((asc == 0x3f) && (ascq != 0x03) &&
1026
+ (ascq != 0x0e)) {
1027
+ process_err_fn = storvsc_device_scan;
1028
+ set_host_byte(scmnd, DID_REQUEUE);
1029
+ goto do_work;
1030
+ }
1031
+
1032
+ /*
10171033 * Otherwise, let upper layer deal with the
10181034 * error when sense message is present
10191035 */
....@@ -1521,6 +1537,8 @@
15211537 {
15221538 blk_queue_rq_timeout(sdevice->request_queue, (storvsc_timeout * HZ));
15231539
1540
+ /* storvsc devices don't support MAINTENANCE_IN SCSI cmd */
1541
+ sdevice->no_report_opcodes = 1;
15241542 sdevice->no_write_same = 1;
15251543
15261544 /*
....@@ -1625,10 +1643,6 @@
16251643 */
16261644 static enum blk_eh_timer_return storvsc_eh_timed_out(struct scsi_cmnd *scmnd)
16271645 {
1628
-#if IS_ENABLED(CONFIG_SCSI_FC_ATTRS)
1629
- if (scmnd->device->host->transportt == fc_transport_template)
1630
- return fc_eh_timed_out(scmnd);
1631
-#endif
16321646 return BLK_EH_RESET_TIMER;
16331647 }
16341648
....@@ -1740,7 +1754,7 @@
17401754
17411755 length = scsi_bufflen(scmnd);
17421756 payload = (struct vmbus_packet_mpb_array *)&cmd_request->mpb;
1743
- payload_sz = sizeof(cmd_request->mpb);
1757
+ payload_sz = 0;
17441758
17451759 if (sg_count) {
17461760 unsigned int hvpgoff = 0;
....@@ -1748,10 +1762,10 @@
17481762 unsigned int hvpg_count = HVPFN_UP(offset_in_hvpg + length);
17491763 u64 hvpfn;
17501764
1751
- if (hvpg_count > MAX_PAGE_BUFFER_COUNT) {
1765
+ payload_sz = (hvpg_count * sizeof(u64) +
1766
+ sizeof(struct vmbus_packet_mpb_array));
17521767
1753
- payload_sz = (hvpg_count * sizeof(u64) +
1754
- sizeof(struct vmbus_packet_mpb_array));
1768
+ if (hvpg_count > MAX_PAGE_BUFFER_COUNT) {
17551769 payload = kzalloc(payload_sz, GFP_ATOMIC);
17561770 if (!payload)
17571771 return SCSI_MLQUEUE_DEVICE_BUSY;