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

Pull SCSI fixes from James Bottomley:
"Three small changes: two in the core and one in the qla2xxx driver.

The sg_tablesize fix affects a thinko in the migration to blk-mq of
certain legacy drivers which could cause an oops and the sd core
change should only affect zoned block devices which were wrongly
suppressing error messages for reset all zones"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
scsi: core: Handle drivers which set sg_tablesize to zero
scsi: qla2xxx: fix NPIV tear down process
scsi: sd_zbc: Fix sd_zbc_complete()

+22 -26
+5 -3
drivers/scsi/qla2xxx/qla_mid.c
··· 76 76 * ensures no active vp_list traversal while the vport is removed 77 77 * from the queue) 78 78 */ 79 - for (i = 0; i < 10 && atomic_read(&vha->vref_count); i++) 80 - wait_event_timeout(vha->vref_waitq, 81 - atomic_read(&vha->vref_count), HZ); 79 + for (i = 0; i < 10; i++) { 80 + if (wait_event_timeout(vha->vref_waitq, 81 + !atomic_read(&vha->vref_count), HZ) > 0) 82 + break; 83 + } 82 84 83 85 spin_lock_irqsave(&ha->vport_slock, flags); 84 86 if (atomic_read(&vha->vref_count)) {
+5 -3
drivers/scsi/qla2xxx/qla_os.c
··· 1119 1119 1120 1120 qla2x00_mark_all_devices_lost(vha, 0); 1121 1121 1122 - for (i = 0; i < 10; i++) 1123 - wait_event_timeout(vha->fcport_waitQ, test_fcport_count(vha), 1124 - HZ); 1122 + for (i = 0; i < 10; i++) { 1123 + if (wait_event_timeout(vha->fcport_waitQ, 1124 + test_fcport_count(vha), HZ) > 0) 1125 + break; 1126 + } 1125 1127 1126 1128 flush_workqueue(vha->hw->wq); 1127 1129 }
+2 -1
drivers/scsi/scsi_lib.c
··· 1883 1883 { 1884 1884 unsigned int cmd_size, sgl_size; 1885 1885 1886 - sgl_size = scsi_mq_inline_sgl_size(shost); 1886 + sgl_size = max_t(unsigned int, sizeof(struct scatterlist), 1887 + scsi_mq_inline_sgl_size(shost)); 1887 1888 cmd_size = sizeof(struct scsi_cmnd) + shost->hostt->cmd_size + sgl_size; 1888 1889 if (scsi_host_get_prot(shost)) 1889 1890 cmd_size += sizeof(struct scsi_data_buffer) +
+10 -19
drivers/scsi/sd_zbc.c
··· 263 263 int result = cmd->result; 264 264 struct request *rq = cmd->request; 265 265 266 - switch (req_op(rq)) { 267 - case REQ_OP_ZONE_RESET: 268 - case REQ_OP_ZONE_RESET_ALL: 269 - 270 - if (result && 271 - sshdr->sense_key == ILLEGAL_REQUEST && 272 - sshdr->asc == 0x24) 273 - /* 274 - * INVALID FIELD IN CDB error: reset of a conventional 275 - * zone was attempted. Nothing to worry about, so be 276 - * quiet about the error. 277 - */ 278 - rq->rq_flags |= RQF_QUIET; 279 - break; 280 - 281 - case REQ_OP_WRITE: 282 - case REQ_OP_WRITE_ZEROES: 283 - case REQ_OP_WRITE_SAME: 284 - break; 266 + if (req_op(rq) == REQ_OP_ZONE_RESET && 267 + result && 268 + sshdr->sense_key == ILLEGAL_REQUEST && 269 + sshdr->asc == 0x24) { 270 + /* 271 + * INVALID FIELD IN CDB error: reset of a conventional 272 + * zone was attempted. Nothing to worry about, so be 273 + * quiet about the error. 274 + */ 275 + rq->rq_flags |= RQF_QUIET; 285 276 } 286 277 } 287 278