Commit 34a9d2c3 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch '3.2-rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending

* '3.2-rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (25 commits)
  iscsi-target: Fix hex2bin warn_unused compile message
  target: Don't return an error if disabling unsupported features
  target/rd: fix or rewrite the copy routine
  target/rd: simplify the page/offset computation
  target: remove the unused se_dev_list
  target/file: walk properly over sg list
  target: remove unused struct fields
  target: Fix page length in emulated INQUIRY VPD page 86h
  target: Handle 0 correctly in transport_get_sectors_6()
  target: Don't return an error status for 0-length READ and WRITE
  iscsi-target: Use kmemdup rather than duplicating its implementation
  iscsi-target: Add missing F_BIT for iscsi_tm_rsp
  iscsi-target: Fix residual count hanlding + remove iscsi_cmd->residual_count
  target: Reject SCSI data overflow for fabrics using transport_generic_map_mem_to_cmd
  target: remove the unused t_task_pt_sgl and t_task_pt_sgl_num se_cmd fields
  target: remove the t_tasks_bidi se_cmd field
  target: remove the t_tasks_fua se_cmd field
  target: remove the se_ordered_node se_cmd field
  target: remove the se_obj_ptr and se_orig_obj_ptr se_cmd fields
  target: Drop config_item_name usage in fabric TFO->free_wwn()
  ...
parents a694ad94 ddca8f3e
...@@ -614,13 +614,12 @@ int iscsit_add_reject( ...@@ -614,13 +614,12 @@ int iscsit_add_reject(
hdr = (struct iscsi_reject *) cmd->pdu; hdr = (struct iscsi_reject *) cmd->pdu;
hdr->reason = reason; hdr->reason = reason;
cmd->buf_ptr = kzalloc(ISCSI_HDR_LEN, GFP_KERNEL); cmd->buf_ptr = kmemdup(buf, ISCSI_HDR_LEN, GFP_KERNEL);
if (!cmd->buf_ptr) { if (!cmd->buf_ptr) {
pr_err("Unable to allocate memory for cmd->buf_ptr\n"); pr_err("Unable to allocate memory for cmd->buf_ptr\n");
iscsit_release_cmd(cmd); iscsit_release_cmd(cmd);
return -1; return -1;
} }
memcpy(cmd->buf_ptr, buf, ISCSI_HDR_LEN);
spin_lock_bh(&conn->cmd_lock); spin_lock_bh(&conn->cmd_lock);
list_add_tail(&cmd->i_list, &conn->conn_cmd_list); list_add_tail(&cmd->i_list, &conn->conn_cmd_list);
...@@ -661,13 +660,12 @@ int iscsit_add_reject_from_cmd( ...@@ -661,13 +660,12 @@ int iscsit_add_reject_from_cmd(
hdr = (struct iscsi_reject *) cmd->pdu; hdr = (struct iscsi_reject *) cmd->pdu;
hdr->reason = reason; hdr->reason = reason;
cmd->buf_ptr = kzalloc(ISCSI_HDR_LEN, GFP_KERNEL); cmd->buf_ptr = kmemdup(buf, ISCSI_HDR_LEN, GFP_KERNEL);
if (!cmd->buf_ptr) { if (!cmd->buf_ptr) {
pr_err("Unable to allocate memory for cmd->buf_ptr\n"); pr_err("Unable to allocate memory for cmd->buf_ptr\n");
iscsit_release_cmd(cmd); iscsit_release_cmd(cmd);
return -1; return -1;
} }
memcpy(cmd->buf_ptr, buf, ISCSI_HDR_LEN);
if (add_to_conn) { if (add_to_conn) {
spin_lock_bh(&conn->cmd_lock); spin_lock_bh(&conn->cmd_lock);
...@@ -1017,11 +1015,6 @@ static int iscsit_handle_scsi_cmd( ...@@ -1017,11 +1015,6 @@ static int iscsit_handle_scsi_cmd(
" non-existent or non-exported iSCSI LUN:" " non-existent or non-exported iSCSI LUN:"
" 0x%016Lx\n", get_unaligned_le64(&hdr->lun)); " 0x%016Lx\n", get_unaligned_le64(&hdr->lun));
} }
if (ret == PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES)
return iscsit_add_reject_from_cmd(
ISCSI_REASON_BOOKMARK_NO_RESOURCES,
1, 1, buf, cmd);
send_check_condition = 1; send_check_condition = 1;
goto attach_cmd; goto attach_cmd;
} }
...@@ -1044,6 +1037,8 @@ static int iscsit_handle_scsi_cmd( ...@@ -1044,6 +1037,8 @@ static int iscsit_handle_scsi_cmd(
*/ */
send_check_condition = 1; send_check_condition = 1;
} else { } else {
cmd->data_length = cmd->se_cmd.data_length;
if (iscsit_decide_list_to_build(cmd, payload_length) < 0) if (iscsit_decide_list_to_build(cmd, payload_length) < 0)
return iscsit_add_reject_from_cmd( return iscsit_add_reject_from_cmd(
ISCSI_REASON_BOOKMARK_NO_RESOURCES, ISCSI_REASON_BOOKMARK_NO_RESOURCES,
...@@ -1123,7 +1118,7 @@ static int iscsit_handle_scsi_cmd( ...@@ -1123,7 +1118,7 @@ static int iscsit_handle_scsi_cmd(
* the backend memory allocation. * the backend memory allocation.
*/ */
ret = transport_generic_new_cmd(&cmd->se_cmd); ret = transport_generic_new_cmd(&cmd->se_cmd);
if ((ret < 0) || (cmd->se_cmd.se_cmd_flags & SCF_SE_CMD_FAILED)) { if (ret < 0) {
immed_ret = IMMEDIATE_DATA_NORMAL_OPERATION; immed_ret = IMMEDIATE_DATA_NORMAL_OPERATION;
dump_immediate_data = 1; dump_immediate_data = 1;
goto after_immediate_data; goto after_immediate_data;
...@@ -1341,7 +1336,7 @@ static int iscsit_handle_data_out(struct iscsi_conn *conn, unsigned char *buf) ...@@ -1341,7 +1336,7 @@ static int iscsit_handle_data_out(struct iscsi_conn *conn, unsigned char *buf)
spin_lock_irqsave(&se_cmd->t_state_lock, flags); spin_lock_irqsave(&se_cmd->t_state_lock, flags);
if (!(se_cmd->se_cmd_flags & SCF_SUPPORTED_SAM_OPCODE) || if (!(se_cmd->se_cmd_flags & SCF_SUPPORTED_SAM_OPCODE) ||
(se_cmd->se_cmd_flags & SCF_SE_CMD_FAILED)) (se_cmd->se_cmd_flags & SCF_SCSI_CDB_EXCEPTION))
dump_unsolicited_data = 1; dump_unsolicited_data = 1;
spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); spin_unlock_irqrestore(&se_cmd->t_state_lock, flags);
...@@ -2513,10 +2508,10 @@ static int iscsit_send_data_in( ...@@ -2513,10 +2508,10 @@ static int iscsit_send_data_in(
if (hdr->flags & ISCSI_FLAG_DATA_STATUS) { if (hdr->flags & ISCSI_FLAG_DATA_STATUS) {
if (cmd->se_cmd.se_cmd_flags & SCF_OVERFLOW_BIT) { if (cmd->se_cmd.se_cmd_flags & SCF_OVERFLOW_BIT) {
hdr->flags |= ISCSI_FLAG_DATA_OVERFLOW; hdr->flags |= ISCSI_FLAG_DATA_OVERFLOW;
hdr->residual_count = cpu_to_be32(cmd->residual_count); hdr->residual_count = cpu_to_be32(cmd->se_cmd.residual_count);
} else if (cmd->se_cmd.se_cmd_flags & SCF_UNDERFLOW_BIT) { } else if (cmd->se_cmd.se_cmd_flags & SCF_UNDERFLOW_BIT) {
hdr->flags |= ISCSI_FLAG_DATA_UNDERFLOW; hdr->flags |= ISCSI_FLAG_DATA_UNDERFLOW;
hdr->residual_count = cpu_to_be32(cmd->residual_count); hdr->residual_count = cpu_to_be32(cmd->se_cmd.residual_count);
} }
} }
hton24(hdr->dlength, datain.length); hton24(hdr->dlength, datain.length);
...@@ -3018,10 +3013,10 @@ static int iscsit_send_status( ...@@ -3018,10 +3013,10 @@ static int iscsit_send_status(
hdr->flags |= ISCSI_FLAG_CMD_FINAL; hdr->flags |= ISCSI_FLAG_CMD_FINAL;
if (cmd->se_cmd.se_cmd_flags & SCF_OVERFLOW_BIT) { if (cmd->se_cmd.se_cmd_flags & SCF_OVERFLOW_BIT) {
hdr->flags |= ISCSI_FLAG_CMD_OVERFLOW; hdr->flags |= ISCSI_FLAG_CMD_OVERFLOW;
hdr->residual_count = cpu_to_be32(cmd->residual_count); hdr->residual_count = cpu_to_be32(cmd->se_cmd.residual_count);
} else if (cmd->se_cmd.se_cmd_flags & SCF_UNDERFLOW_BIT) { } else if (cmd->se_cmd.se_cmd_flags & SCF_UNDERFLOW_BIT) {
hdr->flags |= ISCSI_FLAG_CMD_UNDERFLOW; hdr->flags |= ISCSI_FLAG_CMD_UNDERFLOW;
hdr->residual_count = cpu_to_be32(cmd->residual_count); hdr->residual_count = cpu_to_be32(cmd->se_cmd.residual_count);
} }
hdr->response = cmd->iscsi_response; hdr->response = cmd->iscsi_response;
hdr->cmd_status = cmd->se_cmd.scsi_status; hdr->cmd_status = cmd->se_cmd.scsi_status;
...@@ -3133,6 +3128,7 @@ static int iscsit_send_task_mgt_rsp( ...@@ -3133,6 +3128,7 @@ static int iscsit_send_task_mgt_rsp(
hdr = (struct iscsi_tm_rsp *) cmd->pdu; hdr = (struct iscsi_tm_rsp *) cmd->pdu;
memset(hdr, 0, ISCSI_HDR_LEN); memset(hdr, 0, ISCSI_HDR_LEN);
hdr->opcode = ISCSI_OP_SCSI_TMFUNC_RSP; hdr->opcode = ISCSI_OP_SCSI_TMFUNC_RSP;
hdr->flags = ISCSI_FLAG_CMD_FINAL;
hdr->response = iscsit_convert_tcm_tmr_rsp(se_tmr); hdr->response = iscsit_convert_tcm_tmr_rsp(se_tmr);
hdr->itt = cpu_to_be32(cmd->init_task_tag); hdr->itt = cpu_to_be32(cmd->init_task_tag);
cmd->stat_sn = conn->stat_sn++; cmd->stat_sn = conn->stat_sn++;
......
...@@ -30,9 +30,11 @@ ...@@ -30,9 +30,11 @@
static int chap_string_to_hex(unsigned char *dst, unsigned char *src, int len) static int chap_string_to_hex(unsigned char *dst, unsigned char *src, int len)
{ {
int j = DIV_ROUND_UP(len, 2); int j = DIV_ROUND_UP(len, 2), rc;
hex2bin(dst, src, j); rc = hex2bin(dst, src, j);
if (rc < 0)
pr_debug("CHAP string contains non hex digit symbols\n");
dst[j] = '\0'; dst[j] = '\0';
return j; return j;
......
...@@ -398,7 +398,6 @@ struct iscsi_cmd { ...@@ -398,7 +398,6 @@ struct iscsi_cmd {
u32 pdu_send_order; u32 pdu_send_order;
/* Current struct iscsi_pdu in struct iscsi_cmd->pdu_list */ /* Current struct iscsi_pdu in struct iscsi_cmd->pdu_list */
u32 pdu_start; u32 pdu_start;
u32 residual_count;
/* Next struct iscsi_seq to send in struct iscsi_cmd->seq_list */ /* Next struct iscsi_seq to send in struct iscsi_cmd->seq_list */
u32 seq_send_order; u32 seq_send_order;
/* Number of struct iscsi_seq in struct iscsi_cmd->seq_list */ /* Number of struct iscsi_seq in struct iscsi_cmd->seq_list */
...@@ -535,7 +534,6 @@ struct iscsi_conn { ...@@ -535,7 +534,6 @@ struct iscsi_conn {
atomic_t connection_exit; atomic_t connection_exit;
atomic_t connection_recovery; atomic_t connection_recovery;
atomic_t connection_reinstatement; atomic_t connection_reinstatement;
atomic_t connection_wait;
atomic_t connection_wait_rcfr; atomic_t connection_wait_rcfr;
atomic_t sleep_on_conn_wait_comp; atomic_t sleep_on_conn_wait_comp;
atomic_t transport_failed; atomic_t transport_failed;
...@@ -643,7 +641,6 @@ struct iscsi_session { ...@@ -643,7 +641,6 @@ struct iscsi_session {
atomic_t session_reinstatement; atomic_t session_reinstatement;
atomic_t session_stop_active; atomic_t session_stop_active;
atomic_t sleep_on_sess_wait_comp; atomic_t sleep_on_sess_wait_comp;
atomic_t transport_wait_cmds;
/* connection list */ /* connection list */
struct list_head sess_conn_list; struct list_head sess_conn_list;
struct list_head cr_active_list; struct list_head cr_active_list;
......
...@@ -938,8 +938,7 @@ int iscsit_execute_cmd(struct iscsi_cmd *cmd, int ooo) ...@@ -938,8 +938,7 @@ int iscsit_execute_cmd(struct iscsi_cmd *cmd, int ooo)
* handle the SCF_SCSI_RESERVATION_CONFLICT case here as well. * handle the SCF_SCSI_RESERVATION_CONFLICT case here as well.
*/ */
if (se_cmd->se_cmd_flags & SCF_SCSI_CDB_EXCEPTION) { if (se_cmd->se_cmd_flags & SCF_SCSI_CDB_EXCEPTION) {
if (se_cmd->se_cmd_flags & if (se_cmd->scsi_sense_reason == TCM_RESERVATION_CONFLICT) {
SCF_SCSI_RESERVATION_CONFLICT) {
cmd->i_state = ISTATE_SEND_STATUS; cmd->i_state = ISTATE_SEND_STATUS;
spin_unlock_bh(&cmd->istate_lock); spin_unlock_bh(&cmd->istate_lock);
iscsit_add_cmd_to_response_queue(cmd, cmd->conn, iscsit_add_cmd_to_response_queue(cmd, cmd->conn,
......
...@@ -224,7 +224,7 @@ static int iscsi_login_zero_tsih_s1( ...@@ -224,7 +224,7 @@ static int iscsi_login_zero_tsih_s1(
iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
ISCSI_LOGIN_STATUS_NO_RESOURCES); ISCSI_LOGIN_STATUS_NO_RESOURCES);
pr_err("Could not allocate memory for session\n"); pr_err("Could not allocate memory for session\n");
return -1; return -ENOMEM;
} }
iscsi_login_set_conn_values(sess, conn, pdu->cid); iscsi_login_set_conn_values(sess, conn, pdu->cid);
...@@ -250,7 +250,8 @@ static int iscsi_login_zero_tsih_s1( ...@@ -250,7 +250,8 @@ static int iscsi_login_zero_tsih_s1(
pr_err("idr_pre_get() for sess_idr failed\n"); pr_err("idr_pre_get() for sess_idr failed\n");
iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
ISCSI_LOGIN_STATUS_NO_RESOURCES); ISCSI_LOGIN_STATUS_NO_RESOURCES);
return -1; kfree(sess);
return -ENOMEM;
} }
spin_lock(&sess_idr_lock); spin_lock(&sess_idr_lock);
idr_get_new(&sess_idr, NULL, &sess->session_index); idr_get_new(&sess_idr, NULL, &sess->session_index);
...@@ -270,14 +271,16 @@ static int iscsi_login_zero_tsih_s1( ...@@ -270,14 +271,16 @@ static int iscsi_login_zero_tsih_s1(
ISCSI_LOGIN_STATUS_NO_RESOURCES); ISCSI_LOGIN_STATUS_NO_RESOURCES);
pr_err("Unable to allocate memory for" pr_err("Unable to allocate memory for"
" struct iscsi_sess_ops.\n"); " struct iscsi_sess_ops.\n");
return -1; kfree(sess);
return -ENOMEM;
} }
sess->se_sess = transport_init_session(); sess->se_sess = transport_init_session();
if (!sess->se_sess) { if (IS_ERR(sess->se_sess)) {
iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
ISCSI_LOGIN_STATUS_NO_RESOURCES); ISCSI_LOGIN_STATUS_NO_RESOURCES);
return -1; kfree(sess);
return -ENOMEM;
} }
return 0; return 0;
......
...@@ -981,14 +981,13 @@ struct iscsi_login *iscsi_target_init_negotiation( ...@@ -981,14 +981,13 @@ struct iscsi_login *iscsi_target_init_negotiation(
return NULL; return NULL;
} }
login->req = kzalloc(ISCSI_HDR_LEN, GFP_KERNEL); login->req = kmemdup(login_pdu, ISCSI_HDR_LEN, GFP_KERNEL);
if (!login->req) { if (!login->req) {
pr_err("Unable to allocate memory for Login Request.\n"); pr_err("Unable to allocate memory for Login Request.\n");
iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
ISCSI_LOGIN_STATUS_NO_RESOURCES); ISCSI_LOGIN_STATUS_NO_RESOURCES);
goto out; goto out;
} }
memcpy(login->req, login_pdu, ISCSI_HDR_LEN);
login->req_buf = kzalloc(MAX_KEY_VALUE_PAIRS, GFP_KERNEL); login->req_buf = kzalloc(MAX_KEY_VALUE_PAIRS, GFP_KERNEL);
if (!login->req_buf) { if (!login->req_buf) {
......
...@@ -113,11 +113,9 @@ static struct se_cmd *tcm_loop_allocate_core_cmd( ...@@ -113,11 +113,9 @@ static struct se_cmd *tcm_loop_allocate_core_cmd(
scsi_bufflen(sc), sc->sc_data_direction, sam_task_attr, scsi_bufflen(sc), sc->sc_data_direction, sam_task_attr,
&tl_cmd->tl_sense_buf[0]); &tl_cmd->tl_sense_buf[0]);
/*
* Signal BIDI usage with T_TASK(cmd)->t_tasks_bidi
*/
if (scsi_bidi_cmnd(sc)) if (scsi_bidi_cmnd(sc))
se_cmd->t_tasks_bidi = 1; se_cmd->se_cmd_flags |= SCF_BIDI;
/* /*
* Locate the struct se_lun pointer and attach it to struct se_cmd * Locate the struct se_lun pointer and attach it to struct se_cmd
*/ */
...@@ -148,27 +146,13 @@ static int tcm_loop_new_cmd_map(struct se_cmd *se_cmd) ...@@ -148,27 +146,13 @@ static int tcm_loop_new_cmd_map(struct se_cmd *se_cmd)
* Allocate the necessary tasks to complete the received CDB+data * Allocate the necessary tasks to complete the received CDB+data
*/ */
ret = transport_generic_allocate_tasks(se_cmd, sc->cmnd); ret = transport_generic_allocate_tasks(se_cmd, sc->cmnd);
if (ret == -ENOMEM) { if (ret != 0)
/* Out of Resources */ return ret;
return PYX_TRANSPORT_LU_COMM_FAILURE;
} else if (ret == -EINVAL) {
/*
* Handle case for SAM_STAT_RESERVATION_CONFLICT
*/
if (se_cmd->se_cmd_flags & SCF_SCSI_RESERVATION_CONFLICT)
return PYX_TRANSPORT_RESERVATION_CONFLICT;
/*
* Otherwise, return SAM_STAT_CHECK_CONDITION and return
* sense data.
*/
return PYX_TRANSPORT_USE_SENSE_REASON;
}
/* /*
* For BIDI commands, pass in the extra READ buffer * For BIDI commands, pass in the extra READ buffer
* to transport_generic_map_mem_to_cmd() below.. * to transport_generic_map_mem_to_cmd() below..
*/ */
if (se_cmd->t_tasks_bidi) { if (se_cmd->se_cmd_flags & SCF_BIDI) {
struct scsi_data_buffer *sdb = scsi_in(sc); struct scsi_data_buffer *sdb = scsi_in(sc);
sgl_bidi = sdb->table.sgl; sgl_bidi = sdb->table.sgl;
...@@ -194,12 +178,8 @@ static int tcm_loop_new_cmd_map(struct se_cmd *se_cmd) ...@@ -194,12 +178,8 @@ static int tcm_loop_new_cmd_map(struct se_cmd *se_cmd)
} }
/* Tell the core about our preallocated memory */ /* Tell the core about our preallocated memory */
ret = transport_generic_map_mem_to_cmd(se_cmd, scsi_sglist(sc), return transport_generic_map_mem_to_cmd(se_cmd, scsi_sglist(sc),
scsi_sg_count(sc), sgl_bidi, sgl_bidi_count); scsi_sg_count(sc), sgl_bidi, sgl_bidi_count);
if (ret < 0)
return PYX_TRANSPORT_LU_COMM_FAILURE;
return 0;
} }
/* /*
...@@ -1360,17 +1340,16 @@ void tcm_loop_drop_scsi_hba( ...@@ -1360,17 +1340,16 @@ void tcm_loop_drop_scsi_hba(
{ {
struct tcm_loop_hba *tl_hba = container_of(wwn, struct tcm_loop_hba *tl_hba = container_of(wwn,
struct tcm_loop_hba, tl_hba_wwn); struct tcm_loop_hba, tl_hba_wwn);
int host_no = tl_hba->sh->host_no;
pr_debug("TCM_Loop_ConfigFS: Deallocating emulated Target"
" SAS Address: %s at Linux/SCSI Host ID: %d\n",
tl_hba->tl_wwn_address, tl_hba->sh->host_no);
/* /*
* Call device_unregister() on the original tl_hba->dev. * Call device_unregister() on the original tl_hba->dev.
* tcm_loop_fabric_scsi.c:tcm_loop_release_adapter() will * tcm_loop_fabric_scsi.c:tcm_loop_release_adapter() will
* release *tl_hba; * release *tl_hba;
*/ */
device_unregister(&tl_hba->dev); device_unregister(&tl_hba->dev);
pr_debug("TCM_Loop_ConfigFS: Deallocated emulated Target"
" SAS Address: %s at Linux/SCSI Host ID: %d\n",
config_item_name(&wwn->wwn_group.cg_item), host_no);
} }
/* Start items for tcm_loop_cit */ /* Start items for tcm_loop_cit */
......
...@@ -191,9 +191,10 @@ int target_emulate_set_target_port_groups(struct se_task *task) ...@@ -191,9 +191,10 @@ int target_emulate_set_target_port_groups(struct se_task *task)
int alua_access_state, primary = 0, rc; int alua_access_state, primary = 0, rc;
u16 tg_pt_id, rtpi; u16 tg_pt_id, rtpi;
if (!l_port) if (!l_port) {
return PYX_TRANSPORT_LU_COMM_FAILURE; cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
return -EINVAL;
}
buf = transport_kmap_first_data_page(cmd); buf = transport_kmap_first_data_page(cmd);
/* /*
...@@ -203,7 +204,8 @@ int target_emulate_set_target_port_groups(struct se_task *task) ...@@ -203,7 +204,8 @@ int target_emulate_set_target_port_groups(struct se_task *task)
l_tg_pt_gp_mem = l_port->sep_alua_tg_pt_gp_mem; l_tg_pt_gp_mem = l_port->sep_alua_tg_pt_gp_mem;
if (!l_tg_pt_gp_mem) { if (!l_tg_pt_gp_mem) {
pr_err("Unable to access l_port->sep_alua_tg_pt_gp_mem\n"); pr_err("Unable to access l_port->sep_alua_tg_pt_gp_mem\n");
rc = PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE;
rc = -EINVAL;
goto out; goto out;
} }
spin_lock(&l_tg_pt_gp_mem->tg_pt_gp_mem_lock); spin_lock(&l_tg_pt_gp_mem->tg_pt_gp_mem_lock);
...@@ -211,7 +213,8 @@ int target_emulate_set_target_port_groups(struct se_task *task) ...@@ -211,7 +213,8 @@ int target_emulate_set_target_port_groups(struct se_task *task)
if (!l_tg_pt_gp) { if (!l_tg_pt_gp) {
spin_unlock(&l_tg_pt_gp_mem->tg_pt_gp_mem_lock); spin_unlock(&l_tg_pt_gp_mem->tg_pt_gp_mem_lock);
pr_err("Unable to access *l_tg_pt_gp_mem->tg_pt_gp\n"); pr_err("Unable to access *l_tg_pt_gp_mem->tg_pt_gp\n");
rc = PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE;
rc = -EINVAL;
goto out; goto out;
} }
rc = (l_tg_pt_gp->tg_pt_gp_alua_access_type & TPGS_EXPLICT_ALUA); rc = (l_tg_pt_gp->tg_pt_gp_alua_access_type & TPGS_EXPLICT_ALUA);
...@@ -220,7 +223,8 @@ int target_emulate_set_target_port_groups(struct se_task *task) ...@@ -220,7 +223,8 @@ int target_emulate_set_target_port_groups(struct se_task *task)
if (!rc) { if (!rc) {
pr_debug("Unable to process SET_TARGET_PORT_GROUPS" pr_debug("Unable to process SET_TARGET_PORT_GROUPS"
" while TPGS_EXPLICT_ALUA is disabled\n"); " while TPGS_EXPLICT_ALUA is disabled\n");
rc = PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE;
rc = -EINVAL;
goto out; goto out;
} }
...@@ -245,7 +249,8 @@ int target_emulate_set_target_port_groups(struct se_task *task) ...@@ -245,7 +249,8 @@ int target_emulate_set_target_port_groups(struct se_task *task)
* REQUEST, and the additional sense code set to INVALID * REQUEST, and the additional sense code set to INVALID
* FIELD IN PARAMETER LIST. * FIELD IN PARAMETER LIST.
*/ */
rc = PYX_TRANSPORT_INVALID_PARAMETER_LIST; cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST;
rc = -EINVAL;
goto out; goto out;
} }
rc = -1; rc = -1;
...@@ -298,7 +303,8 @@ int target_emulate_set_target_port_groups(struct se_task *task) ...@@ -298,7 +303,8 @@ int target_emulate_set_target_port_groups(struct se_task *task)
* throw an exception with ASCQ: INVALID_PARAMETER_LIST * throw an exception with ASCQ: INVALID_PARAMETER_LIST
*/ */
if (rc != 0) { if (rc != 0) {
rc = PYX_TRANSPORT_INVALID_PARAMETER_LIST; cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST;
rc = -EINVAL;
goto out; goto out;
} }
} else { } else {
...@@ -335,7 +341,8 @@ int target_emulate_set_target_port_groups(struct se_task *task) ...@@ -335,7 +341,8 @@ int target_emulate_set_target_port_groups(struct se_task *task)
* INVALID_PARAMETER_LIST * INVALID_PARAMETER_LIST
*/ */
if (rc != 0) { if (rc != 0) {
rc = PYX_TRANSPORT_INVALID_PARAMETER_LIST; cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST;
rc = -EINVAL;
goto out; goto out;
} }
} }
...@@ -1184,7 +1191,6 @@ void core_alua_free_lu_gp(struct t10_alua_lu_gp *lu_gp) ...@@ -1184,7 +1191,6 @@ void core_alua_free_lu_gp(struct t10_alua_lu_gp *lu_gp)
* struct t10_alua_lu_gp. * struct t10_alua_lu_gp.
*/ */
spin_lock(&lu_gps_lock); spin_lock(&lu_gps_lock);
atomic_set(&lu_gp->lu_gp_shutdown, 1);
list_del(&lu_gp->lu_gp_node); list_del(&lu_gp->lu_gp_node);
alua_lu_gps_count--; alua_lu_gps_count--;
spin_unlock(&lu_gps_lock); spin_unlock(&lu_gps_lock);
...@@ -1438,7 +1444,6 @@ struct t10_alua_tg_pt_gp_member *core_alua_allocate_tg_pt_gp_mem( ...@@ -1438,7 +1444,6 @@ struct t10_alua_tg_pt_gp_member *core_alua_allocate_tg_pt_gp_mem(
tg_pt_gp_mem->tg_pt = port; tg_pt_gp_mem->tg_pt = port;
port->sep_alua_tg_pt_gp_mem = tg_pt_gp_mem; port->sep_alua_tg_pt_gp_mem = tg_pt_gp_mem;
atomic_set(&port->sep_tg_pt_gp_active, 1);
return tg_pt_gp_mem; return tg_pt_gp_mem;
} }
......
...@@ -478,7 +478,7 @@ target_emulate_evpd_86(struct se_cmd *cmd, unsigned char *buf) ...@@ -478,7 +478,7 @@ target_emulate_evpd_86(struct se_cmd *cmd, unsigned char *buf)
if (cmd->data_length < 60) if (cmd->data_length < 60)
return 0; return 0;
buf[2] = 0x3c; buf[3] = 0x3c;
/* Set HEADSUP, ORDSUP, SIMPSUP */ /* Set HEADSUP, ORDSUP, SIMPSUP */
buf[5] = 0x07; buf[5] = 0x07;
...@@ -703,6 +703,7 @@ int target_emulate_inquiry(struct se_task *task) ...@@ -703,6 +703,7 @@ int target_emulate_inquiry(struct se_task *task)
if (cmd->data_length < 4) { if (cmd->data_length < 4) {
pr_err("SCSI Inquiry payload length: %u" pr_err("SCSI Inquiry payload length: %u"
" too small for EVPD=1\n", cmd->data_length); " too small for EVPD=1\n", cmd->data_length);
cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD;
return -EINVAL; return -EINVAL;
} }
...@@ -719,6 +720,7 @@ int target_emulate_inquiry(struct se_task *task) ...@@ -719,6 +720,7 @@ int target_emulate_inquiry(struct se_task *task)
} }
pr_err("Unknown VPD Code: 0x%02x\n", cdb[2]); pr_err("Unknown VPD Code: 0x%02x\n", cdb[2]);
cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE;
ret = -EINVAL; ret = -EINVAL;
out_unmap: out_unmap:
...@@ -969,7 +971,8 @@ int target_emulate_modesense(struct se_task *task) ...@@ -969,7 +971,8 @@ int target_emulate_modesense(struct se_task *task)
default: default:
pr_err("MODE SENSE: unimplemented page/subpage: 0x%02x/0x%02x\n", pr_err("MODE SENSE: unimplemented page/subpage: 0x%02x/0x%02x\n",
cdb[2] & 0x3f, cdb[3]); cdb[2] & 0x3f, cdb[3]);
return PYX_TRANSPORT_UNKNOWN_MODE_PAGE; cmd->scsi_sense_reason = TCM_UNKNOWN_MODE_PAGE;
return -EINVAL;
} }
offset += length; offset += length;
...@@ -1027,7 +1030,8 @@ int target_emulate_request_sense(struct se_task *task) ...@@ -1027,7 +1030,8 @@ int target_emulate_request_sense(struct se_task *task)
if (cdb[1] & 0x01) { if (cdb[1] & 0x01) {
pr_err("REQUEST_SENSE description emulation not" pr_err("REQUEST_SENSE description emulation not"
" supported\n"); " supported\n");
return PYX_TRANSPORT_INVALID_CDB_FIELD; cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD;
return -ENOSYS;
} }
buf = transport_kmap_first_data_page(cmd); buf = transport_kmap_first_data_page(cmd);
...@@ -1100,7 +1104,8 @@ int target_emulate_unmap(struct se_task *task) ...@@ -1100,7 +1104,8 @@ int target_emulate_unmap(struct se_task *task)
if (!dev->transport->do_discard) { if (!dev->transport->do_discard) {
pr_err("UNMAP emulation not supported for: %s\n", pr_err("UNMAP emulation not supported for: %s\n",
dev->transport->name); dev->transport->name);
return PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE;
return -ENOSYS;
} }
/* First UNMAP block descriptor starts at 8 byte offset */ /* First UNMAP block descriptor starts at 8 byte offset */
...@@ -1157,7 +1162,8 @@ int target_emulate_write_same(struct se_task *task) ...@@ -1157,7 +1162,8 @@ int target_emulate_write_same(struct se_task *task)
if (!dev->transport->do_discard) { if (!dev->transport->do_discard) {
pr_err("WRITE_SAME emulation not supported" pr_err("WRITE_SAME emulation not supported"
" for: %s\n", dev->transport->name); " for: %s\n", dev->transport->name);
return PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE;
return -ENOSYS;
} }
if (cmd->t_task_cdb[0] == WRITE_SAME) if (cmd->t_task_cdb[0] == WRITE_SAME)
...@@ -1193,11 +1199,13 @@ int target_emulate_write_same(struct se_task *task) ...@@ -1193,11 +1199,13 @@ int target_emulate_write_same(struct se_task *task)
int target_emulate_synchronize_cache(struct se_task *task) int target_emulate_synchronize_cache(struct se_task *task)
{ {
struct se_device *dev = task->task_se_cmd->se_dev; struct se_device *dev = task->task_se_cmd->se_dev;
struct se_cmd *cmd = task->task_se_cmd;
if (!dev->transport->do_sync_cache) { if (!dev->transport->do_sync_cache) {
pr_err("SYNCHRONIZE_CACHE emulation not supported" pr_err("SYNCHRONIZE_CACHE emulation not supported"
" for: %s\n", dev->transport->name); " for: %s\n", dev->transport->name);
return PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE;
return -ENOSYS;
} }
dev->transport->do_sync_cache(task); dev->transport->do_sync_cache(task);
......
...@@ -67,9 +67,6 @@ static struct config_group target_core_hbagroup; ...@@ -67,9 +67,6 @@ static struct config_group target_core_hbagroup;
static struct config_group alua_group; static struct config_group alua_group;
static struct config_group alua_lu_gps_group; static struct config_group alua_lu_gps_group;
static DEFINE_SPINLOCK(se_device_lock);
static LIST_HEAD(se_dev_list);
static inline struct se_hba * static inline struct se_hba *
item_to_hba(struct config_item *item) item_to_hba(struct config_item *item)
{ {
...@@ -2741,7 +2738,6 @@ static struct config_group *target_core_make_subdev( ...@@ -2741,7 +2738,6 @@ static struct config_group *target_core_make_subdev(
" struct se_subsystem_dev\n"); " struct se_subsystem_dev\n");
goto unlock; goto unlock;
} }
INIT_LIST_HEAD(&se_dev->se_dev_node);
INIT_LIST_HEAD(&se_dev->t10_wwn.t10_vpd_list); INIT_LIST_HEAD(&se_dev->t10_wwn.t10_vpd_list);
spin_lock_init(&se_dev->t10_wwn.t10_vpd_lock); spin_lock_init(&se_dev->t10_wwn.t10_vpd_lock);
INIT_LIST_HEAD(&se_dev->t10_pr.registration_list); INIT_LIST_HEAD(&se_dev->t10_pr.registration_list);
...@@ -2777,9 +2773,6 @@ static struct config_group *target_core_make_subdev( ...@@ -2777,9 +2773,6 @@ static struct config_group *target_core_make_subdev(
" from allocate_virtdevice()\n"); " from allocate_virtdevice()\n");
goto out; goto out;
} }
spin_lock(&se_device_lock);
list_add_tail(&se_dev->se_dev_node, &se_dev_list);
spin_unlock(&se_device_lock);
config_group_init_type_name(&se_dev->se_dev_group, name, config_group_init_type_name(&se_dev->se_dev_group, name,
&target_core_dev_cit); &target_core_dev_cit);
...@@ -2874,10 +2867,6 @@ static void target_core_drop_subdev( ...@@ -2874,10 +2867,6 @@ static void target_core_drop_subdev(
mutex_lock(&hba->hba_access_mutex); mutex_lock(&hba->hba_access_mutex);
t = hba->transport; t = hba->transport;
spin_lock(&se_device_lock);
list_del(&se_dev->se_dev_node);
spin_unlock(&se_device_lock);
dev_stat_grp = &se_dev->dev_stat_grps.stat_group; dev_stat_grp = &se_dev->dev_stat_grps.stat_group;
for (i = 0; dev_stat_grp->default_groups[i]; i++) { for (i = 0; dev_stat_grp->default_groups[i]; i++) {
df_item = &dev_stat_grp->default_groups[i]->cg_item; df_item = &dev_stat_grp->default_groups[i]->cg_item;
......
...@@ -104,7 +104,6 @@ int transport_lookup_cmd_lun(struct se_cmd *se_cmd, u32 unpacked_lun) ...@@ -104,7 +104,6 @@ int transport_lookup_cmd_lun(struct se_cmd *se_cmd, u32 unpacked_lun)
se_cmd->se_lun = deve->se_lun; se_cmd->se_lun = deve->se_lun;
se_cmd->pr_res_key = deve->pr_res_key; se_cmd->pr_res_key = deve->pr_res_key;
se_cmd->orig_fe_lun = unpacked_lun; se_cmd->orig_fe_lun = unpacked_lun;
se_cmd->se_orig_obj_ptr = se_cmd->se_lun->lun_se_dev;
se_cmd->se_cmd_flags |= SCF_SE_LUN_CMD; se_cmd->se_cmd_flags |= SCF_SE_LUN_CMD;
} }
spin_unlock_irqrestore(&se_sess->se_node_acl->device_list_lock, flags); spin_unlock_irqrestore(&se_sess->se_node_acl->device_list_lock, flags);
...@@ -137,7 +136,6 @@ int transport_lookup_cmd_lun(struct se_cmd *se_cmd, u32 unpacked_lun) ...@@ -137,7 +136,6 @@ int transport_lookup_cmd_lun(struct se_cmd *se_cmd, u32 unpacked_lun)
se_lun = &se_sess->se_tpg->tpg_virt_lun0; se_lun = &se_sess->se_tpg->tpg_virt_lun0;
se_cmd->se_lun = &se_sess->se_tpg->tpg_virt_lun0; se_cmd->se_lun = &se_sess->se_tpg->tpg_virt_lun0;
se_cmd->orig_fe_lun = 0; se_cmd->orig_fe_lun = 0;
se_cmd->se_orig_obj_ptr = se_cmd->se_lun->lun_se_dev;
se_cmd->se_cmd_flags |= SCF_SE_LUN_CMD; se_cmd->se_cmd_flags |= SCF_SE_LUN_CMD;
} }
/* /*
...@@ -200,7 +198,6 @@ int transport_lookup_tmr_lun(struct se_cmd *se_cmd, u32 unpacked_lun) ...@@ -200,7 +198,6 @@ int transport_lookup_tmr_lun(struct se_cmd *se_cmd, u32 unpacked_lun)
se_lun = deve->se_lun; se_lun = deve->se_lun;
se_cmd->pr_res_key = deve->pr_res_key; se_cmd->pr_res_key = deve->pr_res_key;
se_cmd->orig_fe_lun = unpacked_lun; se_cmd->orig_fe_lun = unpacked_lun;
se_cmd->se_orig_obj_ptr = se_cmd->se_dev;
} }
spin_unlock_irqrestore(&se_sess->se_node_acl->device_list_lock, flags); spin_unlock_irqrestore(&se_sess->se_node_acl->device_list_lock, flags);
...@@ -708,7 +705,7 @@ int target_report_luns(struct se_task *se_task) ...@@ -708,7 +705,7 @@ int target_report_luns(struct se_task *se_task)
se_task->task_scsi_status = GOOD; se_task->task_scsi_status = GOOD;
transport_complete_task(se_task, 1); transport_complete_task(se_task, 1);
return PYX_TRANSPORT_SENT_TO_TRANSPORT; return 0;
} }
/* se_release_device_for_hba(): /* se_release_device_for_hba():
...@@ -957,8 +954,12 @@ int se_dev_set_emulate_dpo(struct se_device *dev, int flag) ...@@ -957,8 +954,12 @@ int se_dev_set_emulate_dpo(struct se_device *dev, int flag)
return -EINVAL; return -EINVAL;
} }
pr_err("dpo_emulated not supported\n"); if (flag) {
return -EINVAL; pr_err("dpo_emulated not supported\n");
return -EINVAL;
}
return 0;
} }
int se_dev_set_emulate_fua_write(struct se_device *dev, int flag) int se_dev_set_emulate_fua_write(struct se_device *dev, int flag)
...@@ -968,7 +969,7 @@ int se_dev_set_emulate_fua_write(struct se_device *dev, int flag) ...@@ -968,7 +969,7 @@ int se_dev_set_emulate_fua_write(struct se_device *dev, int flag)
return -EINVAL; return -EINVAL;
} }
if (dev->transport->fua_write_emulated == 0) { if (flag && dev->transport->fua_write_emulated == 0) {
pr_err("fua_write_emulated not supported\n"); pr_err("fua_write_emulated not supported\n");
return -EINVAL; return -EINVAL;
} }
...@@ -985,8 +986,12 @@ int se_dev_set_emulate_fua_read(struct se_device *dev, int flag) ...@@ -985,8 +986,12 @@ int se_dev_set_emulate_fua_read(struct se_device *dev, int flag)
return -EINVAL; return -EINVAL;
} }
pr_err("ua read emulated not supported\n"); if (flag) {
return -EINVAL; pr_err("ua read emulated not supported\n");
return -EINVAL;
}
return 0;
} }
int se_dev_set_emulate_write_cache(struct se_device *dev, int flag) int se_dev_set_emulate_write_cache(struct se_device *dev, int flag)
...@@ -995,7 +1000,7 @@ int se_dev_set_emulate_write_cache(struct se_device *dev, int flag) ...@@ -995,7 +1000,7 @@ int se_dev_set_emulate_write_cache(struct se_device *dev, int flag)
pr_err("Illegal value %d\n", flag); pr_err("Illegal value %d\n", flag);
return -EINVAL; return -EINVAL;
} }
if (dev->transport->write_cache_emulated == 0) { if (flag && dev->transport->write_cache_emulated == 0) {
pr_err("write_cache_emulated not supported\n"); pr_err("write_cache_emulated not supported\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1056,7 +1061,7 @@ int se_dev_set_emulate_tpu(struct se_device *dev, int flag) ...@@ -1056,7 +1061,7 @@ int se_dev_set_emulate_tpu(struct se_device *dev, int flag)
* We expect this value to be non-zero when generic Block Layer * We expect this value to be non-zero when generic Block Layer
* Discard supported is detected iblock_create_virtdevice(). * Discard supported is detected iblock_create_virtdevice().
*/ */
if (!dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) { if (flag && !dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) {
pr_err("Generic Block Discard not supported\n"); pr_err("Generic Block Discard not supported\n");
return -ENOSYS; return -ENOSYS;
} }
...@@ -1077,7 +1082,7 @@ int se_dev_set_emulate_tpws(struct se_device *dev, int flag) ...@@ -1077,7 +1082,7 @@ int se_dev_set_emulate_tpws(struct se_device *dev, int flag)
* We expect this value to be non-zero when generic Block Layer * We expect this value to be non-zero when generic Block Layer
* Discard supported is detected iblock_create_virtdevice(). * Discard supported is detected iblock_create_virtdevice().
*/ */
if (!dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) { if (flag && !dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) {
pr_err("Generic Block Discard not supported\n"); pr_err("Generic Block Discard not supported\n");
return -ENOSYS; return -ENOSYS;
} }
...@@ -1587,7 +1592,6 @@ int core_dev_setup_virtual_lun0(void) ...@@ -1587,7 +1592,6 @@ int core_dev_setup_virtual_lun0(void)
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
INIT_LIST_HEAD(&se_dev->se_dev_node);
INIT_LIST_HEAD(&se_dev->t10_wwn.t10_vpd_list); INIT_LIST_HEAD(&se_dev->t10_wwn.t10_vpd_list);
spin_lock_init(&se_dev->t10_wwn.t10_vpd_lock); spin_lock_init(&se_dev->t10_wwn.t10_vpd_lock);
INIT_LIST_HEAD(&se_dev->t10_pr.registration_list); INIT_LIST_HEAD(&se_dev->t10_pr.registration_list);
......
...@@ -289,9 +289,9 @@ static int fd_do_readv(struct se_task *task) ...@@ -289,9 +289,9 @@ static int fd_do_readv(struct se_task *task)
return -ENOMEM; return -ENOMEM;
} }
for (i = 0; i < task->task_sg_nents; i++) { for_each_sg(task->task_sg, sg, task->task_sg_nents, i) {
iov[i].iov_len = sg[i].length; iov[i].iov_len = sg->length;
iov[i].iov_base = sg_virt(&sg[i]); iov[i].iov_base = sg_virt(sg);
} }
old_fs = get_fs(); old_fs = get_fs();
...@@ -342,9 +342,9 @@ static int fd_do_writev(struct se_task *task) ...@@ -342,9 +342,9 @@ static int fd_do_writev(struct se_task *task)
return -ENOMEM; return -ENOMEM;
} }
for (i = 0; i < task->task_sg_nents; i++) { for_each_sg(task->task_sg, sg, task->task_sg_nents, i) {
iov[i].iov_len = sg[i].length; iov[i].iov_len = sg->length;
iov[i].iov_base = sg_virt(&sg[i]); iov[i].iov_base = sg_virt(sg);
} }
old_fs = get_fs(); old_fs = get_fs();
...@@ -438,7 +438,7 @@ static int fd_do_task(struct se_task *task) ...@@ -438,7 +438,7 @@ static int fd_do_task(struct se_task *task)
if (ret > 0 && if (ret > 0 &&
dev->se_sub_dev->se_dev_attrib.emulate_write_cache > 0 && dev->se_sub_dev->se_dev_attrib.emulate_write_cache > 0 &&
dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0 && dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0 &&
cmd->t_tasks_fua) { (cmd->se_cmd_flags & SCF_FUA)) {
/* /*
* We might need to be a bit smarter here * We might need to be a bit smarter here
* and return some sense data to let the initiator * and return some sense data to let the initiator
...@@ -449,13 +449,15 @@ static int fd_do_task(struct se_task *task) ...@@ -449,13 +449,15 @@ static int fd_do_task(struct se_task *task)
} }
if (ret < 0) if (ret < 0) {
cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
return ret; return ret;
}
if (ret) { if (ret) {
task->task_scsi_status = GOOD; task->task_scsi_status = GOOD;
transport_complete_task(task, 1); transport_complete_task(task, 1);
} }
return PYX_TRANSPORT_SENT_TO_TRANSPORT; return 0;
} }
/* fd_free_task(): (Part of se_subsystem_api_t template) /* fd_free_task(): (Part of se_subsystem_api_t template)
......
...@@ -531,7 +531,7 @@ static int iblock_do_task(struct se_task *task) ...@@ -531,7 +531,7 @@ static int iblock_do_task(struct se_task *task)
*/ */
if (dev->se_sub_dev->se_dev_attrib.emulate_write_cache == 0 || if (dev->se_sub_dev->se_dev_attrib.emulate_write_cache == 0 ||
(dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0 && (dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0 &&
task->task_se_cmd->t_tasks_fua)) (cmd->se_cmd_flags & SCF_FUA)))
rw = WRITE_FUA; rw = WRITE_FUA;
else else
rw = WRITE; rw = WRITE;
...@@ -554,12 +554,15 @@ static int iblock_do_task(struct se_task *task) ...@@ -554,12 +554,15 @@ static int iblock_do_task(struct se_task *task)
else { else {
pr_err("Unsupported SCSI -> BLOCK LBA conversion:" pr_err("Unsupported SCSI -> BLOCK LBA conversion:"
" %u\n", dev->se_sub_dev->se_dev_attrib.block_size); " %u\n", dev->se_sub_dev->se_dev_attrib.block_size);
return PYX_TRANSPORT_LU_COMM_FAILURE; cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
return -ENOSYS;
} }
bio = iblock_get_bio(task, block_lba, sg_num); bio = iblock_get_bio(task, block_lba, sg_num);
if (!bio) if (!bio) {
return PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES; cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
return -ENOMEM;
}
bio_list_init(&list); bio_list_init(&list);
bio_list_add(&list, bio); bio_list_add(&list, bio);
...@@ -588,12 +591,13 @@ static int iblock_do_task(struct se_task *task) ...@@ -588,12 +591,13 @@ static int iblock_do_task(struct se_task *task)
submit_bio(rw, bio); submit_bio(rw, bio);
blk_finish_plug(&plug); blk_finish_plug(&plug);
return PYX_TRANSPORT_SENT_TO_TRANSPORT; return 0;
fail: fail:
while ((bio = bio_list_pop(&list))) while ((bio = bio_list_pop(&list)))
bio_put(bio); bio_put(bio);
return PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES; cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
return -ENOMEM;
} }
static u32 iblock_get_device_rev(struct se_device *dev) static u32 iblock_get_device_rev(struct se_device *dev)
......
This diff is collapsed.
...@@ -963,6 +963,7 @@ static inline struct bio *pscsi_get_bio(int sg_num) ...@@ -963,6 +963,7 @@ static inline struct bio *pscsi_get_bio(int sg_num)
static int pscsi_map_sg(struct se_task *task, struct scatterlist *task_sg, static int pscsi_map_sg(struct se_task *task, struct scatterlist *task_sg,
struct bio **hbio) struct bio **hbio)
{ {
struct se_cmd *cmd = task->task_se_cmd;
struct pscsi_dev_virt *pdv = task->task_se_cmd->se_dev->dev_ptr; struct pscsi_dev_virt *pdv = task->task_se_cmd->se_dev->dev_ptr;
u32 task_sg_num = task->task_sg_nents; u32 task_sg_num = task->task_sg_nents;
struct bio *bio = NULL, *tbio = NULL; struct bio *bio = NULL, *tbio = NULL;
...@@ -971,7 +972,7 @@ static int pscsi_map_sg(struct se_task *task, struct scatterlist *task_sg, ...@@ -971,7 +972,7 @@ static int pscsi_map_sg(struct se_task *task, struct scatterlist *task_sg,
u32 data_len = task->task_size, i, len, bytes, off; u32 data_len = task->task_size, i, len, bytes, off;
int nr_pages = (task->task_size + task_sg[0].offset + int nr_pages = (task->task_size + task_sg[0].offset +
PAGE_SIZE - 1) >> PAGE_SHIFT; PAGE_SIZE - 1) >> PAGE_SHIFT;
int nr_vecs = 0, rc, ret = PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES; int nr_vecs = 0, rc;
int rw = (task->task_data_direction == DMA_TO_DEVICE); int rw = (task->task_data_direction == DMA_TO_DEVICE);
*hbio = NULL; *hbio = NULL;
...@@ -1058,11 +1059,13 @@ static int pscsi_map_sg(struct se_task *task, struct scatterlist *task_sg, ...@@ -1058,11 +1059,13 @@ static int pscsi_map_sg(struct se_task *task, struct scatterlist *task_sg,
bio->bi_next = NULL; bio->bi_next = NULL;
bio_endio(bio, 0); /* XXX: should be error */ bio_endio(bio, 0); /* XXX: should be error */
} }
return ret; cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
return -ENOMEM;
} }
static int pscsi_do_task(struct se_task *task) static int pscsi_do_task(struct se_task *task)
{ {
struct se_cmd *cmd = task->task_se_cmd;
struct pscsi_dev_virt *pdv = task->task_se_cmd->se_dev->dev_ptr; struct pscsi_dev_virt *pdv = task->task_se_cmd->se_dev->dev_ptr;
struct pscsi_plugin_task *pt = PSCSI_TASK(task); struct pscsi_plugin_task *pt = PSCSI_TASK(task);
struct request *req; struct request *req;
...@@ -1078,7 +1081,9 @@ static int pscsi_do_task(struct se_task *task) ...@@ -1078,7 +1081,9 @@ static int pscsi_do_task(struct se_task *task)
if (!req || IS_ERR(req)) { if (!req || IS_ERR(req)) {
pr_err("PSCSI: blk_get_request() failed: %ld\n", pr_err("PSCSI: blk_get_request() failed: %ld\n",
req ? IS_ERR(req) : -ENOMEM); req ? IS_ERR(req) : -ENOMEM);
return PYX_TRANSPORT_LU_COMM_FAILURE; cmd->scsi_sense_reason =
TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
return -ENODEV;
} }
} else { } else {
BUG_ON(!task->task_size); BUG_ON(!task->task_size);
...@@ -1087,8 +1092,11 @@ static int pscsi_do_task(struct se_task *task) ...@@ -1087,8 +1092,11 @@ static int pscsi_do_task(struct se_task *task)
* Setup the main struct request for the task->task_sg[] payload * Setup the main struct request for the task->task_sg[] payload
*/ */
ret = pscsi_map_sg(task, task->task_sg, &hbio); ret = pscsi_map_sg(task, task->task_sg, &hbio);
if (ret < 0) if (ret < 0) {
return PYX_TRANSPORT_LU_COMM_FAILURE; cmd->scsi_sense_reason =
TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
return ret;
}
req = blk_make_request(pdv->pdv_sd->request_queue, hbio, req = blk_make_request(pdv->pdv_sd->request_queue, hbio,
GFP_KERNEL); GFP_KERNEL);
...@@ -1115,7 +1123,7 @@ static int pscsi_do_task(struct se_task *task) ...@@ -1115,7 +1123,7 @@ static int pscsi_do_task(struct se_task *task)
(task->task_se_cmd->sam_task_attr == MSG_HEAD_TAG), (task->task_se_cmd->sam_task_attr == MSG_HEAD_TAG),
pscsi_req_done); pscsi_req_done);
return PYX_TRANSPORT_SENT_TO_TRANSPORT; return 0;
fail: fail:
while (hbio) { while (hbio) {
...@@ -1124,7 +1132,8 @@ static int pscsi_do_task(struct se_task *task) ...@@ -1124,7 +1132,8 @@ static int pscsi_do_task(struct se_task *task)
bio->bi_next = NULL; bio->bi_next = NULL;
bio_endio(bio, 0); /* XXX: should be error */ bio_endio(bio, 0); /* XXX: should be error */
} }
return PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES; cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
return -ENOMEM;
} }
/* pscsi_get_sense_buffer(): /* pscsi_get_sense_buffer():
...@@ -1198,9 +1207,8 @@ static inline void pscsi_process_SAM_status( ...@@ -1198,9 +1207,8 @@ static inline void pscsi_process_SAM_status(
" 0x%02x Result: 0x%08x\n", task, pt->pscsi_cdb[0], " 0x%02x Result: 0x%08x\n", task, pt->pscsi_cdb[0],
pt->pscsi_result); pt->pscsi_result);
task->task_scsi_status = SAM_STAT_CHECK_CONDITION; task->task_scsi_status = SAM_STAT_CHECK_CONDITION;
task->task_error_status = PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; task->task_se_cmd->scsi_sense_reason =
task->task_se_cmd->transport_error_status = TCM_UNSUPPORTED_SCSI_OPCODE;
PYX_TRANSPORT_UNKNOWN_SAM_OPCODE;
transport_complete_task(task, 0); transport_complete_task(task, 0);
break; break;
} }
......
...@@ -343,235 +343,74 @@ static struct rd_dev_sg_table *rd_get_sg_table(struct rd_dev *rd_dev, u32 page) ...@@ -343,235 +343,74 @@ static struct rd_dev_sg_table *rd_get_sg_table(struct rd_dev *rd_dev, u32 page)
return NULL; return NULL;
} }
/* rd_MEMCPY_read(): static int rd_MEMCPY(struct rd_request *req, u32 read_rd)
*
*
*/
static int rd_MEMCPY_read(struct rd_request *req)
{ {
struct se_task *task = &req->rd_task; struct se_task *task = &req->rd_task;
struct rd_dev *dev = req->rd_task.task_se_cmd->se_dev->dev_ptr; struct rd_dev *dev = req->rd_task.task_se_cmd->se_dev->dev_ptr;
struct rd_dev_sg_table *table; struct rd_dev_sg_table *table;
struct scatterlist *sg_d, *sg_s; struct scatterlist *rd_sg;
void *dst, *src; struct sg_mapping_iter m;
u32 i = 0, j = 0, dst_offset = 0, src_offset = 0;
u32 length, page_end = 0, table_sg_end;
u32 rd_offset = req->rd_offset; u32 rd_offset = req->rd_offset;
u32 src_len;
table = rd_get_sg_table(dev, req->rd_page); table = rd_get_sg_table(dev, req->rd_page);
if (!table) if (!table)
return -EINVAL; return -EINVAL;
table_sg_end = (table->page_end_offset - req->rd_page); rd_sg = &table->sg_table[req->rd_page - table->page_start_offset];
sg_d = task->task_sg;
sg_s = &table->sg_table[req->rd_page - table->page_start_offset];
pr_debug("RD[%u]: Read LBA: %llu, Size: %u Page: %u, Offset:" pr_debug("RD[%u]: %s LBA: %llu, Size: %u Page: %u, Offset: %u\n",
" %u\n", dev->rd_dev_id, task->task_lba, req->rd_size, dev->rd_dev_id, read_rd ? "Read" : "Write",
req->rd_page, req->rd_offset); task->task_lba, req->rd_size, req->rd_page,
rd_offset);
src_offset = rd_offset;
src_len = PAGE_SIZE - rd_offset;
sg_miter_start(&m, task->task_sg, task->task_sg_nents,
read_rd ? SG_MITER_TO_SG : SG_MITER_FROM_SG);
while (req->rd_size) { while (req->rd_size) {
if ((sg_d[i].length - dst_offset) < u32 len;
(sg_s[j].length - src_offset)) { void *rd_addr;
length = (sg_d[i].length - dst_offset);
pr_debug("Step 1 - sg_d[%d]: %p length: %d"
" offset: %u sg_s[%d].length: %u\n", i,
&sg_d[i], sg_d[i].length, sg_d[i].offset, j,
sg_s[j].length);
pr_debug("Step 1 - length: %u dst_offset: %u"
" src_offset: %u\n", length, dst_offset,
src_offset);
if (length > req->rd_size)
length = req->rd_size;
dst = sg_virt(&sg_d[i++]) + dst_offset;
BUG_ON(!dst);
src = sg_virt(&sg_s[j]) + src_offset;
BUG_ON(!src);
dst_offset = 0;
src_offset = length;
page_end = 0;
} else {
length = (sg_s[j].length - src_offset);
pr_debug("Step 2 - sg_d[%d]: %p length: %d"
" offset: %u sg_s[%d].length: %u\n", i,
&sg_d[i], sg_d[i].length, sg_d[i].offset,
j, sg_s[j].length);
pr_debug("Step 2 - length: %u dst_offset: %u"
" src_offset: %u\n", length, dst_offset,
src_offset);
if (length > req->rd_size)
length = req->rd_size;
dst = sg_virt(&sg_d[i]) + dst_offset;
BUG_ON(!dst);
if (sg_d[i].length == length) {
i++;
dst_offset = 0;
} else
dst_offset = length;
src = sg_virt(&sg_s[j++]) + src_offset;
BUG_ON(!src);
src_offset = 0;
page_end = 1;
}
memcpy(dst, src, length); sg_miter_next(&m);
len = min((u32)m.length, src_len);
m.consumed = len;
pr_debug("page: %u, remaining size: %u, length: %u," rd_addr = sg_virt(rd_sg) + rd_offset;
" i: %u, j: %u\n", req->rd_page,
(req->rd_size - length), length, i, j);
req->rd_size -= length; if (read_rd)
if (!req->rd_size) memcpy(m.addr, rd_addr, len);
return 0; else
memcpy(rd_addr, m.addr, len);
if (!page_end) req->rd_size -= len;
if (!req->rd_size)
continue; continue;
if (++req->rd_page <= table->page_end_offset) { src_len -= len;
pr_debug("page: %u in same page table\n", if (src_len) {
req->rd_page); rd_offset += len;
continue; continue;
} }
pr_debug("getting new page table for page: %u\n", /* rd page completed, next one please */
req->rd_page); req->rd_page++;
rd_offset = 0;
table = rd_get_sg_table(dev, req->rd_page); src_len = PAGE_SIZE;
if (!table) if (req->rd_page <= table->page_end_offset) {
return -EINVAL; rd_sg++;
sg_s = &table->sg_table[j = 0];
}
return 0;
}
/* rd_MEMCPY_write():
*
*
*/
static int rd_MEMCPY_write(struct rd_request *req)
{
struct se_task *task = &req->rd_task;
struct rd_dev *dev = req->rd_task.task_se_cmd->se_dev->dev_ptr;
struct rd_dev_sg_table *table;
struct scatterlist *sg_d, *sg_s;
void *dst, *src;
u32 i = 0, j = 0, dst_offset = 0, src_offset = 0;
u32 length, page_end = 0, table_sg_end;
u32 rd_offset = req->rd_offset;
table = rd_get_sg_table(dev, req->rd_page);
if (!table)
return -EINVAL;
table_sg_end = (table->page_end_offset - req->rd_page);
sg_d = &table->sg_table[req->rd_page - table->page_start_offset];
sg_s = task->task_sg;
pr_debug("RD[%d] Write LBA: %llu, Size: %u, Page: %u,"
" Offset: %u\n", dev->rd_dev_id, task->task_lba, req->rd_size,
req->rd_page, req->rd_offset);
dst_offset = rd_offset;
while (req->rd_size) {
if ((sg_s[i].length - src_offset) <
(sg_d[j].length - dst_offset)) {
length = (sg_s[i].length - src_offset);
pr_debug("Step 1 - sg_s[%d]: %p length: %d"
" offset: %d sg_d[%d].length: %u\n", i,
&sg_s[i], sg_s[i].length, sg_s[i].offset,
j, sg_d[j].length);
pr_debug("Step 1 - length: %u src_offset: %u"
" dst_offset: %u\n", length, src_offset,
dst_offset);
if (length > req->rd_size)
length = req->rd_size;
src = sg_virt(&sg_s[i++]) + src_offset;
BUG_ON(!src);
dst = sg_virt(&sg_d[j]) + dst_offset;
BUG_ON(!dst);
src_offset = 0;
dst_offset = length;
page_end = 0;
} else {
length = (sg_d[j].length - dst_offset);
pr_debug("Step 2 - sg_s[%d]: %p length: %d"
" offset: %d sg_d[%d].length: %u\n", i,
&sg_s[i], sg_s[i].length, sg_s[i].offset,
j, sg_d[j].length);
pr_debug("Step 2 - length: %u src_offset: %u"
" dst_offset: %u\n", length, src_offset,
dst_offset);
if (length > req->rd_size)
length = req->rd_size;
src = sg_virt(&sg_s[i]) + src_offset;
BUG_ON(!src);
if (sg_s[i].length == length) {
i++;
src_offset = 0;
} else
src_offset = length;
dst = sg_virt(&sg_d[j++]) + dst_offset;
BUG_ON(!dst);
dst_offset = 0;
page_end = 1;
}
memcpy(dst, src, length);
pr_debug("page: %u, remaining size: %u, length: %u,"
" i: %u, j: %u\n", req->rd_page,
(req->rd_size - length), length, i, j);
req->rd_size -= length;
if (!req->rd_size)
return 0;
if (!page_end)
continue;
if (++req->rd_page <= table->page_end_offset) {
pr_debug("page: %u in same page table\n",
req->rd_page);
continue; continue;
} }
pr_debug("getting new page table for page: %u\n",
req->rd_page);
table = rd_get_sg_table(dev, req->rd_page); table = rd_get_sg_table(dev, req->rd_page);
if (!table) if (!table) {
sg_miter_stop(&m);
return -EINVAL; return -EINVAL;
}
sg_d = &table->sg_table[j = 0]; /* since we increment, the first sg entry is correct */
rd_sg = table->sg_table;
} }
sg_miter_stop(&m);
return 0; return 0;
} }
...@@ -583,28 +422,21 @@ static int rd_MEMCPY_do_task(struct se_task *task) ...@@ -583,28 +422,21 @@ static int rd_MEMCPY_do_task(struct se_task *task)
{ {
struct se_device *dev = task->task_se_cmd->se_dev; struct se_device *dev = task->task_se_cmd->se_dev;
struct rd_request *req = RD_REQ(task); struct rd_request *req = RD_REQ(task);
unsigned long long lba; u64 tmp;
int ret; int ret;
req->rd_page = (task->task_lba * dev->se_sub_dev->se_dev_attrib.block_size) / PAGE_SIZE; tmp = task->task_lba * dev->se_sub_dev->se_dev_attrib.block_size;
lba = task->task_lba; req->rd_offset = do_div(tmp, PAGE_SIZE);
req->rd_offset = (do_div(lba, req->rd_page = tmp;
(PAGE_SIZE / dev->se_sub_dev->se_dev_attrib.block_size))) *
dev->se_sub_dev->se_dev_attrib.block_size;
req->rd_size = task->task_size; req->rd_size = task->task_size;
if (task->task_data_direction == DMA_FROM_DEVICE) ret = rd_MEMCPY(req, task->task_data_direction == DMA_FROM_DEVICE);
ret = rd_MEMCPY_read(req);
else
ret = rd_MEMCPY_write(req);
if (ret != 0) if (ret != 0)
return ret; return ret;
task->task_scsi_status = GOOD; task->task_scsi_status = GOOD;
transport_complete_task(task, 1); transport_complete_task(task, 1);
return 0;
return PYX_TRANSPORT_SENT_TO_TRANSPORT;
} }
/* rd_free_task(): (Part of se_subsystem_api_t template) /* rd_free_task(): (Part of se_subsystem_api_t template)
......
...@@ -345,10 +345,6 @@ static void core_tmr_drain_cmd_list( ...@@ -345,10 +345,6 @@ static void core_tmr_drain_cmd_list(
" %d t_fe_count: %d\n", (preempt_and_abort_list) ? " %d t_fe_count: %d\n", (preempt_and_abort_list) ?
"Preempt" : "", cmd, cmd->t_state, "Preempt" : "", cmd, cmd->t_state,
atomic_read(&cmd->t_fe_count)); atomic_read(&cmd->t_fe_count));
/*
* Signal that the command has failed via cmd->se_cmd_flags,
*/
transport_new_cmd_failure(cmd);
core_tmr_handle_tas_abort(tmr_nacl, cmd, tas, core_tmr_handle_tas_abort(tmr_nacl, cmd, tas,
atomic_read(&cmd->t_fe_count)); atomic_read(&cmd->t_fe_count));
......
This diff is collapsed.
...@@ -200,7 +200,7 @@ int ft_write_pending(struct se_cmd *se_cmd) ...@@ -200,7 +200,7 @@ int ft_write_pending(struct se_cmd *se_cmd)
lport = ep->lp; lport = ep->lp;
fp = fc_frame_alloc(lport, sizeof(*txrdy)); fp = fc_frame_alloc(lport, sizeof(*txrdy));
if (!fp) if (!fp)
return PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES; return -ENOMEM; /* Signal QUEUE_FULL */
txrdy = fc_frame_payload_get(fp, sizeof(*txrdy)); txrdy = fc_frame_payload_get(fp, sizeof(*txrdy));
memset(txrdy, 0, sizeof(*txrdy)); memset(txrdy, 0, sizeof(*txrdy));
......
...@@ -436,8 +436,7 @@ static void ft_del_lport(struct se_wwn *wwn) ...@@ -436,8 +436,7 @@ static void ft_del_lport(struct se_wwn *wwn)
struct ft_lport_acl *lacl = container_of(wwn, struct ft_lport_acl *lacl = container_of(wwn,
struct ft_lport_acl, fc_lport_wwn); struct ft_lport_acl, fc_lport_wwn);
pr_debug("del lport %s\n", pr_debug("del lport %s\n", lacl->name);
config_item_name(&wwn->wwn_group.cg_item));
mutex_lock(&ft_lport_lock); mutex_lock(&ft_lport_lock);
list_del(&lacl->list); list_del(&lacl->list);
mutex_unlock(&ft_lport_lock); mutex_unlock(&ft_lport_lock);
......
...@@ -103,9 +103,10 @@ enum se_cmd_flags_table { ...@@ -103,9 +103,10 @@ enum se_cmd_flags_table {
SCF_SCSI_NON_DATA_CDB = 0x00000040, SCF_SCSI_NON_DATA_CDB = 0x00000040,
SCF_SCSI_CDB_EXCEPTION = 0x00000080, SCF_SCSI_CDB_EXCEPTION = 0x00000080,
SCF_SCSI_RESERVATION_CONFLICT = 0x00000100, SCF_SCSI_RESERVATION_CONFLICT = 0x00000100,
SCF_SE_CMD_FAILED = 0x00000400, SCF_FUA = 0x00000200,
SCF_SE_LUN_CMD = 0x00000800, SCF_SE_LUN_CMD = 0x00000800,
SCF_SE_ALLOW_EOO = 0x00001000, SCF_SE_ALLOW_EOO = 0x00001000,
SCF_BIDI = 0x00002000,
SCF_SENT_CHECK_CONDITION = 0x00004000, SCF_SENT_CHECK_CONDITION = 0x00004000,
SCF_OVERFLOW_BIT = 0x00008000, SCF_OVERFLOW_BIT = 0x00008000,
SCF_UNDERFLOW_BIT = 0x00010000, SCF_UNDERFLOW_BIT = 0x00010000,
...@@ -154,6 +155,7 @@ enum tcm_sense_reason_table { ...@@ -154,6 +155,7 @@ enum tcm_sense_reason_table {
TCM_CHECK_CONDITION_ABORT_CMD = 0x0d, TCM_CHECK_CONDITION_ABORT_CMD = 0x0d,
TCM_CHECK_CONDITION_UNIT_ATTENTION = 0x0e, TCM_CHECK_CONDITION_UNIT_ATTENTION = 0x0e,
TCM_CHECK_CONDITION_NOT_READY = 0x0f, TCM_CHECK_CONDITION_NOT_READY = 0x0f,
TCM_RESERVATION_CONFLICT = 0x10,
}; };
struct se_obj { struct se_obj {
...@@ -211,7 +213,6 @@ struct t10_alua_lu_gp { ...@@ -211,7 +213,6 @@ struct t10_alua_lu_gp {
u16 lu_gp_id; u16 lu_gp_id;
int lu_gp_valid_id; int lu_gp_valid_id;
u32 lu_gp_members; u32 lu_gp_members;
atomic_t lu_gp_shutdown;
atomic_t lu_gp_ref_cnt; atomic_t lu_gp_ref_cnt;
spinlock_t lu_gp_lock; spinlock_t lu_gp_lock;
struct config_group lu_gp_group; struct config_group lu_gp_group;
...@@ -422,11 +423,9 @@ struct se_cmd { ...@@ -422,11 +423,9 @@ struct se_cmd {
int sam_task_attr; int sam_task_attr;
/* Transport protocol dependent state, see transport_state_table */ /* Transport protocol dependent state, see transport_state_table */
enum transport_state_table t_state; enum transport_state_table t_state;
/* Transport specific error status */
int transport_error_status;
/* Used to signal cmd->se_tfo->check_release_cmd() usage per cmd */ /* Used to signal cmd->se_tfo->check_release_cmd() usage per cmd */
int check_release:1; unsigned check_release:1;
int cmd_wait_set:1; unsigned cmd_wait_set:1;
/* See se_cmd_flags_table */ /* See se_cmd_flags_table */
u32 se_cmd_flags; u32 se_cmd_flags;
u32 se_ordered_id; u32 se_ordered_id;
...@@ -441,13 +440,10 @@ struct se_cmd { ...@@ -441,13 +440,10 @@ struct se_cmd {
/* Used for sense data */ /* Used for sense data */
void *sense_buffer; void *sense_buffer;
struct list_head se_delayed_node; struct list_head se_delayed_node;
struct list_head se_ordered_node;
struct list_head se_lun_node; struct list_head se_lun_node;
struct list_head se_qf_node; struct list_head se_qf_node;
struct se_device *se_dev; struct se_device *se_dev;
struct se_dev_entry *se_deve; struct se_dev_entry *se_deve;
struct se_device *se_obj_ptr;
struct se_device *se_orig_obj_ptr;
struct se_lun *se_lun; struct se_lun *se_lun;
/* Only used for internal passthrough and legacy TCM fabric modules */ /* Only used for internal passthrough and legacy TCM fabric modules */
struct se_session *se_sess; struct se_session *se_sess;
...@@ -463,8 +459,6 @@ struct se_cmd { ...@@ -463,8 +459,6 @@ struct se_cmd {
unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE];
unsigned long long t_task_lba; unsigned long long t_task_lba;
int t_tasks_failed; int t_tasks_failed;
int t_tasks_fua;
bool t_tasks_bidi;
u32 t_tasks_sg_chained_no; u32 t_tasks_sg_chained_no;
atomic_t t_fe_count; atomic_t t_fe_count;
atomic_t t_se_count; atomic_t t_se_count;
...@@ -489,14 +483,6 @@ struct se_cmd { ...@@ -489,14 +483,6 @@ struct se_cmd {
struct work_struct work; struct work_struct work;
/*
* Used for pre-registered fabric SGL passthrough WRITE and READ
* with the special SCF_PASSTHROUGH_CONTIG_TO_SG case for TCM_Loop
* and other HW target mode fabric modules.
*/
struct scatterlist *t_task_pt_sgl;
u32 t_task_pt_sgl_num;
struct scatterlist *t_data_sg; struct scatterlist *t_data_sg;
unsigned int t_data_nents; unsigned int t_data_nents;
struct scatterlist *t_bidi_data_sg; struct scatterlist *t_bidi_data_sg;
...@@ -562,7 +548,7 @@ struct se_node_acl { ...@@ -562,7 +548,7 @@ struct se_node_acl {
} ____cacheline_aligned; } ____cacheline_aligned;
struct se_session { struct se_session {
int sess_tearing_down:1; unsigned sess_tearing_down:1;
u64 sess_bin_isid; u64 sess_bin_isid;
struct se_node_acl *se_node_acl; struct se_node_acl *se_node_acl;
struct se_portal_group *se_tpg; struct se_portal_group *se_tpg;
...@@ -683,7 +669,6 @@ struct se_subsystem_dev { ...@@ -683,7 +669,6 @@ struct se_subsystem_dev {
struct t10_reservation t10_pr; struct t10_reservation t10_pr;
spinlock_t se_dev_lock; spinlock_t se_dev_lock;
void *se_dev_su_ptr; void *se_dev_su_ptr;
struct list_head se_dev_node;
struct config_group se_dev_group; struct config_group se_dev_group;
/* For T10 Reservations */ /* For T10 Reservations */
struct config_group se_dev_pr_group; struct config_group se_dev_pr_group;
...@@ -692,9 +677,6 @@ struct se_subsystem_dev { ...@@ -692,9 +677,6 @@ struct se_subsystem_dev {
} ____cacheline_aligned; } ____cacheline_aligned;
struct se_device { struct se_device {
/* Set to 1 if thread is NOT sleeping on thread_sem */
u8 thread_active;
u8 dev_status_timer_flags;
/* RELATIVE TARGET PORT IDENTIFER Counter */ /* RELATIVE TARGET PORT IDENTIFER Counter */
u16 dev_rpti_counter; u16 dev_rpti_counter;
/* Used for SAM Task Attribute ordering */ /* Used for SAM Task Attribute ordering */
...@@ -719,14 +701,10 @@ struct se_device { ...@@ -719,14 +701,10 @@ struct se_device {
u64 write_bytes; u64 write_bytes;
spinlock_t stats_lock; spinlock_t stats_lock;
/* Active commands on this virtual SE device */ /* Active commands on this virtual SE device */
atomic_t active_cmds;
atomic_t simple_cmds; atomic_t simple_cmds;
atomic_t depth_left; atomic_t depth_left;
atomic_t dev_ordered_id; atomic_t dev_ordered_id;
atomic_t dev_tur_active;
atomic_t execute_tasks; atomic_t execute_tasks;
atomic_t dev_status_thr_count;
atomic_t dev_hoq_count;
atomic_t dev_ordered_sync; atomic_t dev_ordered_sync;
atomic_t dev_qf_count; atomic_t dev_qf_count;
struct se_obj dev_obj; struct se_obj dev_obj;
...@@ -734,14 +712,9 @@ struct se_device { ...@@ -734,14 +712,9 @@ struct se_device {
struct se_obj dev_export_obj; struct se_obj dev_export_obj;
struct se_queue_obj dev_queue_obj; struct se_queue_obj dev_queue_obj;
spinlock_t delayed_cmd_lock; spinlock_t delayed_cmd_lock;
spinlock_t ordered_cmd_lock;
spinlock_t execute_task_lock; spinlock_t execute_task_lock;
spinlock_t state_task_lock;
spinlock_t dev_alua_lock;
spinlock_t dev_reservation_lock; spinlock_t dev_reservation_lock;
spinlock_t dev_state_lock;
spinlock_t dev_status_lock; spinlock_t dev_status_lock;
spinlock_t dev_status_thr_lock;
spinlock_t se_port_lock; spinlock_t se_port_lock;
spinlock_t se_tmr_lock; spinlock_t se_tmr_lock;
spinlock_t qf_cmd_lock; spinlock_t qf_cmd_lock;
...@@ -753,14 +726,10 @@ struct se_device { ...@@ -753,14 +726,10 @@ struct se_device {
struct t10_pr_registration *dev_pr_res_holder; struct t10_pr_registration *dev_pr_res_holder;
struct list_head dev_sep_list; struct list_head dev_sep_list;
struct list_head dev_tmr_list; struct list_head dev_tmr_list;
struct timer_list dev_status_timer;
/* Pointer to descriptor for processing thread */ /* Pointer to descriptor for processing thread */
struct task_struct *process_thread; struct task_struct *process_thread;
pid_t process_thread_pid;
struct task_struct *dev_mgmt_thread;
struct work_struct qf_work_queue; struct work_struct qf_work_queue;
struct list_head delayed_cmd_list; struct list_head delayed_cmd_list;
struct list_head ordered_cmd_list;
struct list_head execute_task_list; struct list_head execute_task_list;
struct list_head state_task_list; struct list_head state_task_list;
struct list_head qf_cmd_list; struct list_head qf_cmd_list;
...@@ -771,8 +740,6 @@ struct se_device { ...@@ -771,8 +740,6 @@ struct se_device {
struct se_subsystem_api *transport; struct se_subsystem_api *transport;
/* Linked list for struct se_hba struct se_device list */ /* Linked list for struct se_hba struct se_device list */
struct list_head dev_list; struct list_head dev_list;
/* Linked list for struct se_global->g_se_dev_list */
struct list_head g_se_dev_list;
} ____cacheline_aligned; } ____cacheline_aligned;
struct se_hba { struct se_hba {
...@@ -834,7 +801,6 @@ struct se_port { ...@@ -834,7 +801,6 @@ struct se_port {
u32 sep_index; u32 sep_index;
struct scsi_port_stats sep_stats; struct scsi_port_stats sep_stats;
/* Used for ALUA Target Port Groups membership */ /* Used for ALUA Target Port Groups membership */
atomic_t sep_tg_pt_gp_active;
atomic_t sep_tg_pt_secondary_offline; atomic_t sep_tg_pt_secondary_offline;
/* Used for PR ALL_TG_PT=1 */ /* Used for PR ALL_TG_PT=1 */
atomic_t sep_tg_pt_ref_cnt; atomic_t sep_tg_pt_ref_cnt;
......
...@@ -10,29 +10,6 @@ ...@@ -10,29 +10,6 @@
#define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */ #define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */
#define PYX_TRANSPORT_SENT_TO_TRANSPORT 0
#define PYX_TRANSPORT_WRITE_PENDING 1
#define PYX_TRANSPORT_UNKNOWN_SAM_OPCODE -1
#define PYX_TRANSPORT_HBA_QUEUE_FULL -2
#define PYX_TRANSPORT_REQ_TOO_MANY_SECTORS -3
#define PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES -4
#define PYX_TRANSPORT_INVALID_CDB_FIELD -5
#define PYX_TRANSPORT_INVALID_PARAMETER_LIST -6
#define PYX_TRANSPORT_LU_COMM_FAILURE -7
#define PYX_TRANSPORT_UNKNOWN_MODE_PAGE -8
#define PYX_TRANSPORT_WRITE_PROTECTED -9
#define PYX_TRANSPORT_RESERVATION_CONFLICT -10
#define PYX_TRANSPORT_ILLEGAL_REQUEST -11
#define PYX_TRANSPORT_USE_SENSE_REASON -12
#ifndef SAM_STAT_RESERVATION_CONFLICT
#define SAM_STAT_RESERVATION_CONFLICT 0x18
#endif
#define TRANSPORT_PLUGIN_FREE 0
#define TRANSPORT_PLUGIN_REGISTERED 1
#define TRANSPORT_PLUGIN_PHBA_PDEV 1 #define TRANSPORT_PLUGIN_PHBA_PDEV 1
#define TRANSPORT_PLUGIN_VHBA_PDEV 2 #define TRANSPORT_PLUGIN_VHBA_PDEV 2
#define TRANSPORT_PLUGIN_VHBA_VDEV 3 #define TRANSPORT_PLUGIN_VHBA_VDEV 3
...@@ -158,7 +135,6 @@ extern int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); ...@@ -158,7 +135,6 @@ extern int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *);
extern int transport_handle_cdb_direct(struct se_cmd *); extern int transport_handle_cdb_direct(struct se_cmd *);
extern int transport_generic_handle_cdb_map(struct se_cmd *); extern int transport_generic_handle_cdb_map(struct se_cmd *);
extern int transport_generic_handle_data(struct se_cmd *); extern int transport_generic_handle_data(struct se_cmd *);
extern void transport_new_cmd_failure(struct se_cmd *);
extern int transport_generic_handle_tmr(struct se_cmd *); extern int transport_generic_handle_tmr(struct se_cmd *);
extern bool target_stop_task(struct se_task *task, unsigned long *flags); extern bool target_stop_task(struct se_task *task, unsigned long *flags);
extern int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *, u32, extern int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *, u32,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment