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 git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending

Pull scsi target fixes from Nicholas Bellinger:
"These are the current target pending fixes headed for v3.7-rc4 code.
This includes the following highlights:

- Fix long-standing qla2xxx target bug where certain fc_port_t state
transitions could cause the internal session b-tree list to become
out-of-sync. (Roland)
- Fix task management double free of se_cmd descriptor in exception
path for users of target_submit_tmr(). (nab)
- Re-introduce simple NOP emulation of REZERO_UNIT, SEEK_6, and
SEEK_10 SCSI-2 commands in order to support legacy initiators that
still require them. (Bernhard)

Note these three patches are also CC'ed to stable.

Also, there a couple of outstanding (external) regressions that are
still being tracked down for tcm_fc(FCoE) and tcm_vhost fabrics for
v3.7.0 code, so please expect another PULL as these issues identified
-> resolved."

* git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
target: reintroduce some obsolete SCSI-2 commands
target: Fix double-free of se_cmd in target_complete_tmr_failure
qla2xxx: Update target lookup session tables when a target session changes
tcm_qla2xxx: Format VPD page 83h SCSI name string according to SPC
qla2xxx: Add missing ->vport_slock while calling qlt_update_vp_map

+111 -16
+3
drivers/scsi/qla2xxx/qla_mid.c
··· 149 149 int 150 150 qla24xx_disable_vp(scsi_qla_host_t *vha) 151 151 { 152 + unsigned long flags; 152 153 int ret; 153 154 154 155 ret = qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL); ··· 157 156 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); 158 157 159 158 /* Remove port id from vp target map */ 159 + spin_lock_irqsave(&vha->hw->vport_slock, flags); 160 160 qlt_update_vp_map(vha, RESET_AL_PA); 161 + spin_unlock_irqrestore(&vha->hw->vport_slock, flags); 161 162 162 163 qla2x00_mark_vp_devices_dead(vha); 163 164 atomic_set(&vha->vp_state, VP_FAILED);
+11 -14
drivers/scsi/qla2xxx/qla_target.c
··· 557 557 int pmap_len; 558 558 fc_port_t *fcport; 559 559 int global_resets; 560 + unsigned long flags; 560 561 561 562 retry: 562 563 global_resets = atomic_read(&ha->tgt.qla_tgt->tgt_global_resets_count); ··· 626 625 sess->s_id.b.area, sess->loop_id, fcport->d_id.b.domain, 627 626 fcport->d_id.b.al_pa, fcport->d_id.b.area, fcport->loop_id); 628 627 629 - sess->s_id = fcport->d_id; 630 - sess->loop_id = fcport->loop_id; 631 - sess->conf_compl_supported = !!(fcport->flags & 632 - FCF_CONF_COMP_SUPPORTED); 628 + spin_lock_irqsave(&ha->hardware_lock, flags); 629 + ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, fcport->loop_id, 630 + (fcport->flags & FCF_CONF_COMP_SUPPORTED)); 631 + spin_unlock_irqrestore(&ha->hardware_lock, flags); 633 632 634 633 res = true; 635 634 ··· 741 740 qlt_undelete_sess(sess); 742 741 743 742 kref_get(&sess->se_sess->sess_kref); 744 - sess->s_id = fcport->d_id; 745 - sess->loop_id = fcport->loop_id; 746 - sess->conf_compl_supported = !!(fcport->flags & 747 - FCF_CONF_COMP_SUPPORTED); 743 + ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, fcport->loop_id, 744 + (fcport->flags & FCF_CONF_COMP_SUPPORTED)); 745 + 748 746 if (sess->local && !local) 749 747 sess->local = 0; 750 748 spin_unlock_irqrestore(&ha->hardware_lock, flags); ··· 796 796 */ 797 797 kref_get(&sess->se_sess->sess_kref); 798 798 799 - sess->conf_compl_supported = !!(fcport->flags & 800 - FCF_CONF_COMP_SUPPORTED); 799 + sess->conf_compl_supported = (fcport->flags & FCF_CONF_COMP_SUPPORTED); 801 800 BUILD_BUG_ON(sizeof(sess->port_name) != sizeof(fcport->port_name)); 802 801 memcpy(sess->port_name, fcport->port_name, sizeof(sess->port_name)); 803 802 ··· 868 869 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf007, 869 870 "Reappeared sess %p\n", sess); 870 871 } 871 - sess->s_id = fcport->d_id; 872 - sess->loop_id = fcport->loop_id; 873 - sess->conf_compl_supported = !!(fcport->flags & 874 - FCF_CONF_COMP_SUPPORTED); 872 + ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, fcport->loop_id, 873 + (fcport->flags & FCF_CONF_COMP_SUPPORTED)); 875 874 } 876 875 877 876 if (sess && sess->local) {
+1
drivers/scsi/qla2xxx/qla_target.h
··· 648 648 649 649 int (*check_initiator_node_acl)(struct scsi_qla_host *, unsigned char *, 650 650 void *, uint8_t *, uint16_t); 651 + void (*update_sess)(struct qla_tgt_sess *, port_id_t, uint16_t, bool); 651 652 struct qla_tgt_sess *(*find_sess_by_loop_id)(struct scsi_qla_host *, 652 653 const uint16_t); 653 654 struct qla_tgt_sess *(*find_sess_by_s_id)(struct scsi_qla_host *,
+76 -1
drivers/scsi/qla2xxx/tcm_qla2xxx.c
··· 237 237 struct tcm_qla2xxx_tpg, se_tpg); 238 238 struct tcm_qla2xxx_lport *lport = tpg->lport; 239 239 240 - return &lport->lport_name[0]; 240 + return lport->lport_naa_name; 241 241 } 242 242 243 243 static char *tcm_qla2xxx_npiv_get_fabric_wwn(struct se_portal_group *se_tpg) ··· 1457 1457 return 0; 1458 1458 } 1459 1459 1460 + static void tcm_qla2xxx_update_sess(struct qla_tgt_sess *sess, port_id_t s_id, 1461 + uint16_t loop_id, bool conf_compl_supported) 1462 + { 1463 + struct qla_tgt *tgt = sess->tgt; 1464 + struct qla_hw_data *ha = tgt->ha; 1465 + struct tcm_qla2xxx_lport *lport = ha->tgt.target_lport_ptr; 1466 + struct se_node_acl *se_nacl = sess->se_sess->se_node_acl; 1467 + struct tcm_qla2xxx_nacl *nacl = container_of(se_nacl, 1468 + struct tcm_qla2xxx_nacl, se_node_acl); 1469 + u32 key; 1470 + 1471 + 1472 + if (sess->loop_id != loop_id || sess->s_id.b24 != s_id.b24) 1473 + pr_info("Updating session %p from port %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x loop_id %d -> %d s_id %x:%x:%x -> %x:%x:%x\n", 1474 + sess, 1475 + sess->port_name[0], sess->port_name[1], 1476 + sess->port_name[2], sess->port_name[3], 1477 + sess->port_name[4], sess->port_name[5], 1478 + sess->port_name[6], sess->port_name[7], 1479 + sess->loop_id, loop_id, 1480 + sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa, 1481 + s_id.b.domain, s_id.b.area, s_id.b.al_pa); 1482 + 1483 + if (sess->loop_id != loop_id) { 1484 + /* 1485 + * Because we can shuffle loop IDs around and we 1486 + * update different sessions non-atomically, we might 1487 + * have overwritten this session's old loop ID 1488 + * already, and we might end up overwriting some other 1489 + * session that will be updated later. So we have to 1490 + * be extra careful and we can't warn about those things... 1491 + */ 1492 + if (lport->lport_loopid_map[sess->loop_id].se_nacl == se_nacl) 1493 + lport->lport_loopid_map[sess->loop_id].se_nacl = NULL; 1494 + 1495 + lport->lport_loopid_map[loop_id].se_nacl = se_nacl; 1496 + 1497 + sess->loop_id = loop_id; 1498 + } 1499 + 1500 + if (sess->s_id.b24 != s_id.b24) { 1501 + key = (((u32) sess->s_id.b.domain << 16) | 1502 + ((u32) sess->s_id.b.area << 8) | 1503 + ((u32) sess->s_id.b.al_pa)); 1504 + 1505 + if (btree_lookup32(&lport->lport_fcport_map, key)) 1506 + WARN(btree_remove32(&lport->lport_fcport_map, key) != se_nacl, 1507 + "Found wrong se_nacl when updating s_id %x:%x:%x\n", 1508 + sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa); 1509 + else 1510 + WARN(1, "No lport_fcport_map entry for s_id %x:%x:%x\n", 1511 + sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa); 1512 + 1513 + key = (((u32) s_id.b.domain << 16) | 1514 + ((u32) s_id.b.area << 8) | 1515 + ((u32) s_id.b.al_pa)); 1516 + 1517 + if (btree_lookup32(&lport->lport_fcport_map, key)) { 1518 + WARN(1, "Already have lport_fcport_map entry for s_id %x:%x:%x\n", 1519 + s_id.b.domain, s_id.b.area, s_id.b.al_pa); 1520 + btree_update32(&lport->lport_fcport_map, key, se_nacl); 1521 + } else { 1522 + btree_insert32(&lport->lport_fcport_map, key, se_nacl, GFP_ATOMIC); 1523 + } 1524 + 1525 + sess->s_id = s_id; 1526 + nacl->nport_id = key; 1527 + } 1528 + 1529 + sess->conf_compl_supported = conf_compl_supported; 1530 + } 1531 + 1460 1532 /* 1461 1533 * Calls into tcm_qla2xxx used by qla2xxx LLD I/O path. 1462 1534 */ ··· 1539 1467 .free_cmd = tcm_qla2xxx_free_cmd, 1540 1468 .free_mcmd = tcm_qla2xxx_free_mcmd, 1541 1469 .free_session = tcm_qla2xxx_free_session, 1470 + .update_sess = tcm_qla2xxx_update_sess, 1542 1471 .check_initiator_node_acl = tcm_qla2xxx_check_initiator_node_acl, 1543 1472 .find_sess_by_s_id = tcm_qla2xxx_find_sess_by_s_id, 1544 1473 .find_sess_by_loop_id = tcm_qla2xxx_find_sess_by_loop_id, ··· 1607 1534 lport->lport_wwpn = wwpn; 1608 1535 tcm_qla2xxx_format_wwn(&lport->lport_name[0], TCM_QLA2XXX_NAMELEN, 1609 1536 wwpn); 1537 + sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) wwpn); 1610 1538 1611 1539 ret = tcm_qla2xxx_init_lport(lport); 1612 1540 if (ret != 0) ··· 1675 1601 lport->lport_npiv_wwnn = npiv_wwnn; 1676 1602 tcm_qla2xxx_npiv_format_wwn(&lport->lport_npiv_name[0], 1677 1603 TCM_QLA2XXX_NAMELEN, npiv_wwpn, npiv_wwnn); 1604 + sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) npiv_wwpn); 1678 1605 1679 1606 /* FIXME: tcm_qla2xxx_npiv_make_lport */ 1680 1607 ret = -ENOSYS;
+2
drivers/scsi/qla2xxx/tcm_qla2xxx.h
··· 61 61 u64 lport_npiv_wwnn; 62 62 /* ASCII formatted WWPN for FC Target Lport */ 63 63 char lport_name[TCM_QLA2XXX_NAMELEN]; 64 + /* ASCII formatted naa WWPN for VPD page 83 etc */ 65 + char lport_naa_name[TCM_QLA2XXX_NAMELEN]; 64 66 /* ASCII formatted WWPN+WWNN for NPIV FC Target Lport */ 65 67 char lport_npiv_name[TCM_QLA2XXX_NPIV_NAMELEN]; 66 68 /* map for fc_port pointers in 24-bit FC Port ID space */
+18
drivers/target/target_core_sbc.c
··· 135 135 return 0; 136 136 } 137 137 138 + static int sbc_emulate_noop(struct se_cmd *cmd) 139 + { 140 + target_complete_cmd(cmd, GOOD); 141 + return 0; 142 + } 143 + 138 144 static inline u32 sbc_get_size(struct se_cmd *cmd, u32 sectors) 139 145 { 140 146 return cmd->se_dev->se_sub_dev->se_dev_attrib.block_size * sectors; ··· 536 530 case VERIFY: 537 531 size = 0; 538 532 cmd->execute_cmd = sbc_emulate_verify; 533 + break; 534 + case REZERO_UNIT: 535 + case SEEK_6: 536 + case SEEK_10: 537 + /* 538 + * There are still clients out there which use these old SCSI-2 539 + * commands. This mainly happens when running VMs with legacy 540 + * guest systems, connected via SCSI command pass-through to 541 + * iSCSI targets. Make them happy and return status GOOD. 542 + */ 543 + size = 0; 544 + cmd->execute_cmd = sbc_emulate_noop; 539 545 break; 540 546 default: 541 547 ret = spc_parse_cdb(cmd, &size);
-1
drivers/target/target_core_transport.c
··· 1616 1616 1617 1617 se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST; 1618 1618 se_cmd->se_tfo->queue_tm_rsp(se_cmd); 1619 - transport_generic_free_cmd(se_cmd, 0); 1620 1619 } 1621 1620 1622 1621 /**