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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

pULL SCSI fixes from James Bottomley:
"This consists of four real fixes and three MAINTAINER updates.

Three of the fixes are obvious (the DIX and atomic allocation are bug
on and warn on fixes and the other is just trivial) and the ipr one is
a bit more involved but is required because without it, the card
double completes aborted commands and causes a kernel oops"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
MAINTAINERS: ibmvscsi driver maintainer change
MAINTAINERS: ibmvfc driver maintainer change
MAINTAINERS: Remove self as isci maintainer
scsi_debug: test always evaluates to false, || should be used instead
scsi: Avoid crashing if device uses DIX but adapter does not support it
scsi_debug: use atomic allocation in resp_rsup_opcodes
ipr: wait for aborted command responses

+108 -6
+2 -3
MAINTAINERS
··· 4750 4750 F: drivers/net/ethernet/ibm/ibmveth.* 4751 4751 4752 4752 IBM Power Virtual SCSI Device Drivers 4753 - M: Nathan Fontenot <nfont@linux.vnet.ibm.com> 4753 + M: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> 4754 4754 L: linux-scsi@vger.kernel.org 4755 4755 S: Supported 4756 4756 F: drivers/scsi/ibmvscsi/ibmvscsi* 4757 4757 F: drivers/scsi/ibmvscsi/viosrp.h 4758 4758 4759 4759 IBM Power Virtual FC Device Drivers 4760 - M: Brian King <brking@linux.vnet.ibm.com> 4760 + M: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> 4761 4761 L: linux-scsi@vger.kernel.org 4762 4762 S: Supported 4763 4763 F: drivers/scsi/ibmvscsi/ibmvfc* ··· 4946 4946 INTEL C600 SERIES SAS CONTROLLER DRIVER 4947 4947 M: Intel SCU Linux support <intel-linux-scu@intel.com> 4948 4948 M: Artur Paszkiewicz <artur.paszkiewicz@intel.com> 4949 - M: Dave Jiang <dave.jiang@intel.com> 4950 4949 L: linux-scsi@vger.kernel.org 4951 4950 T: git git://git.code.sf.net/p/intel-sas/isci 4952 4951 S: Supported
+92
drivers/scsi/ipr.c
··· 683 683 ipr_reinit_ipr_cmnd(ipr_cmd); 684 684 ipr_cmd->u.scratch = 0; 685 685 ipr_cmd->sibling = NULL; 686 + ipr_cmd->eh_comp = NULL; 686 687 ipr_cmd->fast_done = fast_done; 687 688 init_timer(&ipr_cmd->timer); 688 689 } ··· 849 848 850 849 scsi_dma_unmap(ipr_cmd->scsi_cmd); 851 850 scsi_cmd->scsi_done(scsi_cmd); 851 + if (ipr_cmd->eh_comp) 852 + complete(ipr_cmd->eh_comp); 852 853 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); 853 854 } 854 855 ··· 4814 4811 return rc; 4815 4812 } 4816 4813 4814 + /** 4815 + * ipr_match_lun - Match function for specified LUN 4816 + * @ipr_cmd: ipr command struct 4817 + * @device: device to match (sdev) 4818 + * 4819 + * Returns: 4820 + * 1 if command matches sdev / 0 if command does not match sdev 4821 + **/ 4822 + static int ipr_match_lun(struct ipr_cmnd *ipr_cmd, void *device) 4823 + { 4824 + if (ipr_cmd->scsi_cmd && ipr_cmd->scsi_cmd->device == device) 4825 + return 1; 4826 + return 0; 4827 + } 4828 + 4829 + /** 4830 + * ipr_wait_for_ops - Wait for matching commands to complete 4831 + * @ipr_cmd: ipr command struct 4832 + * @device: device to match (sdev) 4833 + * @match: match function to use 4834 + * 4835 + * Returns: 4836 + * SUCCESS / FAILED 4837 + **/ 4838 + static int ipr_wait_for_ops(struct ipr_ioa_cfg *ioa_cfg, void *device, 4839 + int (*match)(struct ipr_cmnd *, void *)) 4840 + { 4841 + struct ipr_cmnd *ipr_cmd; 4842 + int wait; 4843 + unsigned long flags; 4844 + struct ipr_hrr_queue *hrrq; 4845 + signed long timeout = IPR_ABORT_TASK_TIMEOUT; 4846 + DECLARE_COMPLETION_ONSTACK(comp); 4847 + 4848 + ENTER; 4849 + do { 4850 + wait = 0; 4851 + 4852 + for_each_hrrq(hrrq, ioa_cfg) { 4853 + spin_lock_irqsave(hrrq->lock, flags); 4854 + list_for_each_entry(ipr_cmd, &hrrq->hrrq_pending_q, queue) { 4855 + if (match(ipr_cmd, device)) { 4856 + ipr_cmd->eh_comp = &comp; 4857 + wait++; 4858 + } 4859 + } 4860 + spin_unlock_irqrestore(hrrq->lock, flags); 4861 + } 4862 + 4863 + if (wait) { 4864 + timeout = wait_for_completion_timeout(&comp, timeout); 4865 + 4866 + if (!timeout) { 4867 + wait = 0; 4868 + 4869 + for_each_hrrq(hrrq, ioa_cfg) { 4870 + spin_lock_irqsave(hrrq->lock, flags); 4871 + list_for_each_entry(ipr_cmd, &hrrq->hrrq_pending_q, queue) { 4872 + if (match(ipr_cmd, device)) { 4873 + ipr_cmd->eh_comp = NULL; 4874 + wait++; 4875 + } 4876 + } 4877 + spin_unlock_irqrestore(hrrq->lock, flags); 4878 + } 4879 + 4880 + if (wait) 4881 + dev_err(&ioa_cfg->pdev->dev, "Timed out waiting for aborted commands\n"); 4882 + LEAVE; 4883 + return wait ? FAILED : SUCCESS; 4884 + } 4885 + } 4886 + } while (wait); 4887 + 4888 + LEAVE; 4889 + return SUCCESS; 4890 + } 4891 + 4817 4892 static int ipr_eh_host_reset(struct scsi_cmnd *cmd) 4818 4893 { 4819 4894 struct ipr_ioa_cfg *ioa_cfg; ··· 5111 5030 static int ipr_eh_dev_reset(struct scsi_cmnd *cmd) 5112 5031 { 5113 5032 int rc; 5033 + struct ipr_ioa_cfg *ioa_cfg; 5034 + 5035 + ioa_cfg = (struct ipr_ioa_cfg *) cmd->device->host->hostdata; 5114 5036 5115 5037 spin_lock_irq(cmd->device->host->host_lock); 5116 5038 rc = __ipr_eh_dev_reset(cmd); 5117 5039 spin_unlock_irq(cmd->device->host->host_lock); 5040 + 5041 + if (rc == SUCCESS) 5042 + rc = ipr_wait_for_ops(ioa_cfg, cmd->device, ipr_match_lun); 5118 5043 5119 5044 return rc; 5120 5045 } ··· 5321 5234 { 5322 5235 unsigned long flags; 5323 5236 int rc; 5237 + struct ipr_ioa_cfg *ioa_cfg; 5324 5238 5325 5239 ENTER; 5240 + 5241 + ioa_cfg = (struct ipr_ioa_cfg *) scsi_cmd->device->host->hostdata; 5326 5242 5327 5243 spin_lock_irqsave(scsi_cmd->device->host->host_lock, flags); 5328 5244 rc = ipr_cancel_op(scsi_cmd); 5329 5245 spin_unlock_irqrestore(scsi_cmd->device->host->host_lock, flags); 5330 5246 5247 + if (rc == SUCCESS) 5248 + rc = ipr_wait_for_ops(ioa_cfg, scsi_cmd->device, ipr_match_lun); 5331 5249 LEAVE; 5332 5250 return rc; 5333 5251 }
+1
drivers/scsi/ipr.h
··· 1606 1606 struct scsi_device *sdev; 1607 1607 } u; 1608 1608 1609 + struct completion *eh_comp; 1609 1610 struct ipr_hrr_queue *hrrq; 1610 1611 struct ipr_ioa_cfg *ioa_cfg; 1611 1612 };
+2 -2
drivers/scsi/scsi_debug.c
··· 1623 1623 req_opcode = cmd[3]; 1624 1624 req_sa = get_unaligned_be16(cmd + 4); 1625 1625 alloc_len = get_unaligned_be32(cmd + 6); 1626 - if (alloc_len < 4 && alloc_len > 0xffff) { 1626 + if (alloc_len < 4 || alloc_len > 0xffff) { 1627 1627 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 6, -1); 1628 1628 return check_condition_result; 1629 1629 } ··· 1631 1631 a_len = 8192; 1632 1632 else 1633 1633 a_len = alloc_len; 1634 - arr = kzalloc((a_len < 256) ? 320 : a_len + 64, GFP_KERNEL); 1634 + arr = kzalloc((a_len < 256) ? 320 : a_len + 64, GFP_ATOMIC); 1635 1635 if (NULL == arr) { 1636 1636 mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC, 1637 1637 INSUFF_RES_ASCQ);
+11 -1
drivers/scsi/scsi_lib.c
··· 1143 1143 struct scsi_data_buffer *prot_sdb = cmd->prot_sdb; 1144 1144 int ivecs, count; 1145 1145 1146 - BUG_ON(prot_sdb == NULL); 1146 + if (prot_sdb == NULL) { 1147 + /* 1148 + * This can happen if someone (e.g. multipath) 1149 + * queues a command to a device on an adapter 1150 + * that does not support DIX. 1151 + */ 1152 + WARN_ON_ONCE(1); 1153 + error = BLKPREP_KILL; 1154 + goto err_exit; 1155 + } 1156 + 1147 1157 ivecs = blk_rq_count_integrity_sg(rq->q, rq->bio); 1148 1158 1149 1159 if (scsi_alloc_sgtable(prot_sdb, ivecs, is_mq)) {