mirror of
https://github.com/a52xq-dev/kernel.git
synced 2026-10-18 21:58:11 +07:00
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target updates from Nicholas Bellinger: "Things have been quiet this round with mostly bugfixes, percpu conversions, and other minor iscsi-target conformance testing changes. The highlights include: - Add demo_mode_discovery attribute for iscsi-target (Thomas) - Convert tcm_fc(FCoE) to use percpu-ida pre-allocation - Add send completion interrupt coalescing for ib_isert - Convert target-core to use percpu-refcounting for se_lun - Fix mutex_trylock usage bug in iscsit_increment_maxcmdsn - tcm_loop updates (Hannes) - target-core ALUA cleanups + prep for v3.14 SCSI Referrals support (Hannes) v3.14 is currently shaping to be a busy development cycle in target land, with initial support for T10 Referrals and T10 DIF currently on the roadmap" * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (40 commits) iscsi-target: chap auth shouldn't match username with trailing garbage iscsi-target: fix extract_param to handle buffer length corner case iscsi-target: Expose default_erl as TPG attribute target_core_configfs: split up ALUA supported states target_core_alua: Make supported states configurable target_core_alua: Store supported ALUA states target_core_alua: Rename ALUA_ACCESS_STATE_OPTIMIZED target_core_alua: spellcheck target core: rename (ex,im)plict -> (ex,im)plicit percpu-refcount: Add percpu-refcount.o to obj-y iscsi-target: Do not reject non-immediate CmdSNs exceeding MaxCmdSN iscsi-target: Convert iscsi_session statistics to atomic_long_t target: Convert se_device statistics to atomic_long_t target: Fix delayed Task Aborted Status (TAS) handling bug iscsi-target: Reject unsupported multi PDU text command sequence ib_isert: Avoid duplicate iscsit_increment_maxcmdsn call iscsi-target: Fix mutex_trylock usage in iscsit_increment_maxcmdsn target: Core does not need blkdev.h target: Pass through I/O topology for block backstores iser-target: Avoid using FRMR for single dma entry requests ...
This commit is contained in:
commit
b0e3636f65
53 changed files with 1009 additions and 789 deletions
|
|
@ -440,15 +440,15 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
|
|||
buf += " /*\n"
|
||||
buf += " * Setup default attribute lists for various fabric->tf_cit_tmpl\n"
|
||||
buf += " */\n"
|
||||
buf += " TF_CIT_TMPL(fabric)->tfc_wwn_cit.ct_attrs = " + fabric_mod_name + "_wwn_attrs;\n"
|
||||
buf += " TF_CIT_TMPL(fabric)->tfc_tpg_base_cit.ct_attrs = NULL;\n"
|
||||
buf += " TF_CIT_TMPL(fabric)->tfc_tpg_attrib_cit.ct_attrs = NULL;\n"
|
||||
buf += " TF_CIT_TMPL(fabric)->tfc_tpg_param_cit.ct_attrs = NULL;\n"
|
||||
buf += " TF_CIT_TMPL(fabric)->tfc_tpg_np_base_cit.ct_attrs = NULL;\n"
|
||||
buf += " TF_CIT_TMPL(fabric)->tfc_tpg_nacl_base_cit.ct_attrs = NULL;\n"
|
||||
buf += " TF_CIT_TMPL(fabric)->tfc_tpg_nacl_attrib_cit.ct_attrs = NULL;\n"
|
||||
buf += " TF_CIT_TMPL(fabric)->tfc_tpg_nacl_auth_cit.ct_attrs = NULL;\n"
|
||||
buf += " TF_CIT_TMPL(fabric)->tfc_tpg_nacl_param_cit.ct_attrs = NULL;\n"
|
||||
buf += " fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = " + fabric_mod_name + "_wwn_attrs;\n"
|
||||
buf += " fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = NULL;\n"
|
||||
buf += " fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs = NULL;\n"
|
||||
buf += " fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs = NULL;\n"
|
||||
buf += " fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs = NULL;\n"
|
||||
buf += " fabric->tf_cit_tmpl.tfc_tpg_nacl_base_cit.ct_attrs = NULL;\n"
|
||||
buf += " fabric->tf_cit_tmpl.tfc_tpg_nacl_attrib_cit.ct_attrs = NULL;\n"
|
||||
buf += " fabric->tf_cit_tmpl.tfc_tpg_nacl_auth_cit.ct_attrs = NULL;\n"
|
||||
buf += " fabric->tf_cit_tmpl.tfc_tpg_nacl_param_cit.ct_attrs = NULL;\n"
|
||||
buf += " /*\n"
|
||||
buf += " * Register the fabric for use within TCM\n"
|
||||
buf += " */\n"
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include <linux/socket.h>
|
||||
#include <linux/in.h>
|
||||
#include <linux/in6.h>
|
||||
#include <linux/llist.h>
|
||||
#include <rdma/ib_verbs.h>
|
||||
#include <rdma/rdma_cm.h>
|
||||
#include <target/target_core_base.h>
|
||||
|
|
@ -489,6 +490,7 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
|
|||
kref_init(&isert_conn->conn_kref);
|
||||
kref_get(&isert_conn->conn_kref);
|
||||
mutex_init(&isert_conn->conn_mutex);
|
||||
mutex_init(&isert_conn->conn_comp_mutex);
|
||||
spin_lock_init(&isert_conn->conn_lock);
|
||||
|
||||
cma_id->context = isert_conn;
|
||||
|
|
@ -843,14 +845,32 @@ isert_init_tx_hdrs(struct isert_conn *isert_conn,
|
|||
}
|
||||
|
||||
static void
|
||||
isert_init_send_wr(struct isert_cmd *isert_cmd, struct ib_send_wr *send_wr)
|
||||
isert_init_send_wr(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd,
|
||||
struct ib_send_wr *send_wr, bool coalesce)
|
||||
{
|
||||
struct iser_tx_desc *tx_desc = &isert_cmd->tx_desc;
|
||||
|
||||
isert_cmd->rdma_wr.iser_ib_op = ISER_IB_SEND;
|
||||
send_wr->wr_id = (unsigned long)&isert_cmd->tx_desc;
|
||||
send_wr->opcode = IB_WR_SEND;
|
||||
send_wr->send_flags = IB_SEND_SIGNALED;
|
||||
send_wr->sg_list = &isert_cmd->tx_desc.tx_sg[0];
|
||||
send_wr->sg_list = &tx_desc->tx_sg[0];
|
||||
send_wr->num_sge = isert_cmd->tx_desc.num_sge;
|
||||
/*
|
||||
* Coalesce send completion interrupts by only setting IB_SEND_SIGNALED
|
||||
* bit for every ISERT_COMP_BATCH_COUNT number of ib_post_send() calls.
|
||||
*/
|
||||
mutex_lock(&isert_conn->conn_comp_mutex);
|
||||
if (coalesce &&
|
||||
++isert_conn->conn_comp_batch < ISERT_COMP_BATCH_COUNT) {
|
||||
llist_add(&tx_desc->comp_llnode, &isert_conn->conn_comp_llist);
|
||||
mutex_unlock(&isert_conn->conn_comp_mutex);
|
||||
return;
|
||||
}
|
||||
isert_conn->conn_comp_batch = 0;
|
||||
tx_desc->comp_llnode_batch = llist_del_all(&isert_conn->conn_comp_llist);
|
||||
mutex_unlock(&isert_conn->conn_comp_mutex);
|
||||
|
||||
send_wr->send_flags = IB_SEND_SIGNALED;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -1582,8 +1602,8 @@ isert_response_completion(struct iser_tx_desc *tx_desc,
|
|||
}
|
||||
|
||||
static void
|
||||
isert_send_completion(struct iser_tx_desc *tx_desc,
|
||||
struct isert_conn *isert_conn)
|
||||
__isert_send_completion(struct iser_tx_desc *tx_desc,
|
||||
struct isert_conn *isert_conn)
|
||||
{
|
||||
struct ib_device *ib_dev = isert_conn->conn_cm_id->device;
|
||||
struct isert_cmd *isert_cmd = tx_desc->isert_cmd;
|
||||
|
|
@ -1623,6 +1643,24 @@ isert_send_completion(struct iser_tx_desc *tx_desc,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
isert_send_completion(struct iser_tx_desc *tx_desc,
|
||||
struct isert_conn *isert_conn)
|
||||
{
|
||||
struct llist_node *llnode = tx_desc->comp_llnode_batch;
|
||||
struct iser_tx_desc *t;
|
||||
/*
|
||||
* Drain coalesced completion llist starting from comp_llnode_batch
|
||||
* setup in isert_init_send_wr(), and then complete trailing tx_desc.
|
||||
*/
|
||||
while (llnode) {
|
||||
t = llist_entry(llnode, struct iser_tx_desc, comp_llnode);
|
||||
llnode = llist_next(llnode);
|
||||
__isert_send_completion(t, isert_conn);
|
||||
}
|
||||
__isert_send_completion(tx_desc, isert_conn);
|
||||
}
|
||||
|
||||
static void
|
||||
isert_cq_comp_err(struct iser_tx_desc *tx_desc, struct isert_conn *isert_conn)
|
||||
{
|
||||
|
|
@ -1793,7 +1831,7 @@ isert_put_response(struct iscsi_conn *conn, struct iscsi_cmd *cmd)
|
|||
isert_cmd->tx_desc.num_sge = 2;
|
||||
}
|
||||
|
||||
isert_init_send_wr(isert_cmd, send_wr);
|
||||
isert_init_send_wr(isert_conn, isert_cmd, send_wr, true);
|
||||
|
||||
pr_debug("Posting SCSI Response IB_WR_SEND >>>>>>>>>>>>>>>>>>>>>>\n");
|
||||
|
||||
|
|
@ -1813,7 +1851,7 @@ isert_put_nopin(struct iscsi_cmd *cmd, struct iscsi_conn *conn,
|
|||
&isert_cmd->tx_desc.iscsi_header,
|
||||
nopout_response);
|
||||
isert_init_tx_hdrs(isert_conn, &isert_cmd->tx_desc);
|
||||
isert_init_send_wr(isert_cmd, send_wr);
|
||||
isert_init_send_wr(isert_conn, isert_cmd, send_wr, false);
|
||||
|
||||
pr_debug("Posting NOPIN Response IB_WR_SEND >>>>>>>>>>>>>>>>>>>>>>\n");
|
||||
|
||||
|
|
@ -1831,7 +1869,7 @@ isert_put_logout_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn)
|
|||
iscsit_build_logout_rsp(cmd, conn, (struct iscsi_logout_rsp *)
|
||||
&isert_cmd->tx_desc.iscsi_header);
|
||||
isert_init_tx_hdrs(isert_conn, &isert_cmd->tx_desc);
|
||||
isert_init_send_wr(isert_cmd, send_wr);
|
||||
isert_init_send_wr(isert_conn, isert_cmd, send_wr, false);
|
||||
|
||||
pr_debug("Posting Logout Response IB_WR_SEND >>>>>>>>>>>>>>>>>>>>>>\n");
|
||||
|
||||
|
|
@ -1849,7 +1887,7 @@ isert_put_tm_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn)
|
|||
iscsit_build_task_mgt_rsp(cmd, conn, (struct iscsi_tm_rsp *)
|
||||
&isert_cmd->tx_desc.iscsi_header);
|
||||
isert_init_tx_hdrs(isert_conn, &isert_cmd->tx_desc);
|
||||
isert_init_send_wr(isert_cmd, send_wr);
|
||||
isert_init_send_wr(isert_conn, isert_cmd, send_wr, false);
|
||||
|
||||
pr_debug("Posting Task Management Response IB_WR_SEND >>>>>>>>>>>>>>>>>>>>>>\n");
|
||||
|
||||
|
|
@ -1881,7 +1919,7 @@ isert_put_reject(struct iscsi_cmd *cmd, struct iscsi_conn *conn)
|
|||
tx_dsg->lkey = isert_conn->conn_mr->lkey;
|
||||
isert_cmd->tx_desc.num_sge = 2;
|
||||
|
||||
isert_init_send_wr(isert_cmd, send_wr);
|
||||
isert_init_send_wr(isert_conn, isert_cmd, send_wr, false);
|
||||
|
||||
pr_debug("Posting Reject IB_WR_SEND >>>>>>>>>>>>>>>>>>>>>>\n");
|
||||
|
||||
|
|
@ -1921,7 +1959,7 @@ isert_put_text_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn)
|
|||
tx_dsg->lkey = isert_conn->conn_mr->lkey;
|
||||
isert_cmd->tx_desc.num_sge = 2;
|
||||
}
|
||||
isert_init_send_wr(isert_cmd, send_wr);
|
||||
isert_init_send_wr(isert_conn, isert_cmd, send_wr, false);
|
||||
|
||||
pr_debug("Posting Text Response IB_WR_SEND >>>>>>>>>>>>>>>>>>>>>>\n");
|
||||
|
||||
|
|
@ -1991,8 +2029,6 @@ isert_map_rdma(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
|
|||
|
||||
if (wr->iser_ib_op == ISER_IB_RDMA_WRITE) {
|
||||
data_left = se_cmd->data_length;
|
||||
iscsit_increment_maxcmdsn(cmd, conn->sess);
|
||||
cmd->stat_sn = conn->stat_sn++;
|
||||
} else {
|
||||
sg_off = cmd->write_data_done / PAGE_SIZE;
|
||||
data_left = se_cmd->data_length - cmd->write_data_done;
|
||||
|
|
@ -2204,8 +2240,6 @@ isert_reg_rdma_frwr(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
|
|||
|
||||
if (wr->iser_ib_op == ISER_IB_RDMA_WRITE) {
|
||||
data_left = se_cmd->data_length;
|
||||
iscsit_increment_maxcmdsn(cmd, conn->sess);
|
||||
cmd->stat_sn = conn->stat_sn++;
|
||||
} else {
|
||||
sg_off = cmd->write_data_done / PAGE_SIZE;
|
||||
data_left = se_cmd->data_length - cmd->write_data_done;
|
||||
|
|
@ -2259,18 +2293,26 @@ isert_reg_rdma_frwr(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
|
|||
data_len = min(data_left, rdma_write_max);
|
||||
wr->cur_rdma_length = data_len;
|
||||
|
||||
spin_lock_irqsave(&isert_conn->conn_lock, flags);
|
||||
fr_desc = list_first_entry(&isert_conn->conn_frwr_pool,
|
||||
struct fast_reg_descriptor, list);
|
||||
list_del(&fr_desc->list);
|
||||
spin_unlock_irqrestore(&isert_conn->conn_lock, flags);
|
||||
wr->fr_desc = fr_desc;
|
||||
/* if there is a single dma entry, dma mr is sufficient */
|
||||
if (count == 1) {
|
||||
ib_sge->addr = ib_sg_dma_address(ib_dev, &sg_start[0]);
|
||||
ib_sge->length = ib_sg_dma_len(ib_dev, &sg_start[0]);
|
||||
ib_sge->lkey = isert_conn->conn_mr->lkey;
|
||||
wr->fr_desc = NULL;
|
||||
} else {
|
||||
spin_lock_irqsave(&isert_conn->conn_lock, flags);
|
||||
fr_desc = list_first_entry(&isert_conn->conn_frwr_pool,
|
||||
struct fast_reg_descriptor, list);
|
||||
list_del(&fr_desc->list);
|
||||
spin_unlock_irqrestore(&isert_conn->conn_lock, flags);
|
||||
wr->fr_desc = fr_desc;
|
||||
|
||||
ret = isert_fast_reg_mr(fr_desc, isert_cmd, isert_conn,
|
||||
ib_sge, offset, data_len);
|
||||
if (ret) {
|
||||
list_add_tail(&fr_desc->list, &isert_conn->conn_frwr_pool);
|
||||
goto unmap_sg;
|
||||
ret = isert_fast_reg_mr(fr_desc, isert_cmd, isert_conn,
|
||||
ib_sge, offset, data_len);
|
||||
if (ret) {
|
||||
list_add_tail(&fr_desc->list, &isert_conn->conn_frwr_pool);
|
||||
goto unmap_sg;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -2306,10 +2348,11 @@ isert_put_datain(struct iscsi_conn *conn, struct iscsi_cmd *cmd)
|
|||
* Build isert_conn->tx_desc for iSCSI response PDU and attach
|
||||
*/
|
||||
isert_create_send_desc(isert_conn, isert_cmd, &isert_cmd->tx_desc);
|
||||
iscsit_build_rsp_pdu(cmd, conn, false, (struct iscsi_scsi_rsp *)
|
||||
iscsit_build_rsp_pdu(cmd, conn, true, (struct iscsi_scsi_rsp *)
|
||||
&isert_cmd->tx_desc.iscsi_header);
|
||||
isert_init_tx_hdrs(isert_conn, &isert_cmd->tx_desc);
|
||||
isert_init_send_wr(isert_cmd, &isert_cmd->tx_desc.send_wr);
|
||||
isert_init_send_wr(isert_conn, isert_cmd,
|
||||
&isert_cmd->tx_desc.send_wr, true);
|
||||
|
||||
atomic_inc(&isert_conn->post_send_buf_count);
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ struct iser_tx_desc {
|
|||
struct ib_sge tx_sg[2];
|
||||
int num_sge;
|
||||
struct isert_cmd *isert_cmd;
|
||||
struct llist_node *comp_llnode_batch;
|
||||
struct llist_node comp_llnode;
|
||||
struct ib_send_wr send_wr;
|
||||
} __packed;
|
||||
|
||||
|
|
@ -121,6 +123,10 @@ struct isert_conn {
|
|||
int conn_frwr_pool_size;
|
||||
/* lock to protect frwr_pool */
|
||||
spinlock_t conn_lock;
|
||||
#define ISERT_COMP_BATCH_COUNT 8
|
||||
int conn_comp_batch;
|
||||
struct llist_head conn_comp_llist;
|
||||
struct mutex conn_comp_mutex;
|
||||
};
|
||||
|
||||
#define ISERT_MAX_CQ 64
|
||||
|
|
|
|||
|
|
@ -1352,11 +1352,8 @@ static int srpt_abort_cmd(struct srpt_send_ioctx *ioctx)
|
|||
|
||||
/* XXX(hch): this is a horrible layering violation.. */
|
||||
spin_lock_irqsave(&ioctx->cmd.t_state_lock, flags);
|
||||
ioctx->cmd.transport_state |= CMD_T_LUN_STOP;
|
||||
ioctx->cmd.transport_state &= ~CMD_T_ACTIVE;
|
||||
spin_unlock_irqrestore(&ioctx->cmd.t_state_lock, flags);
|
||||
|
||||
complete(&ioctx->cmd.transport_lun_stop_comp);
|
||||
break;
|
||||
case SRPT_STATE_CMD_RSP_SENT:
|
||||
/*
|
||||
|
|
@ -1364,9 +1361,6 @@ static int srpt_abort_cmd(struct srpt_send_ioctx *ioctx)
|
|||
* not been received in time.
|
||||
*/
|
||||
srpt_unmap_sg_to_ib_sge(ioctx->ch, ioctx);
|
||||
spin_lock_irqsave(&ioctx->cmd.t_state_lock, flags);
|
||||
ioctx->cmd.transport_state |= CMD_T_LUN_STOP;
|
||||
spin_unlock_irqrestore(&ioctx->cmd.t_state_lock, flags);
|
||||
target_put_sess_cmd(ioctx->ch->sess, &ioctx->cmd);
|
||||
break;
|
||||
case SRPT_STATE_MGMT_RSP_SENT:
|
||||
|
|
@ -1476,7 +1470,6 @@ static void srpt_handle_rdma_err_comp(struct srpt_rdma_ch *ch,
|
|||
{
|
||||
struct se_cmd *cmd;
|
||||
enum srpt_command_state state;
|
||||
unsigned long flags;
|
||||
|
||||
cmd = &ioctx->cmd;
|
||||
state = srpt_get_cmd_state(ioctx);
|
||||
|
|
@ -1496,9 +1489,6 @@ static void srpt_handle_rdma_err_comp(struct srpt_rdma_ch *ch,
|
|||
__func__, __LINE__, state);
|
||||
break;
|
||||
case SRPT_RDMA_WRITE_LAST:
|
||||
spin_lock_irqsave(&ioctx->cmd.t_state_lock, flags);
|
||||
ioctx->cmd.transport_state |= CMD_T_LUN_STOP;
|
||||
spin_unlock_irqrestore(&ioctx->cmd.t_state_lock, flags);
|
||||
break;
|
||||
default:
|
||||
printk(KERN_ERR "%s[%d]: opcode = %u\n", __func__,
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ static int tcm_qla2xxx_check_demo_mode(struct se_portal_group *se_tpg)
|
|||
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
||||
struct tcm_qla2xxx_tpg, se_tpg);
|
||||
|
||||
return QLA_TPG_ATTRIB(tpg)->generate_node_acls;
|
||||
return tpg->tpg_attrib.generate_node_acls;
|
||||
}
|
||||
|
||||
static int tcm_qla2xxx_check_demo_mode_cache(struct se_portal_group *se_tpg)
|
||||
|
|
@ -338,7 +338,7 @@ static int tcm_qla2xxx_check_demo_mode_cache(struct se_portal_group *se_tpg)
|
|||
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
||||
struct tcm_qla2xxx_tpg, se_tpg);
|
||||
|
||||
return QLA_TPG_ATTRIB(tpg)->cache_dynamic_acls;
|
||||
return tpg->tpg_attrib.cache_dynamic_acls;
|
||||
}
|
||||
|
||||
static int tcm_qla2xxx_check_demo_write_protect(struct se_portal_group *se_tpg)
|
||||
|
|
@ -346,7 +346,7 @@ static int tcm_qla2xxx_check_demo_write_protect(struct se_portal_group *se_tpg)
|
|||
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
||||
struct tcm_qla2xxx_tpg, se_tpg);
|
||||
|
||||
return QLA_TPG_ATTRIB(tpg)->demo_mode_write_protect;
|
||||
return tpg->tpg_attrib.demo_mode_write_protect;
|
||||
}
|
||||
|
||||
static int tcm_qla2xxx_check_prod_write_protect(struct se_portal_group *se_tpg)
|
||||
|
|
@ -354,7 +354,7 @@ static int tcm_qla2xxx_check_prod_write_protect(struct se_portal_group *se_tpg)
|
|||
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
||||
struct tcm_qla2xxx_tpg, se_tpg);
|
||||
|
||||
return QLA_TPG_ATTRIB(tpg)->prod_mode_write_protect;
|
||||
return tpg->tpg_attrib.prod_mode_write_protect;
|
||||
}
|
||||
|
||||
static int tcm_qla2xxx_check_demo_mode_login_only(struct se_portal_group *se_tpg)
|
||||
|
|
@ -362,7 +362,7 @@ static int tcm_qla2xxx_check_demo_mode_login_only(struct se_portal_group *se_tpg
|
|||
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
||||
struct tcm_qla2xxx_tpg, se_tpg);
|
||||
|
||||
return QLA_TPG_ATTRIB(tpg)->demo_mode_login_only;
|
||||
return tpg->tpg_attrib.demo_mode_login_only;
|
||||
}
|
||||
|
||||
static struct se_node_acl *tcm_qla2xxx_alloc_fabric_acl(
|
||||
|
|
@ -847,7 +847,7 @@ static ssize_t tcm_qla2xxx_tpg_attrib_show_##name( \
|
|||
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, \
|
||||
struct tcm_qla2xxx_tpg, se_tpg); \
|
||||
\
|
||||
return sprintf(page, "%u\n", QLA_TPG_ATTRIB(tpg)->name); \
|
||||
return sprintf(page, "%u\n", tpg->tpg_attrib.name); \
|
||||
} \
|
||||
\
|
||||
static ssize_t tcm_qla2xxx_tpg_attrib_store_##name( \
|
||||
|
|
@ -1027,10 +1027,10 @@ static struct se_portal_group *tcm_qla2xxx_make_tpg(
|
|||
* By default allow READ-ONLY TPG demo-mode access w/ cached dynamic
|
||||
* NodeACLs
|
||||
*/
|
||||
QLA_TPG_ATTRIB(tpg)->generate_node_acls = 1;
|
||||
QLA_TPG_ATTRIB(tpg)->demo_mode_write_protect = 1;
|
||||
QLA_TPG_ATTRIB(tpg)->cache_dynamic_acls = 1;
|
||||
QLA_TPG_ATTRIB(tpg)->demo_mode_login_only = 1;
|
||||
tpg->tpg_attrib.generate_node_acls = 1;
|
||||
tpg->tpg_attrib.demo_mode_write_protect = 1;
|
||||
tpg->tpg_attrib.cache_dynamic_acls = 1;
|
||||
tpg->tpg_attrib.demo_mode_login_only = 1;
|
||||
|
||||
ret = core_tpg_register(&tcm_qla2xxx_fabric_configfs->tf_ops, wwn,
|
||||
&tpg->se_tpg, tpg, TRANSPORT_TPG_TYPE_NORMAL);
|
||||
|
|
@ -1830,16 +1830,16 @@ static int tcm_qla2xxx_register_configfs(void)
|
|||
/*
|
||||
* Setup default attribute lists for various fabric->tf_cit_tmpl
|
||||
*/
|
||||
TF_CIT_TMPL(fabric)->tfc_wwn_cit.ct_attrs = tcm_qla2xxx_wwn_attrs;
|
||||
TF_CIT_TMPL(fabric)->tfc_tpg_base_cit.ct_attrs = tcm_qla2xxx_tpg_attrs;
|
||||
TF_CIT_TMPL(fabric)->tfc_tpg_attrib_cit.ct_attrs =
|
||||
fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = tcm_qla2xxx_wwn_attrs;
|
||||
fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = tcm_qla2xxx_tpg_attrs;
|
||||
fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs =
|
||||
tcm_qla2xxx_tpg_attrib_attrs;
|
||||
TF_CIT_TMPL(fabric)->tfc_tpg_param_cit.ct_attrs = NULL;
|
||||
TF_CIT_TMPL(fabric)->tfc_tpg_np_base_cit.ct_attrs = NULL;
|
||||
TF_CIT_TMPL(fabric)->tfc_tpg_nacl_base_cit.ct_attrs = NULL;
|
||||
TF_CIT_TMPL(fabric)->tfc_tpg_nacl_attrib_cit.ct_attrs = NULL;
|
||||
TF_CIT_TMPL(fabric)->tfc_tpg_nacl_auth_cit.ct_attrs = NULL;
|
||||
TF_CIT_TMPL(fabric)->tfc_tpg_nacl_param_cit.ct_attrs = NULL;
|
||||
fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs = NULL;
|
||||
fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs = NULL;
|
||||
fabric->tf_cit_tmpl.tfc_tpg_nacl_base_cit.ct_attrs = NULL;
|
||||
fabric->tf_cit_tmpl.tfc_tpg_nacl_attrib_cit.ct_attrs = NULL;
|
||||
fabric->tf_cit_tmpl.tfc_tpg_nacl_auth_cit.ct_attrs = NULL;
|
||||
fabric->tf_cit_tmpl.tfc_tpg_nacl_param_cit.ct_attrs = NULL;
|
||||
/*
|
||||
* Register the fabric for use within TCM
|
||||
*/
|
||||
|
|
@ -1870,15 +1870,15 @@ static int tcm_qla2xxx_register_configfs(void)
|
|||
/*
|
||||
* Setup default attribute lists for various npiv_fabric->tf_cit_tmpl
|
||||
*/
|
||||
TF_CIT_TMPL(npiv_fabric)->tfc_wwn_cit.ct_attrs = tcm_qla2xxx_wwn_attrs;
|
||||
TF_CIT_TMPL(npiv_fabric)->tfc_tpg_base_cit.ct_attrs = NULL;
|
||||
TF_CIT_TMPL(npiv_fabric)->tfc_tpg_attrib_cit.ct_attrs = NULL;
|
||||
TF_CIT_TMPL(npiv_fabric)->tfc_tpg_param_cit.ct_attrs = NULL;
|
||||
TF_CIT_TMPL(npiv_fabric)->tfc_tpg_np_base_cit.ct_attrs = NULL;
|
||||
TF_CIT_TMPL(npiv_fabric)->tfc_tpg_nacl_base_cit.ct_attrs = NULL;
|
||||
TF_CIT_TMPL(npiv_fabric)->tfc_tpg_nacl_attrib_cit.ct_attrs = NULL;
|
||||
TF_CIT_TMPL(npiv_fabric)->tfc_tpg_nacl_auth_cit.ct_attrs = NULL;
|
||||
TF_CIT_TMPL(npiv_fabric)->tfc_tpg_nacl_param_cit.ct_attrs = NULL;
|
||||
npiv_fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = tcm_qla2xxx_wwn_attrs;
|
||||
npiv_fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = NULL;
|
||||
npiv_fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs = NULL;
|
||||
npiv_fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs = NULL;
|
||||
npiv_fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs = NULL;
|
||||
npiv_fabric->tf_cit_tmpl.tfc_tpg_nacl_base_cit.ct_attrs = NULL;
|
||||
npiv_fabric->tf_cit_tmpl.tfc_tpg_nacl_attrib_cit.ct_attrs = NULL;
|
||||
npiv_fabric->tf_cit_tmpl.tfc_tpg_nacl_auth_cit.ct_attrs = NULL;
|
||||
npiv_fabric->tf_cit_tmpl.tfc_tpg_nacl_param_cit.ct_attrs = NULL;
|
||||
/*
|
||||
* Register the npiv_fabric for use within TCM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -45,8 +45,6 @@ struct tcm_qla2xxx_tpg {
|
|||
struct se_portal_group se_tpg;
|
||||
};
|
||||
|
||||
#define QLA_TPG_ATTRIB(tpg) (&(tpg)->tpg_attrib)
|
||||
|
||||
struct tcm_qla2xxx_fc_loopid {
|
||||
struct se_node_acl *se_nacl;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -805,14 +805,7 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
|
|||
int iscsi_task_attr;
|
||||
int sam_task_attr;
|
||||
|
||||
spin_lock_bh(&conn->sess->session_stats_lock);
|
||||
conn->sess->cmd_pdus++;
|
||||
if (conn->sess->se_sess->se_node_acl) {
|
||||
spin_lock(&conn->sess->se_sess->se_node_acl->stats_lock);
|
||||
conn->sess->se_sess->se_node_acl->num_cmds++;
|
||||
spin_unlock(&conn->sess->se_sess->se_node_acl->stats_lock);
|
||||
}
|
||||
spin_unlock_bh(&conn->sess->session_stats_lock);
|
||||
atomic_long_inc(&conn->sess->cmd_pdus);
|
||||
|
||||
hdr = (struct iscsi_scsi_req *) buf;
|
||||
payload_length = ntoh24(hdr->dlength);
|
||||
|
|
@ -1254,20 +1247,12 @@ iscsit_check_dataout_hdr(struct iscsi_conn *conn, unsigned char *buf,
|
|||
int rc;
|
||||
|
||||
if (!payload_length) {
|
||||
pr_err("DataOUT payload is ZERO, protocol error.\n");
|
||||
return iscsit_add_reject(conn, ISCSI_REASON_PROTOCOL_ERROR,
|
||||
buf);
|
||||
pr_warn("DataOUT payload is ZERO, ignoring.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* iSCSI write */
|
||||
spin_lock_bh(&conn->sess->session_stats_lock);
|
||||
conn->sess->rx_data_octets += payload_length;
|
||||
if (conn->sess->se_sess->se_node_acl) {
|
||||
spin_lock(&conn->sess->se_sess->se_node_acl->stats_lock);
|
||||
conn->sess->se_sess->se_node_acl->write_bytes += payload_length;
|
||||
spin_unlock(&conn->sess->se_sess->se_node_acl->stats_lock);
|
||||
}
|
||||
spin_unlock_bh(&conn->sess->session_stats_lock);
|
||||
atomic_long_add(payload_length, &conn->sess->rx_data_octets);
|
||||
|
||||
if (payload_length > conn->conn_ops->MaxXmitDataSegmentLength) {
|
||||
pr_err("DataSegmentLength: %u is greater than"
|
||||
|
|
@ -1486,7 +1471,7 @@ EXPORT_SYMBOL(iscsit_check_dataout_payload);
|
|||
|
||||
static int iscsit_handle_data_out(struct iscsi_conn *conn, unsigned char *buf)
|
||||
{
|
||||
struct iscsi_cmd *cmd;
|
||||
struct iscsi_cmd *cmd = NULL;
|
||||
struct iscsi_data *hdr = (struct iscsi_data *)buf;
|
||||
int rc;
|
||||
bool data_crc_failed = false;
|
||||
|
|
@ -1954,6 +1939,13 @@ iscsit_setup_text_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
|
|||
(unsigned char *)hdr);
|
||||
}
|
||||
|
||||
if (!(hdr->flags & ISCSI_FLAG_CMD_FINAL) ||
|
||||
(hdr->flags & ISCSI_FLAG_TEXT_CONTINUE)) {
|
||||
pr_err("Multi sequence text commands currently not supported\n");
|
||||
return iscsit_reject_cmd(cmd, ISCSI_REASON_CMD_NOT_SUPPORTED,
|
||||
(unsigned char *)hdr);
|
||||
}
|
||||
|
||||
pr_debug("Got Text Request: ITT: 0x%08x, CmdSN: 0x%08x,"
|
||||
" ExpStatSN: 0x%08x, Length: %u\n", hdr->itt, hdr->cmdsn,
|
||||
hdr->exp_statsn, payload_length);
|
||||
|
|
@ -2630,14 +2622,7 @@ static int iscsit_send_datain(struct iscsi_cmd *cmd, struct iscsi_conn *conn)
|
|||
return -1;
|
||||
}
|
||||
|
||||
spin_lock_bh(&conn->sess->session_stats_lock);
|
||||
conn->sess->tx_data_octets += datain.length;
|
||||
if (conn->sess->se_sess->se_node_acl) {
|
||||
spin_lock(&conn->sess->se_sess->se_node_acl->stats_lock);
|
||||
conn->sess->se_sess->se_node_acl->read_bytes += datain.length;
|
||||
spin_unlock(&conn->sess->se_sess->se_node_acl->stats_lock);
|
||||
}
|
||||
spin_unlock_bh(&conn->sess->session_stats_lock);
|
||||
atomic_long_add(datain.length, &conn->sess->tx_data_octets);
|
||||
/*
|
||||
* Special case for successfully execution w/ both DATAIN
|
||||
* and Sense Data.
|
||||
|
|
@ -3162,9 +3147,7 @@ void iscsit_build_rsp_pdu(struct iscsi_cmd *cmd, struct iscsi_conn *conn,
|
|||
if (inc_stat_sn)
|
||||
cmd->stat_sn = conn->stat_sn++;
|
||||
|
||||
spin_lock_bh(&conn->sess->session_stats_lock);
|
||||
conn->sess->rsp_pdus++;
|
||||
spin_unlock_bh(&conn->sess->session_stats_lock);
|
||||
atomic_long_inc(&conn->sess->rsp_pdus);
|
||||
|
||||
memset(hdr, 0, ISCSI_HDR_LEN);
|
||||
hdr->opcode = ISCSI_OP_SCSI_CMD_RSP;
|
||||
|
|
@ -3374,6 +3357,7 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd)
|
|||
struct iscsi_tiqn *tiqn;
|
||||
struct iscsi_tpg_np *tpg_np;
|
||||
int buffer_len, end_of_buf = 0, len = 0, payload_len = 0;
|
||||
int target_name_printed;
|
||||
unsigned char buf[ISCSI_IQN_LEN+12]; /* iqn + "TargetName=" + \0 */
|
||||
unsigned char *text_in = cmd->text_in_ptr, *text_ptr = NULL;
|
||||
|
||||
|
|
@ -3411,19 +3395,23 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd)
|
|||
continue;
|
||||
}
|
||||
|
||||
len = sprintf(buf, "TargetName=%s", tiqn->tiqn);
|
||||
len += 1;
|
||||
|
||||
if ((len + payload_len) > buffer_len) {
|
||||
end_of_buf = 1;
|
||||
goto eob;
|
||||
}
|
||||
memcpy(payload + payload_len, buf, len);
|
||||
payload_len += len;
|
||||
target_name_printed = 0;
|
||||
|
||||
spin_lock(&tiqn->tiqn_tpg_lock);
|
||||
list_for_each_entry(tpg, &tiqn->tiqn_tpg_list, tpg_list) {
|
||||
|
||||
/* If demo_mode_discovery=0 and generate_node_acls=0
|
||||
* (demo mode dislabed) do not return
|
||||
* TargetName+TargetAddress unless a NodeACL exists.
|
||||
*/
|
||||
|
||||
if ((tpg->tpg_attrib.generate_node_acls == 0) &&
|
||||
(tpg->tpg_attrib.demo_mode_discovery == 0) &&
|
||||
(!core_tpg_get_initiator_node_acl(&tpg->tpg_se_tpg,
|
||||
cmd->conn->sess->sess_ops->InitiatorName))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
spin_lock(&tpg->tpg_state_lock);
|
||||
if ((tpg->tpg_state == TPG_STATE_FREE) ||
|
||||
(tpg->tpg_state == TPG_STATE_INACTIVE)) {
|
||||
|
|
@ -3438,6 +3426,22 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd)
|
|||
struct iscsi_np *np = tpg_np->tpg_np;
|
||||
bool inaddr_any = iscsit_check_inaddr_any(np);
|
||||
|
||||
if (!target_name_printed) {
|
||||
len = sprintf(buf, "TargetName=%s",
|
||||
tiqn->tiqn);
|
||||
len += 1;
|
||||
|
||||
if ((len + payload_len) > buffer_len) {
|
||||
spin_unlock(&tpg->tpg_np_lock);
|
||||
spin_unlock(&tiqn->tiqn_tpg_lock);
|
||||
end_of_buf = 1;
|
||||
goto eob;
|
||||
}
|
||||
memcpy(payload + payload_len, buf, len);
|
||||
payload_len += len;
|
||||
target_name_printed = 1;
|
||||
}
|
||||
|
||||
len = sprintf(buf, "TargetAddress="
|
||||
"%s:%hu,%hu",
|
||||
(inaddr_any == false) ?
|
||||
|
|
@ -4092,9 +4096,7 @@ restart:
|
|||
* hit default in the switch below.
|
||||
*/
|
||||
memset(buffer, 0xff, ISCSI_HDR_LEN);
|
||||
spin_lock_bh(&conn->sess->session_stats_lock);
|
||||
conn->sess->conn_digest_errors++;
|
||||
spin_unlock_bh(&conn->sess->session_stats_lock);
|
||||
atomic_long_inc(&conn->sess->conn_digest_errors);
|
||||
} else {
|
||||
pr_debug("Got HeaderDigest CRC32C"
|
||||
" 0x%08x\n", checksum);
|
||||
|
|
@ -4381,7 +4383,7 @@ int iscsit_close_connection(
|
|||
|
||||
int iscsit_close_session(struct iscsi_session *sess)
|
||||
{
|
||||
struct iscsi_portal_group *tpg = ISCSI_TPG_S(sess);
|
||||
struct iscsi_portal_group *tpg = sess->tpg;
|
||||
struct se_portal_group *se_tpg = &tpg->tpg_se_tpg;
|
||||
|
||||
if (atomic_read(&sess->nconn)) {
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ static struct iscsi_chap *chap_server_open(
|
|||
/*
|
||||
* Set Identifier.
|
||||
*/
|
||||
chap->id = ISCSI_TPG_C(conn)->tpg_chap_id++;
|
||||
chap->id = conn->tpg->tpg_chap_id++;
|
||||
*aic_len += sprintf(aic_str + *aic_len, "CHAP_I=%d", chap->id);
|
||||
*aic_len += 1;
|
||||
pr_debug("[server] Sending CHAP_I=%d\n", chap->id);
|
||||
|
|
@ -146,6 +146,7 @@ static int chap_server_compute_md5(
|
|||
unsigned char client_digest[MD5_SIGNATURE_SIZE];
|
||||
unsigned char server_digest[MD5_SIGNATURE_SIZE];
|
||||
unsigned char chap_n[MAX_CHAP_N_SIZE], chap_r[MAX_RESPONSE_LENGTH];
|
||||
size_t compare_len;
|
||||
struct iscsi_chap *chap = conn->auth_protocol;
|
||||
struct crypto_hash *tfm;
|
||||
struct hash_desc desc;
|
||||
|
|
@ -184,7 +185,9 @@ static int chap_server_compute_md5(
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (memcmp(chap_n, auth->userid, strlen(auth->userid)) != 0) {
|
||||
/* Include the terminating NULL in the compare */
|
||||
compare_len = strlen(auth->userid) + 1;
|
||||
if (strncmp(chap_n, auth->userid, compare_len) != 0) {
|
||||
pr_err("CHAP_N values do not match!\n");
|
||||
goto out;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -372,7 +372,7 @@ static ssize_t iscsi_nacl_attrib_show_##name( \
|
|||
struct iscsi_node_acl *nacl = container_of(se_nacl, struct iscsi_node_acl, \
|
||||
se_node_acl); \
|
||||
\
|
||||
return sprintf(page, "%u\n", ISCSI_NODE_ATTRIB(nacl)->name); \
|
||||
return sprintf(page, "%u\n", nacl->node_attrib.name); \
|
||||
} \
|
||||
\
|
||||
static ssize_t iscsi_nacl_attrib_store_##name( \
|
||||
|
|
@ -897,7 +897,7 @@ static struct se_node_acl *lio_target_make_nodeacl(
|
|||
if (!se_nacl_new)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
cmdsn_depth = ISCSI_TPG_ATTRIB(tpg)->default_cmdsn_depth;
|
||||
cmdsn_depth = tpg->tpg_attrib.default_cmdsn_depth;
|
||||
/*
|
||||
* se_nacl_new may be released by core_tpg_add_initiator_node_acl()
|
||||
* when converting a NdoeACL from demo mode -> explict
|
||||
|
|
@ -920,9 +920,9 @@ static struct se_node_acl *lio_target_make_nodeacl(
|
|||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
stats_cg->default_groups[0] = &NODE_STAT_GRPS(acl)->iscsi_sess_stats_group;
|
||||
stats_cg->default_groups[0] = &acl->node_stat_grps.iscsi_sess_stats_group;
|
||||
stats_cg->default_groups[1] = NULL;
|
||||
config_group_init_type_name(&NODE_STAT_GRPS(acl)->iscsi_sess_stats_group,
|
||||
config_group_init_type_name(&acl->node_stat_grps.iscsi_sess_stats_group,
|
||||
"iscsi_sess_stats", &iscsi_stat_sess_cit);
|
||||
|
||||
return se_nacl;
|
||||
|
|
@ -967,7 +967,7 @@ static ssize_t iscsi_tpg_attrib_show_##name( \
|
|||
if (iscsit_get_tpg(tpg) < 0) \
|
||||
return -EINVAL; \
|
||||
\
|
||||
rb = sprintf(page, "%u\n", ISCSI_TPG_ATTRIB(tpg)->name); \
|
||||
rb = sprintf(page, "%u\n", tpg->tpg_attrib.name); \
|
||||
iscsit_put_tpg(tpg); \
|
||||
return rb; \
|
||||
} \
|
||||
|
|
@ -1041,6 +1041,16 @@ TPG_ATTR(demo_mode_write_protect, S_IRUGO | S_IWUSR);
|
|||
*/
|
||||
DEF_TPG_ATTRIB(prod_mode_write_protect);
|
||||
TPG_ATTR(prod_mode_write_protect, S_IRUGO | S_IWUSR);
|
||||
/*
|
||||
* Define iscsi_tpg_attrib_s_demo_mode_discovery,
|
||||
*/
|
||||
DEF_TPG_ATTRIB(demo_mode_discovery);
|
||||
TPG_ATTR(demo_mode_discovery, S_IRUGO | S_IWUSR);
|
||||
/*
|
||||
* Define iscsi_tpg_attrib_s_default_erl
|
||||
*/
|
||||
DEF_TPG_ATTRIB(default_erl);
|
||||
TPG_ATTR(default_erl, S_IRUGO | S_IWUSR);
|
||||
|
||||
static struct configfs_attribute *lio_target_tpg_attrib_attrs[] = {
|
||||
&iscsi_tpg_attrib_authentication.attr,
|
||||
|
|
@ -1051,6 +1061,8 @@ static struct configfs_attribute *lio_target_tpg_attrib_attrs[] = {
|
|||
&iscsi_tpg_attrib_cache_dynamic_acls.attr,
|
||||
&iscsi_tpg_attrib_demo_mode_write_protect.attr,
|
||||
&iscsi_tpg_attrib_prod_mode_write_protect.attr,
|
||||
&iscsi_tpg_attrib_demo_mode_discovery.attr,
|
||||
&iscsi_tpg_attrib_default_erl.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
|
@ -1514,21 +1526,21 @@ static struct se_wwn *lio_target_call_coreaddtiqn(
|
|||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
stats_cg->default_groups[0] = &WWN_STAT_GRPS(tiqn)->iscsi_instance_group;
|
||||
stats_cg->default_groups[1] = &WWN_STAT_GRPS(tiqn)->iscsi_sess_err_group;
|
||||
stats_cg->default_groups[2] = &WWN_STAT_GRPS(tiqn)->iscsi_tgt_attr_group;
|
||||
stats_cg->default_groups[3] = &WWN_STAT_GRPS(tiqn)->iscsi_login_stats_group;
|
||||
stats_cg->default_groups[4] = &WWN_STAT_GRPS(tiqn)->iscsi_logout_stats_group;
|
||||
stats_cg->default_groups[0] = &tiqn->tiqn_stat_grps.iscsi_instance_group;
|
||||
stats_cg->default_groups[1] = &tiqn->tiqn_stat_grps.iscsi_sess_err_group;
|
||||
stats_cg->default_groups[2] = &tiqn->tiqn_stat_grps.iscsi_tgt_attr_group;
|
||||
stats_cg->default_groups[3] = &tiqn->tiqn_stat_grps.iscsi_login_stats_group;
|
||||
stats_cg->default_groups[4] = &tiqn->tiqn_stat_grps.iscsi_logout_stats_group;
|
||||
stats_cg->default_groups[5] = NULL;
|
||||
config_group_init_type_name(&WWN_STAT_GRPS(tiqn)->iscsi_instance_group,
|
||||
config_group_init_type_name(&tiqn->tiqn_stat_grps.iscsi_instance_group,
|
||||
"iscsi_instance", &iscsi_stat_instance_cit);
|
||||
config_group_init_type_name(&WWN_STAT_GRPS(tiqn)->iscsi_sess_err_group,
|
||||
config_group_init_type_name(&tiqn->tiqn_stat_grps.iscsi_sess_err_group,
|
||||
"iscsi_sess_err", &iscsi_stat_sess_err_cit);
|
||||
config_group_init_type_name(&WWN_STAT_GRPS(tiqn)->iscsi_tgt_attr_group,
|
||||
config_group_init_type_name(&tiqn->tiqn_stat_grps.iscsi_tgt_attr_group,
|
||||
"iscsi_tgt_attr", &iscsi_stat_tgt_attr_cit);
|
||||
config_group_init_type_name(&WWN_STAT_GRPS(tiqn)->iscsi_login_stats_group,
|
||||
config_group_init_type_name(&tiqn->tiqn_stat_grps.iscsi_login_stats_group,
|
||||
"iscsi_login_stats", &iscsi_stat_login_cit);
|
||||
config_group_init_type_name(&WWN_STAT_GRPS(tiqn)->iscsi_logout_stats_group,
|
||||
config_group_init_type_name(&tiqn->tiqn_stat_grps.iscsi_logout_stats_group,
|
||||
"iscsi_logout_stats", &iscsi_stat_logout_cit);
|
||||
|
||||
pr_debug("LIO_Target_ConfigFS: REGISTER -> %s\n", tiqn->tiqn);
|
||||
|
|
@ -1784,6 +1796,11 @@ static int lio_queue_status(struct se_cmd *se_cmd)
|
|||
struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
|
||||
|
||||
cmd->i_state = ISTATE_SEND_STATUS;
|
||||
|
||||
if (cmd->se_cmd.scsi_status || cmd->sense_reason) {
|
||||
iscsit_add_cmd_to_response_queue(cmd, cmd->conn, cmd->i_state);
|
||||
return 0;
|
||||
}
|
||||
cmd->conn->conn_transport->iscsit_queue_status(cmd->conn, cmd);
|
||||
|
||||
return 0;
|
||||
|
|
@ -1815,21 +1832,21 @@ static u32 lio_tpg_get_default_depth(struct se_portal_group *se_tpg)
|
|||
{
|
||||
struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
|
||||
|
||||
return ISCSI_TPG_ATTRIB(tpg)->default_cmdsn_depth;
|
||||
return tpg->tpg_attrib.default_cmdsn_depth;
|
||||
}
|
||||
|
||||
static int lio_tpg_check_demo_mode(struct se_portal_group *se_tpg)
|
||||
{
|
||||
struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
|
||||
|
||||
return ISCSI_TPG_ATTRIB(tpg)->generate_node_acls;
|
||||
return tpg->tpg_attrib.generate_node_acls;
|
||||
}
|
||||
|
||||
static int lio_tpg_check_demo_mode_cache(struct se_portal_group *se_tpg)
|
||||
{
|
||||
struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
|
||||
|
||||
return ISCSI_TPG_ATTRIB(tpg)->cache_dynamic_acls;
|
||||
return tpg->tpg_attrib.cache_dynamic_acls;
|
||||
}
|
||||
|
||||
static int lio_tpg_check_demo_mode_write_protect(
|
||||
|
|
@ -1837,7 +1854,7 @@ static int lio_tpg_check_demo_mode_write_protect(
|
|||
{
|
||||
struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
|
||||
|
||||
return ISCSI_TPG_ATTRIB(tpg)->demo_mode_write_protect;
|
||||
return tpg->tpg_attrib.demo_mode_write_protect;
|
||||
}
|
||||
|
||||
static int lio_tpg_check_prod_mode_write_protect(
|
||||
|
|
@ -1845,7 +1862,7 @@ static int lio_tpg_check_prod_mode_write_protect(
|
|||
{
|
||||
struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
|
||||
|
||||
return ISCSI_TPG_ATTRIB(tpg)->prod_mode_write_protect;
|
||||
return tpg->tpg_attrib.prod_mode_write_protect;
|
||||
}
|
||||
|
||||
static void lio_tpg_release_fabric_acl(
|
||||
|
|
@ -1908,9 +1925,12 @@ static void lio_set_default_node_attributes(struct se_node_acl *se_acl)
|
|||
{
|
||||
struct iscsi_node_acl *acl = container_of(se_acl, struct iscsi_node_acl,
|
||||
se_node_acl);
|
||||
struct se_portal_group *se_tpg = se_acl->se_tpg;
|
||||
struct iscsi_portal_group *tpg = container_of(se_tpg,
|
||||
struct iscsi_portal_group, tpg_se_tpg);
|
||||
|
||||
ISCSI_NODE_ATTRIB(acl)->nacl = acl;
|
||||
iscsit_set_default_node_attribues(acl);
|
||||
acl->node_attrib.nacl = acl;
|
||||
iscsit_set_default_node_attribues(acl, tpg);
|
||||
}
|
||||
|
||||
static int lio_check_stop_free(struct se_cmd *se_cmd)
|
||||
|
|
@ -1995,17 +2015,17 @@ int iscsi_target_register_configfs(void)
|
|||
* Setup default attribute lists for various fabric->tf_cit_tmpl
|
||||
* sturct config_item_type's
|
||||
*/
|
||||
TF_CIT_TMPL(fabric)->tfc_discovery_cit.ct_attrs = lio_target_discovery_auth_attrs;
|
||||
TF_CIT_TMPL(fabric)->tfc_wwn_cit.ct_attrs = lio_target_wwn_attrs;
|
||||
TF_CIT_TMPL(fabric)->tfc_tpg_base_cit.ct_attrs = lio_target_tpg_attrs;
|
||||
TF_CIT_TMPL(fabric)->tfc_tpg_attrib_cit.ct_attrs = lio_target_tpg_attrib_attrs;
|
||||
TF_CIT_TMPL(fabric)->tfc_tpg_auth_cit.ct_attrs = lio_target_tpg_auth_attrs;
|
||||
TF_CIT_TMPL(fabric)->tfc_tpg_param_cit.ct_attrs = lio_target_tpg_param_attrs;
|
||||
TF_CIT_TMPL(fabric)->tfc_tpg_np_base_cit.ct_attrs = lio_target_portal_attrs;
|
||||
TF_CIT_TMPL(fabric)->tfc_tpg_nacl_base_cit.ct_attrs = lio_target_initiator_attrs;
|
||||
TF_CIT_TMPL(fabric)->tfc_tpg_nacl_attrib_cit.ct_attrs = lio_target_nacl_attrib_attrs;
|
||||
TF_CIT_TMPL(fabric)->tfc_tpg_nacl_auth_cit.ct_attrs = lio_target_nacl_auth_attrs;
|
||||
TF_CIT_TMPL(fabric)->tfc_tpg_nacl_param_cit.ct_attrs = lio_target_nacl_param_attrs;
|
||||
fabric->tf_cit_tmpl.tfc_discovery_cit.ct_attrs = lio_target_discovery_auth_attrs;
|
||||
fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = lio_target_wwn_attrs;
|
||||
fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = lio_target_tpg_attrs;
|
||||
fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs = lio_target_tpg_attrib_attrs;
|
||||
fabric->tf_cit_tmpl.tfc_tpg_auth_cit.ct_attrs = lio_target_tpg_auth_attrs;
|
||||
fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs = lio_target_tpg_param_attrs;
|
||||
fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs = lio_target_portal_attrs;
|
||||
fabric->tf_cit_tmpl.tfc_tpg_nacl_base_cit.ct_attrs = lio_target_initiator_attrs;
|
||||
fabric->tf_cit_tmpl.tfc_tpg_nacl_attrib_cit.ct_attrs = lio_target_nacl_attrib_attrs;
|
||||
fabric->tf_cit_tmpl.tfc_tpg_nacl_auth_cit.ct_attrs = lio_target_nacl_auth_attrs;
|
||||
fabric->tf_cit_tmpl.tfc_tpg_nacl_param_cit.ct_attrs = lio_target_nacl_param_attrs;
|
||||
|
||||
ret = target_fabric_configfs_register(fabric);
|
||||
if (ret < 0) {
|
||||
|
|
|
|||
|
|
@ -37,9 +37,6 @@
|
|||
#define NA_RANDOM_DATAIN_PDU_OFFSETS 0
|
||||
#define NA_RANDOM_DATAIN_SEQ_OFFSETS 0
|
||||
#define NA_RANDOM_R2T_OFFSETS 0
|
||||
#define NA_DEFAULT_ERL 0
|
||||
#define NA_DEFAULT_ERL_MAX 2
|
||||
#define NA_DEFAULT_ERL_MIN 0
|
||||
|
||||
/* struct iscsi_tpg_attrib sanity values */
|
||||
#define TA_AUTHENTICATION 1
|
||||
|
|
@ -58,6 +55,8 @@
|
|||
#define TA_DEMO_MODE_WRITE_PROTECT 1
|
||||
/* Disabled by default in production mode w/ explict ACLs */
|
||||
#define TA_PROD_MODE_WRITE_PROTECT 0
|
||||
#define TA_DEMO_MODE_DISCOVERY 1
|
||||
#define TA_DEFAULT_ERL 0
|
||||
#define TA_CACHE_CORE_NPS 0
|
||||
|
||||
|
||||
|
|
@ -192,6 +191,7 @@ enum recover_cmdsn_ret_table {
|
|||
CMDSN_NORMAL_OPERATION = 0,
|
||||
CMDSN_LOWER_THAN_EXP = 1,
|
||||
CMDSN_HIGHER_THAN_EXP = 2,
|
||||
CMDSN_MAXCMDSN_OVERRUN = 3,
|
||||
};
|
||||
|
||||
/* Used for iscsi_handle_immediate_data() return values */
|
||||
|
|
@ -650,14 +650,13 @@ struct iscsi_session {
|
|||
/* Used for session reference counting */
|
||||
int session_usage_count;
|
||||
int session_waiting_on_uc;
|
||||
u32 cmd_pdus;
|
||||
u32 rsp_pdus;
|
||||
u64 tx_data_octets;
|
||||
u64 rx_data_octets;
|
||||
u32 conn_digest_errors;
|
||||
u32 conn_timeout_errors;
|
||||
atomic_long_t cmd_pdus;
|
||||
atomic_long_t rsp_pdus;
|
||||
atomic_long_t tx_data_octets;
|
||||
atomic_long_t rx_data_octets;
|
||||
atomic_long_t conn_digest_errors;
|
||||
atomic_long_t conn_timeout_errors;
|
||||
u64 creation_time;
|
||||
spinlock_t session_stats_lock;
|
||||
/* Number of active connections */
|
||||
atomic_t nconn;
|
||||
atomic_t session_continuation;
|
||||
|
|
@ -755,11 +754,6 @@ struct iscsi_node_acl {
|
|||
struct se_node_acl se_node_acl;
|
||||
};
|
||||
|
||||
#define NODE_STAT_GRPS(nacl) (&(nacl)->node_stat_grps)
|
||||
|
||||
#define ISCSI_NODE_ATTRIB(t) (&(t)->node_attrib)
|
||||
#define ISCSI_NODE_AUTH(t) (&(t)->node_auth)
|
||||
|
||||
struct iscsi_tpg_attrib {
|
||||
u32 authentication;
|
||||
u32 login_timeout;
|
||||
|
|
@ -769,6 +763,8 @@ struct iscsi_tpg_attrib {
|
|||
u32 default_cmdsn_depth;
|
||||
u32 demo_mode_write_protect;
|
||||
u32 prod_mode_write_protect;
|
||||
u32 demo_mode_discovery;
|
||||
u32 default_erl;
|
||||
struct iscsi_portal_group *tpg;
|
||||
};
|
||||
|
||||
|
|
@ -835,12 +831,6 @@ struct iscsi_portal_group {
|
|||
struct list_head tpg_list;
|
||||
} ____cacheline_aligned;
|
||||
|
||||
#define ISCSI_TPG_C(c) ((struct iscsi_portal_group *)(c)->tpg)
|
||||
#define ISCSI_TPG_LUN(c, l) ((iscsi_tpg_list_t *)(c)->tpg->tpg_lun_list_t[l])
|
||||
#define ISCSI_TPG_S(s) ((struct iscsi_portal_group *)(s)->tpg)
|
||||
#define ISCSI_TPG_ATTRIB(t) (&(t)->tpg_attrib)
|
||||
#define SE_TPG(tpg) (&(tpg)->tpg_se_tpg)
|
||||
|
||||
struct iscsi_wwn_stat_grps {
|
||||
struct config_group iscsi_stat_group;
|
||||
struct config_group iscsi_instance_group;
|
||||
|
|
@ -871,8 +861,6 @@ struct iscsi_tiqn {
|
|||
struct iscsi_logout_stats logout_stats;
|
||||
} ____cacheline_aligned;
|
||||
|
||||
#define WWN_STAT_GRPS(tiqn) (&(tiqn)->tiqn_stat_grps)
|
||||
|
||||
struct iscsit_global {
|
||||
/* In core shutdown */
|
||||
u32 in_shutdown;
|
||||
|
|
|
|||
|
|
@ -58,11 +58,7 @@ void iscsit_increment_maxcmdsn(struct iscsi_cmd *cmd, struct iscsi_session *sess
|
|||
|
||||
cmd->maxcmdsn_inc = 1;
|
||||
|
||||
if (!mutex_trylock(&sess->cmdsn_mutex)) {
|
||||
sess->max_cmd_sn += 1;
|
||||
pr_debug("Updated MaxCmdSN to 0x%08x\n", sess->max_cmd_sn);
|
||||
return;
|
||||
}
|
||||
mutex_lock(&sess->cmdsn_mutex);
|
||||
sess->max_cmd_sn += 1;
|
||||
pr_debug("Updated MaxCmdSN to 0x%08x\n", sess->max_cmd_sn);
|
||||
mutex_unlock(&sess->cmdsn_mutex);
|
||||
|
|
|
|||
|
|
@ -757,7 +757,7 @@ int iscsit_check_post_dataout(
|
|||
static void iscsit_handle_time2retain_timeout(unsigned long data)
|
||||
{
|
||||
struct iscsi_session *sess = (struct iscsi_session *) data;
|
||||
struct iscsi_portal_group *tpg = ISCSI_TPG_S(sess);
|
||||
struct iscsi_portal_group *tpg = sess->tpg;
|
||||
struct se_portal_group *se_tpg = &tpg->tpg_se_tpg;
|
||||
|
||||
spin_lock_bh(&se_tpg->session_lock);
|
||||
|
|
@ -785,7 +785,7 @@ static void iscsit_handle_time2retain_timeout(unsigned long data)
|
|||
tiqn->sess_err_stats.last_sess_failure_type =
|
||||
ISCSI_SESS_ERR_CXN_TIMEOUT;
|
||||
tiqn->sess_err_stats.cxn_timeout_errors++;
|
||||
sess->conn_timeout_errors++;
|
||||
atomic_long_inc(&sess->conn_timeout_errors);
|
||||
spin_unlock(&tiqn->sess_err_stats.lock);
|
||||
}
|
||||
}
|
||||
|
|
@ -801,9 +801,9 @@ void iscsit_start_time2retain_handler(struct iscsi_session *sess)
|
|||
* Only start Time2Retain timer when the associated TPG is still in
|
||||
* an ACTIVE (eg: not disabled or shutdown) state.
|
||||
*/
|
||||
spin_lock(&ISCSI_TPG_S(sess)->tpg_state_lock);
|
||||
tpg_active = (ISCSI_TPG_S(sess)->tpg_state == TPG_STATE_ACTIVE);
|
||||
spin_unlock(&ISCSI_TPG_S(sess)->tpg_state_lock);
|
||||
spin_lock(&sess->tpg->tpg_state_lock);
|
||||
tpg_active = (sess->tpg->tpg_state == TPG_STATE_ACTIVE);
|
||||
spin_unlock(&sess->tpg->tpg_state_lock);
|
||||
|
||||
if (!tpg_active)
|
||||
return;
|
||||
|
|
@ -829,7 +829,7 @@ void iscsit_start_time2retain_handler(struct iscsi_session *sess)
|
|||
*/
|
||||
int iscsit_stop_time2retain_timer(struct iscsi_session *sess)
|
||||
{
|
||||
struct iscsi_portal_group *tpg = ISCSI_TPG_S(sess);
|
||||
struct iscsi_portal_group *tpg = sess->tpg;
|
||||
struct se_portal_group *se_tpg = &tpg->tpg_se_tpg;
|
||||
|
||||
if (sess->time2retain_timer_flags & ISCSI_TF_EXPIRED)
|
||||
|
|
|
|||
|
|
@ -305,7 +305,6 @@ static int iscsi_login_zero_tsih_s1(
|
|||
}
|
||||
|
||||
sess->creation_time = get_jiffies_64();
|
||||
spin_lock_init(&sess->session_stats_lock);
|
||||
/*
|
||||
* The FFP CmdSN window values will be allocated from the TPG's
|
||||
* Initiator Node's ACL once the login has been successfully completed.
|
||||
|
|
@ -347,15 +346,15 @@ static int iscsi_login_zero_tsih_s2(
|
|||
* Assign a new TPG Session Handle. Note this is protected with
|
||||
* struct iscsi_portal_group->np_login_sem from iscsit_access_np().
|
||||
*/
|
||||
sess->tsih = ++ISCSI_TPG_S(sess)->ntsih;
|
||||
sess->tsih = ++sess->tpg->ntsih;
|
||||
if (!sess->tsih)
|
||||
sess->tsih = ++ISCSI_TPG_S(sess)->ntsih;
|
||||
sess->tsih = ++sess->tpg->ntsih;
|
||||
|
||||
/*
|
||||
* Create the default params from user defined values..
|
||||
*/
|
||||
if (iscsi_copy_param_list(&conn->param_list,
|
||||
ISCSI_TPG_C(conn)->param_list, 1) < 0) {
|
||||
conn->tpg->param_list, 1) < 0) {
|
||||
iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
|
||||
ISCSI_LOGIN_STATUS_NO_RESOURCES);
|
||||
return -1;
|
||||
|
|
@ -380,7 +379,7 @@ static int iscsi_login_zero_tsih_s2(
|
|||
* In our case, we have already located the struct iscsi_tiqn at this point.
|
||||
*/
|
||||
memset(buf, 0, 32);
|
||||
sprintf(buf, "TargetPortalGroupTag=%hu", ISCSI_TPG_S(sess)->tpgt);
|
||||
sprintf(buf, "TargetPortalGroupTag=%hu", sess->tpg->tpgt);
|
||||
if (iscsi_change_param_value(buf, conn->param_list, 0) < 0) {
|
||||
iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
|
||||
ISCSI_LOGIN_STATUS_NO_RESOURCES);
|
||||
|
|
@ -575,7 +574,7 @@ static int iscsi_login_non_zero_tsih_s2(
|
|||
iscsi_login_set_conn_values(sess, conn, pdu->cid);
|
||||
|
||||
if (iscsi_copy_param_list(&conn->param_list,
|
||||
ISCSI_TPG_C(conn)->param_list, 0) < 0) {
|
||||
conn->tpg->param_list, 0) < 0) {
|
||||
iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
|
||||
ISCSI_LOGIN_STATUS_NO_RESOURCES);
|
||||
return -1;
|
||||
|
|
@ -593,7 +592,7 @@ static int iscsi_login_non_zero_tsih_s2(
|
|||
* In our case, we have already located the struct iscsi_tiqn at this point.
|
||||
*/
|
||||
memset(buf, 0, 32);
|
||||
sprintf(buf, "TargetPortalGroupTag=%hu", ISCSI_TPG_S(sess)->tpgt);
|
||||
sprintf(buf, "TargetPortalGroupTag=%hu", sess->tpg->tpgt);
|
||||
if (iscsi_change_param_value(buf, conn->param_list, 0) < 0) {
|
||||
iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
|
||||
ISCSI_LOGIN_STATUS_NO_RESOURCES);
|
||||
|
|
@ -691,7 +690,7 @@ int iscsi_post_login_handler(
|
|||
int stop_timer = 0;
|
||||
struct iscsi_session *sess = conn->sess;
|
||||
struct se_session *se_sess = sess->se_sess;
|
||||
struct iscsi_portal_group *tpg = ISCSI_TPG_S(sess);
|
||||
struct iscsi_portal_group *tpg = sess->tpg;
|
||||
struct se_portal_group *se_tpg = &tpg->tpg_se_tpg;
|
||||
struct iscsi_thread_set *ts;
|
||||
|
||||
|
|
@ -1154,7 +1153,7 @@ old_sess_out:
|
|||
spin_lock_bh(&conn->sess->conn_lock);
|
||||
if (conn->sess->session_state == TARG_SESS_STATE_FAILED) {
|
||||
struct se_portal_group *se_tpg =
|
||||
&ISCSI_TPG_C(conn)->tpg_se_tpg;
|
||||
&conn->tpg->tpg_se_tpg;
|
||||
|
||||
atomic_set(&conn->sess->session_continuation, 0);
|
||||
spin_unlock_bh(&conn->sess->conn_lock);
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ int extract_param(
|
|||
if (len < 0)
|
||||
return -1;
|
||||
|
||||
if (len > max_length) {
|
||||
if (len >= max_length) {
|
||||
pr_err("Length of input: %d exceeds max_length:"
|
||||
" %d\n", len, max_length);
|
||||
return -1;
|
||||
|
|
@ -140,7 +140,7 @@ static u32 iscsi_handle_authentication(
|
|||
iscsi_nacl = container_of(se_nacl, struct iscsi_node_acl,
|
||||
se_node_acl);
|
||||
|
||||
auth = ISCSI_NODE_AUTH(iscsi_nacl);
|
||||
auth = &iscsi_nacl->node_auth;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
|
|
@ -789,7 +789,7 @@ static int iscsi_target_handle_csg_zero(
|
|||
return -1;
|
||||
|
||||
if (!iscsi_check_negotiated_keys(conn->param_list)) {
|
||||
if (ISCSI_TPG_ATTRIB(ISCSI_TPG_C(conn))->authentication &&
|
||||
if (conn->tpg->tpg_attrib.authentication &&
|
||||
!strncmp(param->value, NONE, 4)) {
|
||||
pr_err("Initiator sent AuthMethod=None but"
|
||||
" Target is enforcing iSCSI Authentication,"
|
||||
|
|
@ -799,7 +799,7 @@ static int iscsi_target_handle_csg_zero(
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (ISCSI_TPG_ATTRIB(ISCSI_TPG_C(conn))->authentication &&
|
||||
if (conn->tpg->tpg_attrib.authentication &&
|
||||
!login->auth_complete)
|
||||
return 0;
|
||||
|
||||
|
|
@ -862,7 +862,7 @@ static int iscsi_target_handle_csg_one(struct iscsi_conn *conn, struct iscsi_log
|
|||
}
|
||||
|
||||
if (!login->auth_complete &&
|
||||
ISCSI_TPG_ATTRIB(ISCSI_TPG_C(conn))->authentication) {
|
||||
conn->tpg->tpg_attrib.authentication) {
|
||||
pr_err("Initiator is requesting CSG: 1, has not been"
|
||||
" successfully authenticated, and the Target is"
|
||||
" enforcing iSCSI Authentication, login failed.\n");
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ static inline char *iscsit_na_get_initiatorname(
|
|||
}
|
||||
|
||||
void iscsit_set_default_node_attribues(
|
||||
struct iscsi_node_acl *acl)
|
||||
struct iscsi_node_acl *acl,
|
||||
struct iscsi_portal_group *tpg)
|
||||
{
|
||||
struct iscsi_node_attrib *a = &acl->node_attrib;
|
||||
|
||||
|
|
@ -44,7 +45,7 @@ void iscsit_set_default_node_attribues(
|
|||
a->random_datain_pdu_offsets = NA_RANDOM_DATAIN_PDU_OFFSETS;
|
||||
a->random_datain_seq_offsets = NA_RANDOM_DATAIN_SEQ_OFFSETS;
|
||||
a->random_r2t_offsets = NA_RANDOM_R2T_OFFSETS;
|
||||
a->default_erl = NA_DEFAULT_ERL;
|
||||
a->default_erl = tpg->tpg_attrib.default_erl;
|
||||
}
|
||||
|
||||
int iscsit_na_dataout_timeout(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
#ifndef ISCSI_TARGET_NODEATTRIB_H
|
||||
#define ISCSI_TARGET_NODEATTRIB_H
|
||||
|
||||
extern void iscsit_set_default_node_attribues(struct iscsi_node_acl *);
|
||||
extern void iscsit_set_default_node_attribues(struct iscsi_node_acl *,
|
||||
struct iscsi_portal_group *);
|
||||
extern int iscsit_na_dataout_timeout(struct iscsi_node_acl *, u32);
|
||||
extern int iscsit_na_dataout_timeout_retries(struct iscsi_node_acl *, u32);
|
||||
extern int iscsit_na_nopin_timeout(struct iscsi_node_acl *, u32);
|
||||
|
|
|
|||
|
|
@ -792,7 +792,8 @@ static ssize_t iscsi_stat_sess_show_attr_cmd_pdus(
|
|||
if (se_sess) {
|
||||
sess = se_sess->fabric_sess_ptr;
|
||||
if (sess)
|
||||
ret = snprintf(page, PAGE_SIZE, "%u\n", sess->cmd_pdus);
|
||||
ret = snprintf(page, PAGE_SIZE, "%lu\n",
|
||||
atomic_long_read(&sess->cmd_pdus));
|
||||
}
|
||||
spin_unlock_bh(&se_nacl->nacl_sess_lock);
|
||||
|
||||
|
|
@ -815,7 +816,8 @@ static ssize_t iscsi_stat_sess_show_attr_rsp_pdus(
|
|||
if (se_sess) {
|
||||
sess = se_sess->fabric_sess_ptr;
|
||||
if (sess)
|
||||
ret = snprintf(page, PAGE_SIZE, "%u\n", sess->rsp_pdus);
|
||||
ret = snprintf(page, PAGE_SIZE, "%lu\n",
|
||||
atomic_long_read(&sess->rsp_pdus));
|
||||
}
|
||||
spin_unlock_bh(&se_nacl->nacl_sess_lock);
|
||||
|
||||
|
|
@ -838,8 +840,8 @@ static ssize_t iscsi_stat_sess_show_attr_txdata_octs(
|
|||
if (se_sess) {
|
||||
sess = se_sess->fabric_sess_ptr;
|
||||
if (sess)
|
||||
ret = snprintf(page, PAGE_SIZE, "%llu\n",
|
||||
(unsigned long long)sess->tx_data_octets);
|
||||
ret = snprintf(page, PAGE_SIZE, "%lu\n",
|
||||
atomic_long_read(&sess->tx_data_octets));
|
||||
}
|
||||
spin_unlock_bh(&se_nacl->nacl_sess_lock);
|
||||
|
||||
|
|
@ -862,8 +864,8 @@ static ssize_t iscsi_stat_sess_show_attr_rxdata_octs(
|
|||
if (se_sess) {
|
||||
sess = se_sess->fabric_sess_ptr;
|
||||
if (sess)
|
||||
ret = snprintf(page, PAGE_SIZE, "%llu\n",
|
||||
(unsigned long long)sess->rx_data_octets);
|
||||
ret = snprintf(page, PAGE_SIZE, "%lu\n",
|
||||
atomic_long_read(&sess->rx_data_octets));
|
||||
}
|
||||
spin_unlock_bh(&se_nacl->nacl_sess_lock);
|
||||
|
||||
|
|
@ -886,8 +888,8 @@ static ssize_t iscsi_stat_sess_show_attr_conn_digest_errors(
|
|||
if (se_sess) {
|
||||
sess = se_sess->fabric_sess_ptr;
|
||||
if (sess)
|
||||
ret = snprintf(page, PAGE_SIZE, "%u\n",
|
||||
sess->conn_digest_errors);
|
||||
ret = snprintf(page, PAGE_SIZE, "%lu\n",
|
||||
atomic_long_read(&sess->conn_digest_errors));
|
||||
}
|
||||
spin_unlock_bh(&se_nacl->nacl_sess_lock);
|
||||
|
||||
|
|
@ -910,8 +912,8 @@ static ssize_t iscsi_stat_sess_show_attr_conn_timeout_errors(
|
|||
if (se_sess) {
|
||||
sess = se_sess->fabric_sess_ptr;
|
||||
if (sess)
|
||||
ret = snprintf(page, PAGE_SIZE, "%u\n",
|
||||
sess->conn_timeout_errors);
|
||||
ret = snprintf(page, PAGE_SIZE, "%lu\n",
|
||||
atomic_long_read(&sess->conn_timeout_errors));
|
||||
}
|
||||
spin_unlock_bh(&se_nacl->nacl_sess_lock);
|
||||
|
||||
|
|
|
|||
|
|
@ -223,6 +223,8 @@ static void iscsit_set_default_tpg_attribs(struct iscsi_portal_group *tpg)
|
|||
a->cache_dynamic_acls = TA_CACHE_DYNAMIC_ACLS;
|
||||
a->demo_mode_write_protect = TA_DEMO_MODE_WRITE_PROTECT;
|
||||
a->prod_mode_write_protect = TA_PROD_MODE_WRITE_PROTECT;
|
||||
a->demo_mode_discovery = TA_DEMO_MODE_DISCOVERY;
|
||||
a->default_erl = TA_DEFAULT_ERL;
|
||||
}
|
||||
|
||||
int iscsit_tpg_add_portal_group(struct iscsi_tiqn *tiqn, struct iscsi_portal_group *tpg)
|
||||
|
|
@ -237,7 +239,7 @@ int iscsit_tpg_add_portal_group(struct iscsi_tiqn *tiqn, struct iscsi_portal_gro
|
|||
if (iscsi_create_default_params(&tpg->param_list) < 0)
|
||||
goto err_out;
|
||||
|
||||
ISCSI_TPG_ATTRIB(tpg)->tpg = tpg;
|
||||
tpg->tpg_attrib.tpg = tpg;
|
||||
|
||||
spin_lock(&tpg->tpg_state_lock);
|
||||
tpg->tpg_state = TPG_STATE_INACTIVE;
|
||||
|
|
@ -330,7 +332,7 @@ int iscsit_tpg_enable_portal_group(struct iscsi_portal_group *tpg)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (ISCSI_TPG_ATTRIB(tpg)->authentication) {
|
||||
if (tpg->tpg_attrib.authentication) {
|
||||
if (!strcmp(param->value, NONE)) {
|
||||
ret = iscsi_update_param_value(param, CHAP);
|
||||
if (ret)
|
||||
|
|
@ -820,3 +822,39 @@ int iscsit_ta_prod_mode_write_protect(
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int iscsit_ta_demo_mode_discovery(
|
||||
struct iscsi_portal_group *tpg,
|
||||
u32 flag)
|
||||
{
|
||||
struct iscsi_tpg_attrib *a = &tpg->tpg_attrib;
|
||||
|
||||
if ((flag != 0) && (flag != 1)) {
|
||||
pr_err("Illegal value %d\n", flag);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
a->demo_mode_discovery = flag;
|
||||
pr_debug("iSCSI_TPG[%hu] - Demo Mode Discovery bit:"
|
||||
" %s\n", tpg->tpgt, (a->demo_mode_discovery) ?
|
||||
"ON" : "OFF");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int iscsit_ta_default_erl(
|
||||
struct iscsi_portal_group *tpg,
|
||||
u32 default_erl)
|
||||
{
|
||||
struct iscsi_tpg_attrib *a = &tpg->tpg_attrib;
|
||||
|
||||
if ((default_erl != 0) && (default_erl != 1) && (default_erl != 2)) {
|
||||
pr_err("Illegal value for default_erl: %u\n", default_erl);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
a->default_erl = default_erl;
|
||||
pr_debug("iSCSI_TPG[%hu] - DefaultERL: %u\n", tpg->tpgt, a->default_erl);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,5 +37,7 @@ extern int iscsit_ta_default_cmdsn_depth(struct iscsi_portal_group *, u32);
|
|||
extern int iscsit_ta_cache_dynamic_acls(struct iscsi_portal_group *, u32);
|
||||
extern int iscsit_ta_demo_mode_write_protect(struct iscsi_portal_group *, u32);
|
||||
extern int iscsit_ta_prod_mode_write_protect(struct iscsi_portal_group *, u32);
|
||||
extern int iscsit_ta_demo_mode_discovery(struct iscsi_portal_group *, u32);
|
||||
extern int iscsit_ta_default_erl(struct iscsi_portal_group *, u32);
|
||||
|
||||
#endif /* ISCSI_TARGET_TPG_H */
|
||||
|
|
|
|||
|
|
@ -242,9 +242,9 @@ static inline int iscsit_check_received_cmdsn(struct iscsi_session *sess, u32 cm
|
|||
*/
|
||||
if (iscsi_sna_gt(cmdsn, sess->max_cmd_sn)) {
|
||||
pr_err("Received CmdSN: 0x%08x is greater than"
|
||||
" MaxCmdSN: 0x%08x, protocol error.\n", cmdsn,
|
||||
" MaxCmdSN: 0x%08x, ignoring.\n", cmdsn,
|
||||
sess->max_cmd_sn);
|
||||
ret = CMDSN_ERROR_CANNOT_RECOVER;
|
||||
ret = CMDSN_MAXCMDSN_OVERRUN;
|
||||
|
||||
} else if (cmdsn == sess->exp_cmd_sn) {
|
||||
sess->exp_cmd_sn++;
|
||||
|
|
@ -303,14 +303,16 @@ int iscsit_sequence_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
|
|||
ret = CMDSN_HIGHER_THAN_EXP;
|
||||
break;
|
||||
case CMDSN_LOWER_THAN_EXP:
|
||||
case CMDSN_MAXCMDSN_OVERRUN:
|
||||
default:
|
||||
cmd->i_state = ISTATE_REMOVE;
|
||||
iscsit_add_cmd_to_immediate_queue(cmd, conn, cmd->i_state);
|
||||
ret = cmdsn_ret;
|
||||
break;
|
||||
default:
|
||||
reason = ISCSI_REASON_PROTOCOL_ERROR;
|
||||
reject = true;
|
||||
ret = cmdsn_ret;
|
||||
/*
|
||||
* Existing callers for iscsit_sequence_cmd() will silently
|
||||
* ignore commands with CMDSN_LOWER_THAN_EXP, so force this
|
||||
* return for CMDSN_MAXCMDSN_OVERRUN as well..
|
||||
*/
|
||||
ret = CMDSN_LOWER_THAN_EXP;
|
||||
break;
|
||||
}
|
||||
mutex_unlock(&conn->sess->cmdsn_mutex);
|
||||
|
|
@ -980,7 +982,7 @@ static void iscsit_handle_nopin_response_timeout(unsigned long data)
|
|||
tiqn->sess_err_stats.last_sess_failure_type =
|
||||
ISCSI_SESS_ERR_CXN_TIMEOUT;
|
||||
tiqn->sess_err_stats.cxn_timeout_errors++;
|
||||
conn->sess->conn_timeout_errors++;
|
||||
atomic_long_inc(&conn->sess->conn_timeout_errors);
|
||||
spin_unlock_bh(&tiqn->sess_err_stats.lock);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue