Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dae8f283 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull SCSI target fixes from Nicholas Bellinger:
 "These are mostly minor fixes, with the exception of the following that
  address fall-out from recent v4.1-rc1 changes:

   - regression fix related to the big fabric API registration changes
     and configfs_depend_item() usage, that required cherry-picking one
     of HCH's patches from for-next to address the issue for v4.1 code.

   - remaining TCM-USER -v2 related changes to enforce full CDB
     passthrough from Andy + Ilias.

  Also included is a target_core_pscsi driver fix from Andy that
  addresses a long standing issue with a Scsi_Host reference being
  leaked on PSCSI device shutdown"

* git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
  iser-target: Fix error path in isert_create_pi_ctx()
  target: Use a PASSTHROUGH flag instead of transport_types
  target: Move passthrough CDB parsing into a common function
  target/user: Only support full command pass-through
  target/user: Update example code for new ABI requirements
  target/pscsi: Don't leak scsi_host if hba is VIRTUAL_HOST
  target: Fix se_tpg_tfo->tf_subsys regression + remove tf_subsystem
  target: Drop signal_pending checks after interruptible lock acquire
  target: Add missing parentheses
  target: Fix bidi command handling
  target/user: Disallow full passthrough (pass_level=0)
  ISCSI: fix minor memory leak
parents 30a5f118 b2feda4f
Loading
Loading
Loading
Loading
+7 −26
Original line number Diff line number Diff line
@@ -15,8 +15,7 @@ Contents:
  a) Discovering and configuring TCMU uio devices
  b) Waiting for events on the device(s)
  c) Managing the command ring
3) Command filtering and pass_level
4) A final note
3) A final note


TCM Userspace Design
@@ -324,7 +323,7 @@ int handle_device_events(int fd, void *map)
  /* Process events from cmd ring until we catch up with cmd_head */
  while (ent != (void *)mb + mb->cmdr_off + mb->cmd_head) {

    if (tcmu_hdr_get_op(&ent->hdr) == TCMU_OP_CMD) {
    if (tcmu_hdr_get_op(ent->hdr.len_op) == TCMU_OP_CMD) {
      uint8_t *cdb = (void *)mb + ent->req.cdb_off;
      bool success = true;

@@ -339,8 +338,12 @@ int handle_device_events(int fd, void *map)
        ent->rsp.scsi_status = SCSI_CHECK_CONDITION;
      }
    }
    else if (tcmu_hdr_get_op(ent->hdr.len_op) != TCMU_OP_PAD) {
      /* Tell the kernel we didn't handle unknown opcodes */
      ent->hdr.uflags |= TCMU_UFLAG_UNKNOWN_OP;
    }
    else {
      /* Do nothing for PAD entries */
      /* Do nothing for PAD entries except update cmd_tail */
    }

    /* update cmd_tail */
@@ -360,28 +363,6 @@ int handle_device_events(int fd, void *map)
}


Command filtering and pass_level
--------------------------------

TCMU supports a "pass_level" option with valid values of 0 or 1.  When
the value is 0 (the default), nearly all SCSI commands received for
the device are passed through to the handler. This allows maximum
flexibility but increases the amount of code required by the handler,
to support all mandatory SCSI commands. If pass_level is set to 1,
then only IO-related commands are presented, and the rest are handled
by LIO's in-kernel command emulation. The commands presented at level
1 include all versions of:

READ
WRITE
WRITE_VERIFY
XDWRITEREAD
WRITE_SAME
COMPARE_AND_WRITE
SYNCHRONIZE_CACHE
UNMAP


A final note
------------

+3 −3
Original line number Diff line number Diff line
@@ -547,11 +547,11 @@ isert_create_pi_ctx(struct fast_reg_descriptor *desc,
	return 0;

err_prot_mr:
	ib_dereg_mr(desc->pi_ctx->prot_mr);
	ib_dereg_mr(pi_ctx->prot_mr);
err_prot_frpl:
	ib_free_fast_reg_page_list(desc->pi_ctx->prot_frpl);
	ib_free_fast_reg_page_list(pi_ctx->prot_frpl);
err_pi_ctx:
	kfree(desc->pi_ctx);
	kfree(pi_ctx);

	return ret;
}
+2 −4
Original line number Diff line number Diff line
@@ -1020,8 +1020,7 @@ static void tcm_qla2xxx_depend_tpg(struct work_struct *work)
	struct se_portal_group *se_tpg = &base_tpg->se_tpg;
	struct scsi_qla_host *base_vha = base_tpg->lport->qla_vha;

	if (!configfs_depend_item(se_tpg->se_tpg_tfo->tf_subsys,
				  &se_tpg->tpg_group.cg_item)) {
	if (!target_depend_item(&se_tpg->tpg_group.cg_item)) {
		atomic_set(&base_tpg->lport_tpg_enabled, 1);
		qlt_enable_vha(base_vha);
	}
@@ -1037,8 +1036,7 @@ static void tcm_qla2xxx_undepend_tpg(struct work_struct *work)

	if (!qlt_stop_phase1(base_vha->vha_tgt.qla_tgt)) {
		atomic_set(&base_tpg->lport_tpg_enabled, 0);
		configfs_undepend_item(se_tpg->se_tpg_tfo->tf_subsys,
				       &se_tpg->tpg_group.cg_item);
		target_undepend_item(&se_tpg->tpg_group.cg_item);
	}
	complete(&base_tpg->tpg_base_comp);
}
+1 −1
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ int iscsit_access_np(struct iscsi_np *np, struct iscsi_portal_group *tpg)
	 * Here we serialize access across the TIQN+TPG Tuple.
	 */
	ret = down_interruptible(&tpg->np_login_sem);
	if ((ret != 0) || signal_pending(current))
	if (ret != 0)
		return -1;

	spin_lock_bh(&tpg->tpg_state_lock);
+1 −0
Original line number Diff line number Diff line
@@ -346,6 +346,7 @@ static int iscsi_login_zero_tsih_s1(
	if (IS_ERR(sess->se_sess)) {
		iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
				ISCSI_LOGIN_STATUS_NO_RESOURCES);
		kfree(sess->sess_ops);
		kfree(sess);
		return -ENOMEM;
	}
Loading