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

Commit 7c1953dd authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (62 commits)
  target: Fix compile warning w/ missing module.h include
  target: Remove legacy se_task->task_timer and associated logic
  target: Fix incorrect transport_sent usage
  target: re-use the command S/G list for single-task commands
  target: Fix BIDI t_task_cdb handling in transport_generic_new_cmd
  target: remove transport_allocate_tasks
  target: merge transport_new_cmd_obj into transport_generic_new_cmd
  target: remove the task_sg_bidi field se_task and pSCSI BIDI support
  target: transport_subsystem_check_init cleanups
  target: use a workqueue for I/O completions
  target: remove unused TRANSPORT_ states
  target: remove TRANSPORT_DEFERRED_CMD state
  target: remove the TRANSPORT_REMOVE state
  target: move depth_left manipulation out of transport_generic_request_failure
  target: stop task timers earlier
  target: remove TF_TIMER_STOP
  target: factor some duplicate code for stopping a task
  target: fix list walking in transport_free_dev_tasks
  target: use transport_cmd_check_stop_to_fabric consistently
  target: do not pass the queue object to transport_remove_cmd_from_queue
  ...
parents 1bc67188 b91bf5bf
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -6,7 +6,6 @@ target_core_mod-y := target_core_configfs.o \
				   target_core_hba.o \
				   target_core_pr.o \
				   target_core_alua.o \
				   target_core_scdb.o \
				   target_core_tmr.o \
				   target_core_tpg.o \
				   target_core_transport.o \
+4 −35
Original line number Diff line number Diff line
@@ -765,7 +765,7 @@ static int iscsit_allocate_iovecs(struct iscsi_cmd *cmd)
	u32 iov_count = (cmd->se_cmd.t_data_nents == 0) ? 1 :
				cmd->se_cmd.t_data_nents;

	iov_count += TRANSPORT_IOV_DATA_BUFFER;
	iov_count += ISCSI_IOV_DATA_BUFFER;

	cmd->iov_data = kzalloc(iov_count * sizeof(struct kvec), GFP_KERNEL);
	if (!cmd->iov_data) {
@@ -3538,16 +3538,8 @@ int iscsi_target_tx_thread(void *arg)
				spin_lock_bh(&conn->cmd_lock);
				list_del(&cmd->i_list);
				spin_unlock_bh(&conn->cmd_lock);
				/*
				 * Determine if a struct se_cmd is assoicated with
				 * this struct iscsi_cmd.
				 */
				if (!(cmd->se_cmd.se_cmd_flags & SCF_SE_LUN_CMD) &&
				    !(cmd->tmr_req))
					iscsit_release_cmd(cmd);
				else
					transport_generic_free_cmd(&cmd->se_cmd,
								1, 0);

				iscsit_free_cmd(cmd);
				goto get_immediate;
			case ISTATE_SEND_NOPIN_WANT_RESPONSE:
				spin_unlock_bh(&cmd->istate_lock);
@@ -3940,7 +3932,6 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn)
{
	struct iscsi_cmd *cmd = NULL, *cmd_tmp = NULL;
	struct iscsi_session *sess = conn->sess;
	struct se_cmd *se_cmd;
	/*
	 * We expect this function to only ever be called from either RX or TX
	 * thread context via iscsit_close_connection() once the other context
@@ -3948,35 +3939,13 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn)
	 */
	spin_lock_bh(&conn->cmd_lock);
	list_for_each_entry_safe(cmd, cmd_tmp, &conn->conn_cmd_list, i_list) {
		if (!(cmd->se_cmd.se_cmd_flags & SCF_SE_LUN_CMD)) {

		list_del(&cmd->i_list);
		spin_unlock_bh(&conn->cmd_lock);
			iscsit_increment_maxcmdsn(cmd, sess);
			se_cmd = &cmd->se_cmd;
			/*
			 * Special cases for active iSCSI TMR, and
			 * transport_lookup_cmd_lun() failing from
			 * iscsit_get_lun_for_cmd() in iscsit_handle_scsi_cmd().
			 */
			if (cmd->tmr_req && se_cmd->transport_wait_for_tasks)
				se_cmd->transport_wait_for_tasks(se_cmd, 1, 1);
			else if (cmd->se_cmd.se_cmd_flags & SCF_SE_LUN_CMD)
				transport_release_cmd(se_cmd);
			else
				iscsit_release_cmd(cmd);

			spin_lock_bh(&conn->cmd_lock);
			continue;
		}
		list_del(&cmd->i_list);
		spin_unlock_bh(&conn->cmd_lock);

		iscsit_increment_maxcmdsn(cmd, sess);
		se_cmd = &cmd->se_cmd;

		if (se_cmd->transport_wait_for_tasks)
			se_cmd->transport_wait_for_tasks(se_cmd, 1, 1);
		iscsit_free_cmd(cmd);

		spin_lock_bh(&conn->cmd_lock);
	}
+3 −31
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
 * GNU General Public License for more details.
 ******************************************************************************/

#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/crypto.h>
#include <linux/err.h>
@@ -27,40 +28,11 @@
#include "iscsi_target_nego.h"
#include "iscsi_target_auth.h"

static unsigned char chap_asciihex_to_binaryhex(unsigned char val[2])
{
	unsigned char result = 0;
	/*
	 * MSB
	 */
	if ((val[0] >= 'a') && (val[0] <= 'f'))
		result = ((val[0] - 'a' + 10) & 0xf) << 4;
	else
		if ((val[0] >= 'A') && (val[0] <= 'F'))
			result = ((val[0] - 'A' + 10) & 0xf) << 4;
		else /* digit */
			result = ((val[0] - '0') & 0xf) << 4;
	/*
	 * LSB
	 */
	if ((val[1] >= 'a') && (val[1] <= 'f'))
		result |= ((val[1] - 'a' + 10) & 0xf);
	else
		if ((val[1] >= 'A') && (val[1] <= 'F'))
			result |= ((val[1] - 'A' + 10) & 0xf);
		else /* digit */
			result |= ((val[1] - '0') & 0xf);

	return result;
}

static int chap_string_to_hex(unsigned char *dst, unsigned char *src, int len)
{
	int i, j = 0;
	int j = DIV_ROUND_UP(len, 2);

	for (i = 0; i < len; i += 2) {
		dst[j++] = (unsigned char) chap_asciihex_to_binaryhex(&src[i]);
	}
	hex2bin(dst, src, j);

	dst[j] = '\0';
	return j;
+3 −1
Original line number Diff line number Diff line
@@ -57,6 +57,9 @@
#define TA_PROD_MODE_WRITE_PROTECT	0
#define TA_CACHE_CORE_NPS		0


#define ISCSI_IOV_DATA_BUFFER		5

enum tpg_np_network_transport_table {
	ISCSI_TCP				= 0,
	ISCSI_SCTP_TCP				= 1,
@@ -425,7 +428,6 @@ struct iscsi_cmd {
	/* Number of times struct iscsi_cmd is present in immediate queue */
	atomic_t		immed_queue_count;
	atomic_t		response_queue_count;
	atomic_t		transport_sent;
	spinlock_t		datain_lock;
	spinlock_t		dataout_timeout_lock;
	/* spinlock for protecting struct iscsi_cmd->i_state */
+7 −42
Original line number Diff line number Diff line
@@ -143,12 +143,7 @@ void iscsit_free_connection_recovery_entires(struct iscsi_session *sess)
			list_del(&cmd->i_list);
			cmd->conn = NULL;
			spin_unlock(&cr->conn_recovery_cmd_lock);
			if (!(cmd->se_cmd.se_cmd_flags & SCF_SE_LUN_CMD) ||
			    !(cmd->se_cmd.transport_wait_for_tasks))
				iscsit_release_cmd(cmd);
			else
				cmd->se_cmd.transport_wait_for_tasks(
						&cmd->se_cmd, 1, 1);
			iscsit_free_cmd(cmd);
			spin_lock(&cr->conn_recovery_cmd_lock);
		}
		spin_unlock(&cr->conn_recovery_cmd_lock);
@@ -170,12 +165,7 @@ void iscsit_free_connection_recovery_entires(struct iscsi_session *sess)
			list_del(&cmd->i_list);
			cmd->conn = NULL;
			spin_unlock(&cr->conn_recovery_cmd_lock);
			if (!(cmd->se_cmd.se_cmd_flags & SCF_SE_LUN_CMD) ||
			    !(cmd->se_cmd.transport_wait_for_tasks))
				iscsit_release_cmd(cmd);
			else
				cmd->se_cmd.transport_wait_for_tasks(
						&cmd->se_cmd, 1, 1);
			iscsit_free_cmd(cmd);
			spin_lock(&cr->conn_recovery_cmd_lock);
		}
		spin_unlock(&cr->conn_recovery_cmd_lock);
@@ -260,12 +250,7 @@ void iscsit_discard_cr_cmds_by_expstatsn(
		iscsit_remove_cmd_from_connection_recovery(cmd, sess);

		spin_unlock(&cr->conn_recovery_cmd_lock);
		if (!(cmd->se_cmd.se_cmd_flags & SCF_SE_LUN_CMD) ||
		    !(cmd->se_cmd.transport_wait_for_tasks))
			iscsit_release_cmd(cmd);
		else
			cmd->se_cmd.transport_wait_for_tasks(
					&cmd->se_cmd, 1, 0);
		iscsit_free_cmd(cmd);
		spin_lock(&cr->conn_recovery_cmd_lock);
	}
	spin_unlock(&cr->conn_recovery_cmd_lock);
@@ -319,12 +304,7 @@ int iscsit_discard_unacknowledged_ooo_cmdsns_for_conn(struct iscsi_conn *conn)
		list_del(&cmd->i_list);

		spin_unlock_bh(&conn->cmd_lock);
		if (!(cmd->se_cmd.se_cmd_flags & SCF_SE_LUN_CMD) ||
		    !(cmd->se_cmd.transport_wait_for_tasks))
			iscsit_release_cmd(cmd);
		else
			cmd->se_cmd.transport_wait_for_tasks(
					&cmd->se_cmd, 1, 1);
		iscsit_free_cmd(cmd);
		spin_lock_bh(&conn->cmd_lock);
	}
	spin_unlock_bh(&conn->cmd_lock);
@@ -377,13 +357,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn)

			list_del(&cmd->i_list);
			spin_unlock_bh(&conn->cmd_lock);

			if (!(cmd->se_cmd.se_cmd_flags & SCF_SE_LUN_CMD) ||
			    !(cmd->se_cmd.transport_wait_for_tasks))
				iscsit_release_cmd(cmd);
			else
				cmd->se_cmd.transport_wait_for_tasks(
						&cmd->se_cmd, 1, 0);
			iscsit_free_cmd(cmd);
			spin_lock_bh(&conn->cmd_lock);
			continue;
		}
@@ -403,13 +377,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn)
		     (cmd->cmd_sn >= conn->sess->exp_cmd_sn)) {
			list_del(&cmd->i_list);
			spin_unlock_bh(&conn->cmd_lock);

			if (!(cmd->se_cmd.se_cmd_flags & SCF_SE_LUN_CMD) ||
			    !(cmd->se_cmd.transport_wait_for_tasks))
				iscsit_release_cmd(cmd);
			else
				cmd->se_cmd.transport_wait_for_tasks(
						&cmd->se_cmd, 1, 1);
			iscsit_free_cmd(cmd);
			spin_lock_bh(&conn->cmd_lock);
			continue;
		}
@@ -434,10 +402,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn)

		iscsit_free_all_datain_reqs(cmd);

		if ((cmd->se_cmd.se_cmd_flags & SCF_SE_LUN_CMD) &&
		     cmd->se_cmd.transport_wait_for_tasks)
			cmd->se_cmd.transport_wait_for_tasks(&cmd->se_cmd,
					0, 0);
		transport_wait_for_tasks(&cmd->se_cmd);
		/*
		 * Add the struct iscsi_cmd to the connection recovery cmd list
		 */
Loading