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

Commit e477f3e0 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull SCSI target fixes from Nicholas Bellinger:
 "Here are current target-pending fixes for v4.0-rc5 code that have made
  their way into the queue over the last weeks.

  The fixes this round include:

   - Fix long-standing iser-target logout bug related to early
     conn_logout_comp completion, resulting in iscsi_conn use-after-tree
     OOpsen.  (Sagi + nab)

   - Fix long-standing tcm_fc bug in ft_invl_hw_context() failure
     handing for DDP hw offload.  (DanC)

   - Fix incorrect use of unprotected __transport_register_session() in
     tcm_qla2xxx + other single local se_node_acl fabrics.  (Bart)

   - Fix reference leak in target_submit_cmd() -> target_get_sess_cmd()
     for ack_kref=1 failure path.  (Bart)

   - Fix pSCSI backend ->get_device_type() statistics OOPs with
     un-configured device.  (Olaf + nab)

   - Fix virtual LUN=0 target_configure_device failure OOPs at modprobe
     time.  (Claudio + nab)

   - Fix FUA write false positive failure regression in v4.0-rc1 code.
     (Christophe Vu-Brugier + HCH)"

* git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
  target: do not reject FUA CDBs when write cache is enabled but emulate_write_cache is 0
  target: Fix virtual LUN=0 target_configure_device failure OOPs
  target/pscsi: Fix NULL pointer dereference in get_device_type
  tcm_fc: missing curly braces in ft_invl_hw_context()
  target: Fix reference leak in target_get_sess_cmd() error path
  loop/usb/vhost-scsi/xen-scsiback: Fix use of __transport_register_session
  tcm_qla2xxx: Fix incorrect use of __transport_register_session
  iscsi-target: Avoid early conn_logout_comp for iser connections
  Revert "iscsi-target: Avoid IN_LOGOUT failure case for iser-target"
  target: Disallow changing of WRITE cache/FUA attrs after export
parents da6b9a20 9bc6548f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1596,7 +1596,7 @@ static int tcm_qla2xxx_check_initiator_node_acl(
	/*
	 * Finally register the new FC Nexus with TCM
	 */
	__transport_register_session(se_nacl->se_tpg, se_nacl, se_sess, sess);
	transport_register_session(se_nacl->se_tpg, se_nacl, se_sess, sess);

	return 0;
}
+10 −4
Original line number Diff line number Diff line
@@ -4256,10 +4256,16 @@ int iscsit_close_connection(
	pr_debug("Closing iSCSI connection CID %hu on SID:"
		" %u\n", conn->cid, sess->sid);
	/*
	 * Always up conn_logout_comp just in case the RX Thread is sleeping
	 * and the logout response never got sent because the connection
	 * failed.
	 * Always up conn_logout_comp for the traditional TCP case just in case
	 * the RX Thread in iscsi_target_rx_opcode() is sleeping and the logout
	 * response never got sent because the connection failed.
	 *
	 * However for iser-target, isert_wait4logout() is using conn_logout_comp
	 * to signal logout response TX interrupt completion.  Go ahead and skip
	 * this for iser since isert_rx_opcode() does not wait on logout failure,
	 * and to avoid iscsi_conn pointer dereference in iser-target code.
	 */
	if (conn->conn_transport->transport_type == ISCSI_TCP)
		complete(&conn->conn_logout_comp);

	iscsi_release_thread_set(conn);
+1 −3
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@
#include <target/target_core_fabric.h>

#include <target/iscsi/iscsi_target_core.h>
#include <target/iscsi/iscsi_transport.h>
#include "iscsi_target_seq_pdu_list.h"
#include "iscsi_target_tq.h"
#include "iscsi_target_erl0.h"
@@ -940,7 +939,6 @@ void iscsit_take_action_for_connection_exit(struct iscsi_conn *conn)

	if (conn->conn_state == TARG_CONN_STATE_IN_LOGOUT) {
		spin_unlock_bh(&conn->state_lock);
		if (conn->conn_transport->transport_type == ISCSI_TCP)
		iscsit_close_connection(conn);
		return;
	}
+2 −5
Original line number Diff line number Diff line
@@ -953,11 +953,8 @@ static int tcm_loop_make_nexus(
		transport_free_session(tl_nexus->se_sess);
		goto out;
	}
	/*
	 * Now, register the SAS I_T Nexus as active with the call to
	 * transport_register_session()
	 */
	__transport_register_session(se_tpg, tl_nexus->se_sess->se_node_acl,
	/* Now, register the SAS I_T Nexus as active. */
	transport_register_session(se_tpg, tl_nexus->se_sess->se_node_acl,
			tl_nexus->se_sess, tl_nexus);
	tl_tpg->tl_nexus = tl_nexus;
	pr_debug("TCM_Loop_ConfigFS: Established I_T Nexus to emulated"
+29 −3
Original line number Diff line number Diff line
@@ -650,6 +650,18 @@ static u32 se_dev_align_max_sectors(u32 max_sectors, u32 block_size)
	return aligned_max_sectors;
}

bool se_dev_check_wce(struct se_device *dev)
{
	bool wce = false;

	if (dev->transport->get_write_cache)
		wce = dev->transport->get_write_cache(dev);
	else if (dev->dev_attrib.emulate_write_cache > 0)
		wce = true;

	return wce;
}

int se_dev_set_max_unmap_lba_count(
	struct se_device *dev,
	u32 max_unmap_lba_count)
@@ -767,6 +779,16 @@ int se_dev_set_emulate_fua_write(struct se_device *dev, int flag)
		pr_err("Illegal value %d\n", flag);
		return -EINVAL;
	}
	if (flag &&
	    dev->transport->get_write_cache) {
		pr_err("emulate_fua_write not supported for this device\n");
		return -EINVAL;
	}
	if (dev->export_count) {
		pr_err("emulate_fua_write cannot be changed with active"
		       " exports: %d\n", dev->export_count);
		return -EINVAL;
	}
	dev->dev_attrib.emulate_fua_write = flag;
	pr_debug("dev[%p]: SE Device Forced Unit Access WRITEs: %d\n",
			dev, dev->dev_attrib.emulate_fua_write);
@@ -801,7 +823,11 @@ int se_dev_set_emulate_write_cache(struct se_device *dev, int flag)
		pr_err("emulate_write_cache not supported for this device\n");
		return -EINVAL;
	}

	if (dev->export_count) {
		pr_err("emulate_write_cache cannot be changed with active"
		       " exports: %d\n", dev->export_count);
		return -EINVAL;
	}
	dev->dev_attrib.emulate_write_cache = flag;
	pr_debug("dev[%p]: SE Device WRITE_CACHE_EMULATION flag: %d\n",
			dev, dev->dev_attrib.emulate_write_cache);
@@ -1534,8 +1560,6 @@ int target_configure_device(struct se_device *dev)
	ret = dev->transport->configure_device(dev);
	if (ret)
		goto out;
	dev->dev_flags |= DF_CONFIGURED;

	/*
	 * XXX: there is not much point to have two different values here..
	 */
@@ -1597,6 +1621,8 @@ int target_configure_device(struct se_device *dev)
	list_add_tail(&dev->g_dev_node, &g_device_list);
	mutex_unlock(&g_device_mutex);

	dev->dev_flags |= DF_CONFIGURED;

	return 0;

out_free_alua:
Loading