mirror of
https://github.com/ukui/kernel.git
synced 2026-03-09 10:07:04 -07:00
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull target updates from Nicholas Bellinger:
"It has been a very busy development cycle this time around in target
land, with the highlights including:
- Kill struct se_subsystem_dev, in favor of direct se_device usage
(hch)
- Simplify reservations code by combining SPC-3 + SCSI-2 support for
virtual backends only (hch)
- Simplify ALUA code for virtual only backends, and remove left over
abstractions (hch)
- Pass sense_reason_t as return value for I/O submission path (hch)
- Refactor MODE_SENSE emulation to allow for easier addition of new
mode pages. (roland)
- Add emulation of MODE_SELECT (roland)
- Fix bug in handling of ExpStatSN wrap-around (steve)
- Fix bug in TMR ABORT_TASK lookup in qla2xxx target (steve)
- Add WRITE_SAME w/ UNMAP=0 support for IBLOCK backends (nab)
- Convert ib_srpt to use modern target_submit_cmd caller + drop
legacy ioctx->kref usage (nab)
- Convert ib_srpt to use modern target_submit_tmr caller (nab)
- Add link_magic for fabric allow_link destination target_items for
symlinks within target_core_fabric_configfs.c code (nab)
- Allocate pointers in instead of full structs for
config_group->default_groups (sebastian)
- Fix 32-bit highmem breakage for FILEIO (sebastian)
All told, hch was able to shave off another ~1K LOC by killing the
se_subsystem_dev abstraction, along with a number of PR + ALUA
simplifications. Also, a nice patch by Roland is the refactoring of
MODE_SENSE handling, along with the addition of initial MODE_SELECT
emulation support for virtual backends.
Sebastian found a long-standing issue wrt to allocation of full
config_group instead of pointers for config_group->default_group[]
setup in a number of areas, which ends up saving memory with big
configurations. He also managed to fix another long-standing BUG wrt
to broken 32-bit highmem support within the FILEIO backend driver.
Thank you again to everyone who contributed this round!"
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (50 commits)
target/iscsi_target: Add NodeACL tags for initiator group support
target/tcm_fc: fix the lockdep warning due to inconsistent lock state
sbp-target: fix error path in sbp_make_tpg()
sbp-target: use simple assignment in tgt_agent_rw_agent_state()
iscsi-target: use kstrdup() for iscsi_param
target/file: merge fd_do_readv() and fd_do_writev()
target/file: Fix 32-bit highmem breakage for SGL -> iovec mapping
target: Add link_magic for fabric allow_link destination target_items
ib_srpt: Convert TMR path to target_submit_tmr
ib_srpt: Convert I/O path to target_submit_cmd + drop legacy ioctx->kref
target: Make spc_get_write_same_sectors return sector_t
target/configfs: use kmalloc() instead of kzalloc() for default groups
target/configfs: allocate only 6 slots for dev_cg->default_groups
target/configfs: allocate pointers instead of full struct for default_groups
target: update error handling for sbc_setup_write_same()
iscsit: use GFP_ATOMIC under spin lock
iscsi_target: Remove redundant null check before kfree
target/iblock: Forward declare bio helpers
target: Clean up flow in transport_check_aborted_status()
target: Clean up logic in transport_put_cmd()
...
This commit is contained in:
@@ -735,7 +735,7 @@ static void iscsit_ack_from_expstatsn(struct iscsi_conn *conn, u32 exp_statsn)
|
||||
list_for_each_entry(cmd, &conn->conn_cmd_list, i_conn_node) {
|
||||
spin_lock(&cmd->istate_lock);
|
||||
if ((cmd->i_state == ISTATE_SENT_STATUS) &&
|
||||
(cmd->stat_sn < exp_statsn)) {
|
||||
iscsi_sna_lt(cmd->stat_sn, exp_statsn)) {
|
||||
cmd->i_state = ISTATE_REMOVE;
|
||||
spin_unlock(&cmd->istate_lock);
|
||||
iscsit_add_cmd_to_immediate_queue(cmd, conn,
|
||||
@@ -767,9 +767,8 @@ static int iscsit_handle_scsi_cmd(
|
||||
struct iscsi_conn *conn,
|
||||
unsigned char *buf)
|
||||
{
|
||||
int data_direction, cmdsn_ret = 0, immed_ret, ret, transport_ret;
|
||||
int dump_immediate_data = 0, send_check_condition = 0, payload_length;
|
||||
struct iscsi_cmd *cmd = NULL;
|
||||
int data_direction, payload_length, cmdsn_ret = 0, immed_ret;
|
||||
struct iscsi_cmd *cmd = NULL;
|
||||
struct iscsi_scsi_req *hdr;
|
||||
int iscsi_task_attr;
|
||||
int sam_task_attr;
|
||||
@@ -956,38 +955,26 @@ done:
|
||||
" ExpXferLen: %u, Length: %u, CID: %hu\n", hdr->itt,
|
||||
hdr->cmdsn, hdr->data_length, payload_length, conn->cid);
|
||||
|
||||
/*
|
||||
* The CDB is going to an se_device_t.
|
||||
*/
|
||||
ret = transport_lookup_cmd_lun(&cmd->se_cmd,
|
||||
scsilun_to_int(&hdr->lun));
|
||||
if (ret < 0) {
|
||||
if (cmd->se_cmd.scsi_sense_reason == TCM_NON_EXISTENT_LUN) {
|
||||
pr_debug("Responding to non-acl'ed,"
|
||||
" non-existent or non-exported iSCSI LUN:"
|
||||
" 0x%016Lx\n", get_unaligned_le64(&hdr->lun));
|
||||
cmd->sense_reason = transport_lookup_cmd_lun(&cmd->se_cmd,
|
||||
scsilun_to_int(&hdr->lun));
|
||||
if (cmd->sense_reason)
|
||||
goto attach_cmd;
|
||||
|
||||
cmd->sense_reason = target_setup_cmd_from_cdb(&cmd->se_cmd, hdr->cdb);
|
||||
if (cmd->sense_reason) {
|
||||
if (cmd->sense_reason == TCM_OUT_OF_RESOURCES) {
|
||||
return iscsit_add_reject_from_cmd(
|
||||
ISCSI_REASON_BOOKMARK_NO_RESOURCES,
|
||||
1, 1, buf, cmd);
|
||||
}
|
||||
send_check_condition = 1;
|
||||
|
||||
goto attach_cmd;
|
||||
}
|
||||
|
||||
transport_ret = target_setup_cmd_from_cdb(&cmd->se_cmd, hdr->cdb);
|
||||
if (transport_ret == -ENOMEM) {
|
||||
if (iscsit_build_pdu_and_seq_lists(cmd, payload_length) < 0) {
|
||||
return iscsit_add_reject_from_cmd(
|
||||
ISCSI_REASON_BOOKMARK_NO_RESOURCES,
|
||||
1, 1, buf, cmd);
|
||||
} else if (transport_ret < 0) {
|
||||
/*
|
||||
* Unsupported SAM Opcode. CHECK_CONDITION will be sent
|
||||
* in iscsit_execute_cmd() during the CmdSN OOO Execution
|
||||
* Mechinism.
|
||||
*/
|
||||
send_check_condition = 1;
|
||||
} else {
|
||||
if (iscsit_build_pdu_and_seq_lists(cmd, payload_length) < 0)
|
||||
return iscsit_add_reject_from_cmd(
|
||||
ISCSI_REASON_BOOKMARK_NO_RESOURCES,
|
||||
1, 1, buf, cmd);
|
||||
ISCSI_REASON_BOOKMARK_NO_RESOURCES,
|
||||
1, 1, buf, cmd);
|
||||
}
|
||||
|
||||
attach_cmd:
|
||||
@@ -1000,11 +987,12 @@ attach_cmd:
|
||||
*/
|
||||
core_alua_check_nonop_delay(&cmd->se_cmd);
|
||||
|
||||
ret = iscsit_allocate_iovecs(cmd);
|
||||
if (ret < 0)
|
||||
if (iscsit_allocate_iovecs(cmd) < 0) {
|
||||
return iscsit_add_reject_from_cmd(
|
||||
ISCSI_REASON_BOOKMARK_NO_RESOURCES,
|
||||
1, 0, buf, cmd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the CmdSN against ExpCmdSN/MaxCmdSN here if
|
||||
* the Immediate Bit is not set, and no Immediate
|
||||
@@ -1031,10 +1019,7 @@ attach_cmd:
|
||||
* If no Immediate Data is attached, it's OK to return now.
|
||||
*/
|
||||
if (!cmd->immediate_data) {
|
||||
if (send_check_condition)
|
||||
return 0;
|
||||
|
||||
if (cmd->unsolicited_data) {
|
||||
if (!cmd->sense_reason && cmd->unsolicited_data) {
|
||||
iscsit_set_dataout_sequence_values(cmd);
|
||||
|
||||
spin_lock_bh(&cmd->dataout_timeout_lock);
|
||||
@@ -1050,19 +1035,17 @@ attach_cmd:
|
||||
* thread. They are processed in CmdSN order by
|
||||
* iscsit_check_received_cmdsn() below.
|
||||
*/
|
||||
if (send_check_condition) {
|
||||
if (cmd->sense_reason) {
|
||||
immed_ret = IMMEDIATE_DATA_NORMAL_OPERATION;
|
||||
dump_immediate_data = 1;
|
||||
goto after_immediate_data;
|
||||
}
|
||||
/*
|
||||
* Call directly into transport_generic_new_cmd() to perform
|
||||
* the backend memory allocation.
|
||||
*/
|
||||
ret = transport_generic_new_cmd(&cmd->se_cmd);
|
||||
if (ret < 0) {
|
||||
cmd->sense_reason = transport_generic_new_cmd(&cmd->se_cmd);
|
||||
if (cmd->sense_reason) {
|
||||
immed_ret = IMMEDIATE_DATA_NORMAL_OPERATION;
|
||||
dump_immediate_data = 1;
|
||||
goto after_immediate_data;
|
||||
}
|
||||
|
||||
@@ -1079,7 +1062,7 @@ after_immediate_data:
|
||||
* Special case for Unsupported SAM WRITE Opcodes
|
||||
* and ImmediateData=Yes.
|
||||
*/
|
||||
if (dump_immediate_data) {
|
||||
if (cmd->sense_reason) {
|
||||
if (iscsit_dump_data_payload(conn, payload_length, 1) < 0)
|
||||
return -1;
|
||||
} else if (cmd->unsolicited_data) {
|
||||
@@ -1272,8 +1255,7 @@ static int iscsit_handle_data_out(struct iscsi_conn *conn, unsigned char *buf)
|
||||
spin_unlock_irqrestore(&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) ||
|
||||
(se_cmd->se_cmd_flags & SCF_SCSI_CDB_EXCEPTION))
|
||||
if (!(se_cmd->se_cmd_flags & SCF_SUPPORTED_SAM_OPCODE))
|
||||
dump_unsolicited_data = 1;
|
||||
spin_unlock_irqrestore(&se_cmd->t_state_lock, flags);
|
||||
|
||||
@@ -1742,7 +1724,6 @@ static int iscsit_handle_task_mgt_cmd(
|
||||
ret = transport_lookup_tmr_lun(&cmd->se_cmd,
|
||||
scsilun_to_int(&hdr->lun));
|
||||
if (ret < 0) {
|
||||
cmd->se_cmd.se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION;
|
||||
se_tmr->response = ISCSI_TMF_RSP_NO_LUN;
|
||||
goto attach;
|
||||
}
|
||||
@@ -1751,10 +1732,8 @@ static int iscsit_handle_task_mgt_cmd(
|
||||
switch (function) {
|
||||
case ISCSI_TM_FUNC_ABORT_TASK:
|
||||
se_tmr->response = iscsit_tmr_abort_task(cmd, buf);
|
||||
if (se_tmr->response != ISCSI_TMF_RSP_COMPLETE) {
|
||||
cmd->se_cmd.se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION;
|
||||
if (se_tmr->response)
|
||||
goto attach;
|
||||
}
|
||||
break;
|
||||
case ISCSI_TM_FUNC_ABORT_TASK_SET:
|
||||
case ISCSI_TM_FUNC_CLEAR_ACA:
|
||||
@@ -1763,14 +1742,12 @@ static int iscsit_handle_task_mgt_cmd(
|
||||
break;
|
||||
case ISCSI_TM_FUNC_TARGET_WARM_RESET:
|
||||
if (iscsit_tmr_task_warm_reset(conn, tmr_req, buf) < 0) {
|
||||
cmd->se_cmd.se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION;
|
||||
se_tmr->response = ISCSI_TMF_RSP_AUTH_FAILED;
|
||||
goto attach;
|
||||
}
|
||||
break;
|
||||
case ISCSI_TM_FUNC_TARGET_COLD_RESET:
|
||||
if (iscsit_tmr_task_cold_reset(conn, tmr_req, buf) < 0) {
|
||||
cmd->se_cmd.se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION;
|
||||
se_tmr->response = ISCSI_TMF_RSP_AUTH_FAILED;
|
||||
goto attach;
|
||||
}
|
||||
@@ -1781,7 +1758,7 @@ static int iscsit_handle_task_mgt_cmd(
|
||||
* Perform sanity checks on the ExpDataSN only if the
|
||||
* TASK_REASSIGN was successful.
|
||||
*/
|
||||
if (se_tmr->response != ISCSI_TMF_RSP_COMPLETE)
|
||||
if (se_tmr->response)
|
||||
break;
|
||||
|
||||
if (iscsit_check_task_reassign_expdatasn(tmr_req, conn) < 0)
|
||||
@@ -1792,7 +1769,6 @@ static int iscsit_handle_task_mgt_cmd(
|
||||
default:
|
||||
pr_err("Unknown TMR function: 0x%02x, protocol"
|
||||
" error.\n", function);
|
||||
cmd->se_cmd.se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION;
|
||||
se_tmr->response = ISCSI_TMF_RSP_NOT_SUPPORTED;
|
||||
goto attach;
|
||||
}
|
||||
@@ -2360,7 +2336,7 @@ static void iscsit_build_conn_drop_async_message(struct iscsi_conn *conn)
|
||||
if (!conn_p)
|
||||
return;
|
||||
|
||||
cmd = iscsit_allocate_cmd(conn_p, GFP_KERNEL);
|
||||
cmd = iscsit_allocate_cmd(conn_p, GFP_ATOMIC);
|
||||
if (!cmd) {
|
||||
iscsit_dec_conn_usage_count(conn_p);
|
||||
return;
|
||||
|
||||
@@ -754,9 +754,33 @@ static ssize_t lio_target_nacl_store_cmdsn_depth(
|
||||
|
||||
TF_NACL_BASE_ATTR(lio_target, cmdsn_depth, S_IRUGO | S_IWUSR);
|
||||
|
||||
static ssize_t lio_target_nacl_show_tag(
|
||||
struct se_node_acl *se_nacl,
|
||||
char *page)
|
||||
{
|
||||
return snprintf(page, PAGE_SIZE, "%s", se_nacl->acl_tag);
|
||||
}
|
||||
|
||||
static ssize_t lio_target_nacl_store_tag(
|
||||
struct se_node_acl *se_nacl,
|
||||
const char *page,
|
||||
size_t count)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = core_tpg_set_initiator_node_tag(se_nacl->se_tpg, se_nacl, page);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
return count;
|
||||
}
|
||||
|
||||
TF_NACL_BASE_ATTR(lio_target, tag, S_IRUGO | S_IWUSR);
|
||||
|
||||
static struct configfs_attribute *lio_target_initiator_attrs[] = {
|
||||
&lio_target_nacl_info.attr,
|
||||
&lio_target_nacl_cmdsn_depth.attr,
|
||||
&lio_target_nacl_tag.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@@ -803,7 +827,7 @@ static struct se_node_acl *lio_target_make_nodeacl(
|
||||
acl = container_of(se_nacl, struct iscsi_node_acl, se_node_acl);
|
||||
stats_cg = &se_nacl->acl_fabric_stat_group;
|
||||
|
||||
stats_cg->default_groups = kzalloc(sizeof(struct config_group) * 2,
|
||||
stats_cg->default_groups = kmalloc(sizeof(struct config_group *) * 2,
|
||||
GFP_KERNEL);
|
||||
if (!stats_cg->default_groups) {
|
||||
pr_err("Unable to allocate memory for"
|
||||
@@ -1268,7 +1292,7 @@ static struct se_wwn *lio_target_call_coreaddtiqn(
|
||||
*/
|
||||
stats_cg = &tiqn->tiqn_wwn.fabric_stat_group;
|
||||
|
||||
stats_cg->default_groups = kzalloc(sizeof(struct config_group) * 6,
|
||||
stats_cg->default_groups = kmalloc(sizeof(struct config_group *) * 6,
|
||||
GFP_KERNEL);
|
||||
if (!stats_cg->default_groups) {
|
||||
pr_err("Unable to allocate memory for"
|
||||
|
||||
@@ -474,7 +474,7 @@ struct iscsi_cmd {
|
||||
struct scatterlist *first_data_sg;
|
||||
u32 first_data_sg_off;
|
||||
u32 kmapped_nents;
|
||||
|
||||
sense_reason_t sense_reason;
|
||||
} ____cacheline_aligned;
|
||||
|
||||
struct iscsi_tmr_req {
|
||||
|
||||
@@ -929,11 +929,10 @@ int iscsit_execute_cmd(struct iscsi_cmd *cmd, int ooo)
|
||||
case ISCSI_OP_SCSI_CMD:
|
||||
/*
|
||||
* Go ahead and send the CHECK_CONDITION status for
|
||||
* any SCSI CDB exceptions that may have occurred, also
|
||||
* handle the SCF_SCSI_RESERVATION_CONFLICT case here as well.
|
||||
* any SCSI CDB exceptions that may have occurred.
|
||||
*/
|
||||
if (se_cmd->se_cmd_flags & SCF_SCSI_CDB_EXCEPTION) {
|
||||
if (se_cmd->scsi_sense_reason == TCM_RESERVATION_CONFLICT) {
|
||||
if (cmd->sense_reason) {
|
||||
if (cmd->sense_reason == TCM_RESERVATION_CONFLICT) {
|
||||
cmd->i_state = ISTATE_SEND_STATUS;
|
||||
spin_unlock_bh(&cmd->istate_lock);
|
||||
iscsit_add_cmd_to_response_queue(cmd, cmd->conn,
|
||||
@@ -956,7 +955,7 @@ int iscsit_execute_cmd(struct iscsi_cmd *cmd, int ooo)
|
||||
* exception
|
||||
*/
|
||||
return transport_send_check_condition_and_sense(se_cmd,
|
||||
se_cmd->scsi_sense_reason, 0);
|
||||
cmd->sense_reason, 0);
|
||||
}
|
||||
/*
|
||||
* Special case for delayed CmdSN with Immediate
|
||||
@@ -1013,7 +1012,7 @@ int iscsit_execute_cmd(struct iscsi_cmd *cmd, int ooo)
|
||||
iscsit_add_cmd_to_response_queue(cmd, cmd->conn, cmd->i_state);
|
||||
break;
|
||||
case ISCSI_OP_SCSI_TMFUNC:
|
||||
if (se_cmd->se_cmd_flags & SCF_SCSI_CDB_EXCEPTION) {
|
||||
if (cmd->se_cmd.se_tmr_req->response) {
|
||||
spin_unlock_bh(&cmd->istate_lock);
|
||||
iscsit_add_cmd_to_response_queue(cmd, cmd->conn,
|
||||
cmd->i_state);
|
||||
|
||||
@@ -372,7 +372,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn)
|
||||
* made generic here.
|
||||
*/
|
||||
if (!(cmd->cmd_flags & ICF_OOO_CMDSN) && !cmd->immediate_cmd &&
|
||||
(cmd->cmd_sn >= conn->sess->exp_cmd_sn)) {
|
||||
iscsi_sna_gte(cmd->stat_sn, conn->sess->exp_cmd_sn)) {
|
||||
list_del(&cmd->i_conn_node);
|
||||
spin_unlock_bh(&conn->cmd_lock);
|
||||
iscsit_free_cmd(cmd);
|
||||
|
||||
@@ -127,13 +127,13 @@ int iscsi_check_for_session_reinstatement(struct iscsi_conn *conn)
|
||||
|
||||
initiatorname_param = iscsi_find_param_from_key(
|
||||
INITIATORNAME, conn->param_list);
|
||||
if (!initiatorname_param)
|
||||
return -1;
|
||||
|
||||
sessiontype_param = iscsi_find_param_from_key(
|
||||
SESSIONTYPE, conn->param_list);
|
||||
if (!sessiontype_param)
|
||||
if (!initiatorname_param || !sessiontype_param) {
|
||||
iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_INITIATOR_ERR,
|
||||
ISCSI_LOGIN_STATUS_MISSING_FIELDS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
sessiontype = (strncmp(sessiontype_param->value, NORMAL, 6)) ? 1 : 0;
|
||||
|
||||
@@ -254,9 +254,9 @@ static int iscsi_login_zero_tsih_s1(
|
||||
kfree(sess);
|
||||
return -ENOMEM;
|
||||
}
|
||||
spin_lock(&sess_idr_lock);
|
||||
spin_lock_bh(&sess_idr_lock);
|
||||
ret = idr_get_new(&sess_idr, NULL, &sess->session_index);
|
||||
spin_unlock(&sess_idr_lock);
|
||||
spin_unlock_bh(&sess_idr_lock);
|
||||
|
||||
if (ret < 0) {
|
||||
pr_err("idr_get_new() for sess_idr failed\n");
|
||||
@@ -1118,10 +1118,8 @@ new_sess_out:
|
||||
idr_remove(&sess_idr, conn->sess->session_index);
|
||||
spin_unlock_bh(&sess_idr_lock);
|
||||
}
|
||||
if (conn->sess->sess_ops)
|
||||
kfree(conn->sess->sess_ops);
|
||||
if (conn->sess)
|
||||
kfree(conn->sess);
|
||||
kfree(conn->sess->sess_ops);
|
||||
kfree(conn->sess);
|
||||
old_sess_out:
|
||||
iscsi_stop_login_thread_timer(np);
|
||||
/*
|
||||
|
||||
@@ -620,8 +620,11 @@ static int iscsi_target_handle_csg_one(struct iscsi_conn *conn, struct iscsi_log
|
||||
login->req_buf,
|
||||
payload_length,
|
||||
conn);
|
||||
if (ret < 0)
|
||||
if (ret < 0) {
|
||||
iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_INITIATOR_ERR,
|
||||
ISCSI_LOGIN_STATUS_INIT_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (login->first_request)
|
||||
if (iscsi_target_check_first_request(conn, login) < 0)
|
||||
@@ -636,8 +639,11 @@ static int iscsi_target_handle_csg_one(struct iscsi_conn *conn, struct iscsi_log
|
||||
login->rsp_buf,
|
||||
&login->rsp_length,
|
||||
conn->param_list);
|
||||
if (ret < 0)
|
||||
if (ret < 0) {
|
||||
iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_INITIATOR_ERR,
|
||||
ISCSI_LOGIN_STATUS_INIT_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!login->auth_complete &&
|
||||
ISCSI_TPG_ATTRIB(ISCSI_TPG_C(conn))->authentication) {
|
||||
|
||||
@@ -154,22 +154,18 @@ static struct iscsi_param *iscsi_set_default_param(struct iscsi_param_list *para
|
||||
}
|
||||
INIT_LIST_HEAD(¶m->p_list);
|
||||
|
||||
param->name = kzalloc(strlen(name) + 1, GFP_KERNEL);
|
||||
param->name = kstrdup(name, GFP_KERNEL);
|
||||
if (!param->name) {
|
||||
pr_err("Unable to allocate memory for parameter name.\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
param->value = kzalloc(strlen(value) + 1, GFP_KERNEL);
|
||||
param->value = kstrdup(value, GFP_KERNEL);
|
||||
if (!param->value) {
|
||||
pr_err("Unable to allocate memory for parameter value.\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
memcpy(param->name, name, strlen(name));
|
||||
param->name[strlen(name)] = '\0';
|
||||
memcpy(param->value, value, strlen(value));
|
||||
param->value[strlen(value)] = '\0';
|
||||
param->phase = phase;
|
||||
param->scope = scope;
|
||||
param->sender = sender;
|
||||
@@ -635,11 +631,8 @@ void iscsi_release_param_list(struct iscsi_param_list *param_list)
|
||||
list_del(¶m->p_list);
|
||||
|
||||
kfree(param->name);
|
||||
param->name = NULL;
|
||||
kfree(param->value);
|
||||
param->value = NULL;
|
||||
kfree(param);
|
||||
param = NULL;
|
||||
}
|
||||
|
||||
iscsi_release_extra_responses(param_list);
|
||||
@@ -687,15 +680,12 @@ int iscsi_update_param_value(struct iscsi_param *param, char *value)
|
||||
{
|
||||
kfree(param->value);
|
||||
|
||||
param->value = kzalloc(strlen(value) + 1, GFP_KERNEL);
|
||||
param->value = kstrdup(value, GFP_KERNEL);
|
||||
if (!param->value) {
|
||||
pr_err("Unable to allocate memory for value.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
memcpy(param->value, value, strlen(value));
|
||||
param->value[strlen(value)] = '\0';
|
||||
|
||||
pr_debug("iSCSI Parameter updated to %s=%s\n",
|
||||
param->name, param->value);
|
||||
return 0;
|
||||
|
||||
@@ -50,8 +50,8 @@ u8 iscsit_tmr_abort_task(
|
||||
if (!ref_cmd) {
|
||||
pr_err("Unable to locate RefTaskTag: 0x%08x on CID:"
|
||||
" %hu.\n", hdr->rtt, conn->cid);
|
||||
return (be32_to_cpu(hdr->refcmdsn) >= conn->sess->exp_cmd_sn &&
|
||||
be32_to_cpu(hdr->refcmdsn) <= conn->sess->max_cmd_sn) ?
|
||||
return (iscsi_sna_gte(be32_to_cpu(hdr->refcmdsn), conn->sess->exp_cmd_sn) &&
|
||||
iscsi_sna_lte(be32_to_cpu(hdr->refcmdsn), conn->sess->max_cmd_sn)) ?
|
||||
ISCSI_TMF_RSP_COMPLETE : ISCSI_TMF_RSP_NO_TASK;
|
||||
}
|
||||
if (ref_cmd->cmd_sn != be32_to_cpu(hdr->refcmdsn)) {
|
||||
|
||||
@@ -66,8 +66,7 @@ static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
list_for_each_entry(ts, &inactive_ts_list, ts_list)
|
||||
break;
|
||||
ts = list_first_entry(&inactive_ts_list, struct iscsi_thread_set, ts_list);
|
||||
|
||||
list_del(&ts->ts_list);
|
||||
iscsit_global->inactive_ts--;
|
||||
|
||||
@@ -500,8 +500,8 @@ struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_conn *c
|
||||
spin_unlock_bh(&conn->immed_queue_lock);
|
||||
return NULL;
|
||||
}
|
||||
list_for_each_entry(qr, &conn->immed_queue_list, qr_list)
|
||||
break;
|
||||
qr = list_first_entry(&conn->immed_queue_list,
|
||||
struct iscsi_queue_req, qr_list);
|
||||
|
||||
list_del(&qr->qr_list);
|
||||
if (qr->cmd)
|
||||
@@ -575,8 +575,8 @@ struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *co
|
||||
return NULL;
|
||||
}
|
||||
|
||||
list_for_each_entry(qr, &conn->response_queue_list, qr_list)
|
||||
break;
|
||||
qr = list_first_entry(&conn->response_queue_list,
|
||||
struct iscsi_queue_req, qr_list);
|
||||
|
||||
list_del(&qr->qr_list);
|
||||
if (qr->cmd)
|
||||
|
||||
@@ -53,7 +53,6 @@ struct tcm_loop_hba {
|
||||
struct se_hba_s *se_hba;
|
||||
struct se_lun *tl_hba_lun;
|
||||
struct se_port *tl_hba_lun_sep;
|
||||
struct se_device_s *se_dev_hba_ptr;
|
||||
struct tcm_loop_nexus *tl_nexus;
|
||||
struct device dev;
|
||||
struct Scsi_Host *sh;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
config SBP_TARGET
|
||||
tristate "FireWire SBP-2 fabric module"
|
||||
depends on FIREWIRE && EXPERIMENTAL
|
||||
depends on FIREWIRE
|
||||
help
|
||||
Say Y or M here to enable SCSI target functionality over FireWire.
|
||||
This enables you to expose SCSI devices to other nodes on the FireWire
|
||||
|
||||
@@ -704,16 +704,17 @@ static void session_maintenance_work(struct work_struct *work)
|
||||
static int tgt_agent_rw_agent_state(struct fw_card *card, int tcode, void *data,
|
||||
struct sbp_target_agent *agent)
|
||||
{
|
||||
__be32 state;
|
||||
int state;
|
||||
|
||||
switch (tcode) {
|
||||
case TCODE_READ_QUADLET_REQUEST:
|
||||
pr_debug("tgt_agent AGENT_STATE READ\n");
|
||||
|
||||
spin_lock_bh(&agent->lock);
|
||||
state = cpu_to_be32(agent->state);
|
||||
state = agent->state;
|
||||
spin_unlock_bh(&agent->lock);
|
||||
memcpy(data, &state, sizeof(state));
|
||||
|
||||
*(__be32 *)data = cpu_to_be32(state);
|
||||
|
||||
return RCODE_COMPLETE;
|
||||
|
||||
@@ -2207,20 +2208,23 @@ static struct se_portal_group *sbp_make_tpg(
|
||||
tport->mgt_agt = sbp_management_agent_register(tport);
|
||||
if (IS_ERR(tport->mgt_agt)) {
|
||||
ret = PTR_ERR(tport->mgt_agt);
|
||||
kfree(tpg);
|
||||
return ERR_PTR(ret);
|
||||
goto out_free_tpg;
|
||||
}
|
||||
|
||||
ret = core_tpg_register(&sbp_fabric_configfs->tf_ops, wwn,
|
||||
&tpg->se_tpg, (void *)tpg,
|
||||
TRANSPORT_TPG_TYPE_NORMAL);
|
||||
if (ret < 0) {
|
||||
sbp_management_agent_unregister(tport->mgt_agt);
|
||||
kfree(tpg);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
if (ret < 0)
|
||||
goto out_unreg_mgt_agt;
|
||||
|
||||
return &tpg->se_tpg;
|
||||
|
||||
out_unreg_mgt_agt:
|
||||
sbp_management_agent_unregister(tport->mgt_agt);
|
||||
out_free_tpg:
|
||||
tport->tpg = NULL;
|
||||
kfree(tpg);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
static void sbp_drop_tpg(struct se_portal_group *se_tpg)
|
||||
|
||||
+144
-202
File diff suppressed because it is too large
Load Diff
@@ -72,8 +72,8 @@ extern struct kmem_cache *t10_alua_lu_gp_mem_cache;
|
||||
extern struct kmem_cache *t10_alua_tg_pt_gp_cache;
|
||||
extern struct kmem_cache *t10_alua_tg_pt_gp_mem_cache;
|
||||
|
||||
extern int target_emulate_report_target_port_groups(struct se_cmd *);
|
||||
extern int target_emulate_set_target_port_groups(struct se_cmd *);
|
||||
extern sense_reason_t target_emulate_report_target_port_groups(struct se_cmd *);
|
||||
extern sense_reason_t target_emulate_set_target_port_groups(struct se_cmd *);
|
||||
extern int core_alua_check_nonop_delay(struct se_cmd *);
|
||||
extern int core_alua_do_port_transition(struct t10_alua_tg_pt_gp *,
|
||||
struct se_device *, struct se_port *,
|
||||
@@ -91,7 +91,7 @@ extern void __core_alua_drop_lu_gp_mem(struct t10_alua_lu_gp_member *,
|
||||
struct t10_alua_lu_gp *);
|
||||
extern void core_alua_drop_lu_gp_dev(struct se_device *);
|
||||
extern struct t10_alua_tg_pt_gp *core_alua_allocate_tg_pt_gp(
|
||||
struct se_subsystem_dev *, const char *, int);
|
||||
struct se_device *, const char *, int);
|
||||
extern int core_alua_set_tg_pt_gp_id(struct t10_alua_tg_pt_gp *, u16);
|
||||
extern struct t10_alua_tg_pt_gp_member *core_alua_allocate_tg_pt_gp_mem(
|
||||
struct se_port *);
|
||||
@@ -131,6 +131,7 @@ extern ssize_t core_alua_show_secondary_write_metadata(struct se_lun *,
|
||||
char *);
|
||||
extern ssize_t core_alua_store_secondary_write_metadata(struct se_lun *,
|
||||
const char *, size_t);
|
||||
extern int core_setup_alua(struct se_device *, int);
|
||||
extern int core_setup_alua(struct se_device *);
|
||||
extern sense_reason_t target_alua_state_check(struct se_cmd *cmd);
|
||||
|
||||
#endif /* TARGET_CORE_ALUA_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+309
-405
File diff suppressed because it is too large
Load Diff
@@ -4,10 +4,9 @@
|
||||
* This file contains generic fabric module configfs infrastructure for
|
||||
* TCM v4.x code
|
||||
*
|
||||
* Copyright (c) 2010,2011 Rising Tide Systems
|
||||
* Copyright (c) 2010,2011 Linux-iSCSI.org
|
||||
* (c) Copyright 2010-2012 RisingTide Systems LLC.
|
||||
*
|
||||
* Copyright (c) Nicholas A. Bellinger <nab@linux-iscsi.org>
|
||||
* Nicholas A. Bellinger <nab@linux-iscsi.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -71,6 +70,12 @@ static int target_fabric_mappedlun_link(
|
||||
struct se_portal_group *se_tpg;
|
||||
struct config_item *nacl_ci, *tpg_ci, *tpg_ci_s, *wwn_ci, *wwn_ci_s;
|
||||
int ret = 0, lun_access;
|
||||
|
||||
if (lun->lun_link_magic != SE_LUN_LINK_MAGIC) {
|
||||
pr_err("Bad lun->lun_link_magic, not a valid lun_ci pointer:"
|
||||
" %p to struct lun: %p\n", lun_ci, lun);
|
||||
return -EFAULT;
|
||||
}
|
||||
/*
|
||||
* Ensure that the source port exists
|
||||
*/
|
||||
@@ -358,7 +363,7 @@ static struct config_group *target_fabric_make_mappedlun(
|
||||
}
|
||||
|
||||
lacl_cg = &lacl->se_lun_group;
|
||||
lacl_cg->default_groups = kzalloc(sizeof(struct config_group) * 2,
|
||||
lacl_cg->default_groups = kmalloc(sizeof(struct config_group *) * 2,
|
||||
GFP_KERNEL);
|
||||
if (!lacl_cg->default_groups) {
|
||||
pr_err("Unable to allocate lacl_cg->default_groups\n");
|
||||
@@ -374,7 +379,7 @@ static struct config_group *target_fabric_make_mappedlun(
|
||||
lacl_cg->default_groups[1] = NULL;
|
||||
|
||||
ml_stat_grp = &lacl->ml_stat_grps.stat_group;
|
||||
ml_stat_grp->default_groups = kzalloc(sizeof(struct config_group) * 3,
|
||||
ml_stat_grp->default_groups = kmalloc(sizeof(struct config_group *) * 3,
|
||||
GFP_KERNEL);
|
||||
if (!ml_stat_grp->default_groups) {
|
||||
pr_err("Unable to allocate ml_stat_grp->default_groups\n");
|
||||
@@ -734,17 +739,21 @@ static int target_fabric_port_link(
|
||||
struct config_item *se_dev_ci)
|
||||
{
|
||||
struct config_item *tpg_ci;
|
||||
struct se_device *dev;
|
||||
struct se_lun *lun = container_of(to_config_group(lun_ci),
|
||||
struct se_lun, lun_group);
|
||||
struct se_lun *lun_p;
|
||||
struct se_portal_group *se_tpg;
|
||||
struct se_subsystem_dev *se_dev = container_of(
|
||||
to_config_group(se_dev_ci), struct se_subsystem_dev,
|
||||
se_dev_group);
|
||||
struct se_device *dev =
|
||||
container_of(to_config_group(se_dev_ci), struct se_device, dev_group);
|
||||
struct target_fabric_configfs *tf;
|
||||
int ret;
|
||||
|
||||
if (dev->dev_link_magic != SE_DEV_LINK_MAGIC) {
|
||||
pr_err("Bad dev->dev_link_magic, not a valid se_dev_ci pointer:"
|
||||
" %p to struct se_device: %p\n", se_dev_ci, dev);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
tpg_ci = &lun_ci->ci_parent->ci_group->cg_item;
|
||||
se_tpg = container_of(to_config_group(tpg_ci),
|
||||
struct se_portal_group, tpg_group);
|
||||
@@ -755,14 +764,6 @@ static int target_fabric_port_link(
|
||||
return -EEXIST;
|
||||
}
|
||||
|
||||
dev = se_dev->se_dev_ptr;
|
||||
if (!dev) {
|
||||
pr_err("Unable to locate struct se_device pointer from"
|
||||
" %s\n", config_item_name(se_dev_ci));
|
||||
ret = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
|
||||
lun_p = core_dev_add_lun(se_tpg, dev, lun->unpacked_lun);
|
||||
if (IS_ERR(lun_p)) {
|
||||
pr_err("core_dev_add_lun() failed\n");
|
||||
@@ -869,7 +870,7 @@ static struct config_group *target_fabric_make_lun(
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
lun_cg = &lun->lun_group;
|
||||
lun_cg->default_groups = kzalloc(sizeof(struct config_group) * 2,
|
||||
lun_cg->default_groups = kmalloc(sizeof(struct config_group *) * 2,
|
||||
GFP_KERNEL);
|
||||
if (!lun_cg->default_groups) {
|
||||
pr_err("Unable to allocate lun_cg->default_groups\n");
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
* This file contains generic high level protocol identifier and PR
|
||||
* handlers for TCM fabric modules
|
||||
*
|
||||
* Copyright (c) 2010 Rising Tide Systems, Inc.
|
||||
* Copyright (c) 2010 Linux-iSCSI.org
|
||||
* (c) Copyright 2010-2012 RisingTide Systems LLC.
|
||||
*
|
||||
* Nicholas A. Bellinger <nab@linux-iscsi.org>
|
||||
*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user