aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp/srpt
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-22 15:38:04 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-22 15:38:04 -0400
commit1ab142d499294b844ecc81e8004db4ce029b0b61 (patch)
tree9db85a456d0cba3de8b9bd6671b1b52fa939770c /drivers/infiniband/ulp/srpt
parent267d7b23dd62f6ec55e0fba777e456495c308fc7 (diff)
parent187e70a554e0f0717a65998bc9199945cbbd4692 (diff)
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target updates from Nicholas Bellinger: "This contains the usual set of updates and bugfixes to target-core + existing fabric module code, along with a handful of the patches destined for v3.3 stable. It also contains the necessary target-core infrastructure pieces required to run using tcm_qla2xxx.ko WWPNs with the new Qlogic Fibre Channel fabric module currently queued in target-pending/for-next-merge, and coming for round 2. The highlights for this series include: - Add target_submit_tmr() helper function for fabric task management (andy) - Convert tcm_fc to use target_submit_tmr() (andy) - Replace target core various cmd flags with a transport state (hch) - Convert loopback to use workqueue submission (hch) - Convert target core to use array_zalloc for tpg_lun_list (joern) - Convert target core to use array_zalloc for device_list (joern) - Add target core support for TMR_ABORT_TASK (nab) - Add target core se_sess->sess_kref + get/put helpers (nab) - Add target core se_node_acl->acl_kref for ->acl_free_comp usage (nab) - Convert iscsi-target to use target_put_session + sess_kref (nab) - Fix tcm_fc fc_exch memory leak in ft_send_resp_status (nab) - Fix ib_srpt srpt_handle_cmd send_ioctx->ioctx_kref leak on exception (nab) - Fix target core up handling of short INQUIRY buffers (roland) - Untangle target-core front-end and back-end meanings of max_sectors attribute (roland) - Set loopback residual field for SCSI commands (roland) - Fix target-core 16-bit target ports for SET TARGET PORT GROUPS emulation (roland) Thanks again to Andy, Christoph, Joern, Roland, and everyone who has contributed this round!" * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (64 commits) ib_srpt: Fix srpt_handle_cmd send_ioctx->ioctx_kref leak on exception loopback: Fix transport_generic_allocate_tasks error handling iscsi-target: remove improper externs iscsi-target: Remove unused variables in iscsi_target_parameters.c target: remove obvious warnings target: Use array_zalloc for device_list target: Use array_zalloc for tpg_lun_list target: Fix sense code for unsupported SERVICE ACTION IN target: Remove hack to make READ CAPACITY(10) lie if thin provisioning is enabled target: Bump core version to v4.1.0-rc2-ml + fabric versions tcm_fc: Fix fc_exch memory leak in ft_send_resp_status target: Drop unused legacy target_core_fabric_ops API callers iscsi-target: Convert to use target_put_session + sess_kref target: Convert se_node_acl->acl_group removal to use ->acl_kref target: Add se_node_acl->acl_kref for ->acl_free_comp usage target: Add se_node_acl->acl_free_comp for NodeACL release path target: Add se_sess->sess_kref + get/put helpers target: Convert session_lock to irqsave target: Fix typo in drivers/target iscsi-target: Fix dynamic -> explict NodeACL pointer reference ...
Diffstat (limited to 'drivers/infiniband/ulp/srpt')
-rw-r--r--drivers/infiniband/ulp/srpt/ib_srpt.c64
1 files changed, 24 insertions, 40 deletions
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index ebe33d960d77..69e2ad06e515 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -1378,7 +1378,9 @@ static int srpt_abort_cmd(struct srpt_send_ioctx *ioctx)
1378 break; 1378 break;
1379 case SRPT_STATE_NEED_DATA: 1379 case SRPT_STATE_NEED_DATA:
1380 /* DMA_TO_DEVICE (write) - RDMA read error. */ 1380 /* DMA_TO_DEVICE (write) - RDMA read error. */
1381 atomic_set(&ioctx->cmd.transport_lun_stop, 1); 1381 spin_lock_irqsave(&ioctx->cmd.t_state_lock, flags);
1382 ioctx->cmd.transport_state |= CMD_T_LUN_STOP;
1383 spin_unlock_irqrestore(&ioctx->cmd.t_state_lock, flags);
1382 transport_generic_handle_data(&ioctx->cmd); 1384 transport_generic_handle_data(&ioctx->cmd);
1383 break; 1385 break;
1384 case SRPT_STATE_CMD_RSP_SENT: 1386 case SRPT_STATE_CMD_RSP_SENT:
@@ -1387,7 +1389,9 @@ static int srpt_abort_cmd(struct srpt_send_ioctx *ioctx)
1387 * not been received in time. 1389 * not been received in time.
1388 */ 1390 */
1389 srpt_unmap_sg_to_ib_sge(ioctx->ch, ioctx); 1391 srpt_unmap_sg_to_ib_sge(ioctx->ch, ioctx);
1390 atomic_set(&ioctx->cmd.transport_lun_stop, 1); 1392 spin_lock_irqsave(&ioctx->cmd.t_state_lock, flags);
1393 ioctx->cmd.transport_state |= CMD_T_LUN_STOP;
1394 spin_unlock_irqrestore(&ioctx->cmd.t_state_lock, flags);
1391 kref_put(&ioctx->kref, srpt_put_send_ioctx_kref); 1395 kref_put(&ioctx->kref, srpt_put_send_ioctx_kref);
1392 break; 1396 break;
1393 case SRPT_STATE_MGMT_RSP_SENT: 1397 case SRPT_STATE_MGMT_RSP_SENT:
@@ -1494,6 +1498,7 @@ static void srpt_handle_rdma_err_comp(struct srpt_rdma_ch *ch,
1494{ 1498{
1495 struct se_cmd *cmd; 1499 struct se_cmd *cmd;
1496 enum srpt_command_state state; 1500 enum srpt_command_state state;
1501 unsigned long flags;
1497 1502
1498 cmd = &ioctx->cmd; 1503 cmd = &ioctx->cmd;
1499 state = srpt_get_cmd_state(ioctx); 1504 state = srpt_get_cmd_state(ioctx);
@@ -1513,7 +1518,9 @@ static void srpt_handle_rdma_err_comp(struct srpt_rdma_ch *ch,
1513 __func__, __LINE__, state); 1518 __func__, __LINE__, state);
1514 break; 1519 break;
1515 case SRPT_RDMA_WRITE_LAST: 1520 case SRPT_RDMA_WRITE_LAST:
1516 atomic_set(&ioctx->cmd.transport_lun_stop, 1); 1521 spin_lock_irqsave(&ioctx->cmd.t_state_lock, flags);
1522 ioctx->cmd.transport_state |= CMD_T_LUN_STOP;
1523 spin_unlock_irqrestore(&ioctx->cmd.t_state_lock, flags);
1517 break; 1524 break;
1518 default: 1525 default:
1519 printk(KERN_ERR "%s[%d]: opcode = %u\n", __func__, 1526 printk(KERN_ERR "%s[%d]: opcode = %u\n", __func__,
@@ -1750,6 +1757,7 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
1750 srp_cmd->tag); 1757 srp_cmd->tag);
1751 cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; 1758 cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION;
1752 cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; 1759 cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD;
1760 kref_put(&send_ioctx->kref, srpt_put_send_ioctx_kref);
1753 goto send_sense; 1761 goto send_sense;
1754 } 1762 }
1755 1763
@@ -1757,15 +1765,19 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
1757 cmd->data_direction = dir; 1765 cmd->data_direction = dir;
1758 unpacked_lun = srpt_unpack_lun((uint8_t *)&srp_cmd->lun, 1766 unpacked_lun = srpt_unpack_lun((uint8_t *)&srp_cmd->lun,
1759 sizeof(srp_cmd->lun)); 1767 sizeof(srp_cmd->lun));
1760 if (transport_lookup_cmd_lun(cmd, unpacked_lun) < 0) 1768 if (transport_lookup_cmd_lun(cmd, unpacked_lun) < 0) {
1769 kref_put(&send_ioctx->kref, srpt_put_send_ioctx_kref);
1761 goto send_sense; 1770 goto send_sense;
1771 }
1762 ret = transport_generic_allocate_tasks(cmd, srp_cmd->cdb); 1772 ret = transport_generic_allocate_tasks(cmd, srp_cmd->cdb);
1763 if (cmd->se_cmd_flags & SCF_SCSI_RESERVATION_CONFLICT) 1773 if (ret < 0) {
1764 srpt_queue_status(cmd); 1774 kref_put(&send_ioctx->kref, srpt_put_send_ioctx_kref);
1765 else if (cmd->se_cmd_flags & SCF_SCSI_CDB_EXCEPTION) 1775 if (cmd->se_cmd_flags & SCF_SCSI_RESERVATION_CONFLICT) {
1766 goto send_sense; 1776 srpt_queue_status(cmd);
1767 else 1777 return 0;
1768 WARN_ON_ONCE(ret); 1778 } else
1779 goto send_sense;
1780 }
1769 1781
1770 transport_handle_cdb_direct(cmd); 1782 transport_handle_cdb_direct(cmd);
1771 return 0; 1783 return 0;
@@ -1871,8 +1883,8 @@ static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch,
1871 TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED; 1883 TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED;
1872 goto process_tmr; 1884 goto process_tmr;
1873 } 1885 }
1874 cmd->se_tmr_req = core_tmr_alloc_req(cmd, NULL, tcm_tmr, GFP_KERNEL); 1886 res = core_tmr_alloc_req(cmd, NULL, tcm_tmr, GFP_KERNEL);
1875 if (!cmd->se_tmr_req) { 1887 if (res < 0) {
1876 send_ioctx->cmd.se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; 1888 send_ioctx->cmd.se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION;
1877 send_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED; 1889 send_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED;
1878 goto process_tmr; 1890 goto process_tmr;
@@ -3514,25 +3526,6 @@ static void srpt_close_session(struct se_session *se_sess)
3514} 3526}
3515 3527
3516/** 3528/**
3517 * To do: Find out whether stop_session() has a meaning for transports
3518 * other than iSCSI.
3519 */
3520static void srpt_stop_session(struct se_session *se_sess, int sess_sleep,
3521 int conn_sleep)
3522{
3523}
3524
3525static void srpt_reset_nexus(struct se_session *sess)
3526{
3527 printk(KERN_ERR "This is the SRP protocol, not iSCSI\n");
3528}
3529
3530static int srpt_sess_logged_in(struct se_session *se_sess)
3531{
3532 return true;
3533}
3534
3535/**
3536 * srpt_sess_get_index() - Return the value of scsiAttIntrPortIndex (SCSI-MIB). 3529 * srpt_sess_get_index() - Return the value of scsiAttIntrPortIndex (SCSI-MIB).
3537 * 3530 *
3538 * A quote from RFC 4455 (SCSI-MIB) about this MIB object: 3531 * A quote from RFC 4455 (SCSI-MIB) about this MIB object:
@@ -3576,11 +3569,6 @@ static u16 srpt_get_fabric_sense_len(void)
3576 return 0; 3569 return 0;
3577} 3570}
3578 3571
3579static int srpt_is_state_remove(struct se_cmd *se_cmd)
3580{
3581 return 0;
3582}
3583
3584/** 3572/**
3585 * srpt_parse_i_port_id() - Parse an initiator port ID. 3573 * srpt_parse_i_port_id() - Parse an initiator port ID.
3586 * @name: ASCII representation of a 128-bit initiator port ID. 3574 * @name: ASCII representation of a 128-bit initiator port ID.
@@ -3950,9 +3938,6 @@ static struct target_core_fabric_ops srpt_template = {
3950 .check_stop_free = srpt_check_stop_free, 3938 .check_stop_free = srpt_check_stop_free,
3951 .shutdown_session = srpt_shutdown_session, 3939 .shutdown_session = srpt_shutdown_session,
3952 .close_session = srpt_close_session, 3940 .close_session = srpt_close_session,
3953 .stop_session = srpt_stop_session,
3954 .fall_back_to_erl0 = srpt_reset_nexus,
3955 .sess_logged_in = srpt_sess_logged_in,
3956 .sess_get_index = srpt_sess_get_index, 3941 .sess_get_index = srpt_sess_get_index,
3957 .sess_get_initiator_sid = NULL, 3942 .sess_get_initiator_sid = NULL,
3958 .write_pending = srpt_write_pending, 3943 .write_pending = srpt_write_pending,
@@ -3965,7 +3950,6 @@ static struct target_core_fabric_ops srpt_template = {
3965 .queue_tm_rsp = srpt_queue_response, 3950 .queue_tm_rsp = srpt_queue_response,
3966 .get_fabric_sense_len = srpt_get_fabric_sense_len, 3951 .get_fabric_sense_len = srpt_get_fabric_sense_len,
3967 .set_fabric_sense_len = srpt_set_fabric_sense_len, 3952 .set_fabric_sense_len = srpt_set_fabric_sense_len,
3968 .is_state_remove = srpt_is_state_remove,
3969 /* 3953 /*
3970 * Setup function pointers for generic logic in 3954 * Setup function pointers for generic logic in
3971 * target_core_fabric_configfs.c 3955 * target_core_fabric_configfs.c