Commit fdf1f7ff authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending

Pull SCSI target updates from Nicholas Bellinger:
 "The most notable item is IBM virtual SCSI target driver, that was
  originally ported to target-core back in 2010 by Tomo-san, and has
  been brought forward to v4.x code by Bryant Ly, Michael Cyr and co
  over the last months.

  Also included are two ORDERED task related bug-fixes Bryant + Michael
  found along the way using ibmvscsis with AIX guests, plus a few
  miscellaneous target-core + iscsi-target bug-fixes with associated
  stable tags"

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
  target: fix spelling mistake: "limitiation" -> "limitation"
  target: Fix residual overflow handling in target_complete_cmd_with_length
  tcm_fc: set and unset FCP_SPPF_TARG_FCN
  iscsi-target: Fix panic when adding second TCP connection to iSCSI session
  ibmvscsis: Initial commit of IBM VSCSI Tgt Driver
  target: Fix ordered task CHECK_CONDITION early exception handling
  target: Fix ordered task target_setup_cmd_from_cdb exception hang
  target: Fix max_unmap_lba_count calc overflow
  target: Fix race between iscsi-target connection shutdown + ABORT_TASK
  target: Fix missing complete during ABORT_TASK + CMD_T_FABRIC_STOP
parents a71e3604 291e3e51
...@@ -5831,7 +5831,15 @@ M: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> ...@@ -5831,7 +5831,15 @@ M: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
L: linux-scsi@vger.kernel.org L: linux-scsi@vger.kernel.org
S: Supported S: Supported
F: drivers/scsi/ibmvscsi/ibmvscsi* F: drivers/scsi/ibmvscsi/ibmvscsi*
F: drivers/scsi/ibmvscsi/viosrp.h F: include/scsi/viosrp.h
IBM Power Virtual SCSI Device Target Driver
M: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
M: Michael Cyr <mikecyr@linux.vnet.ibm.com>
L: linux-scsi@vger.kernel.org
L: target-devel@vger.kernel.org
S: Supported
F: drivers/scsi/ibmvscsi_tgt/
IBM Power Virtual FC Device Drivers IBM Power Virtual FC Device Drivers
M: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> M: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
......
...@@ -838,6 +838,23 @@ config SCSI_IBMVSCSI ...@@ -838,6 +838,23 @@ config SCSI_IBMVSCSI
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called ibmvscsi. module will be called ibmvscsi.
config SCSI_IBMVSCSIS
tristate "IBM Virtual SCSI Server support"
depends on PPC_PSERIES && TARGET_CORE && SCSI && PCI
help
This is the IBM POWER Virtual SCSI Target Server
This driver uses the SRP protocol for communication betwen servers
guest and/or the host that run on the same server.
More information on VSCSI protocol can be found at www.power.org
The userspace configuration needed to initialize the driver can be
be found here:
https://github.com/powervm/ibmvscsis/wiki/Configuration
To compile this driver as a module, choose M here: the
module will be called ibmvscsis.
config SCSI_IBMVFC config SCSI_IBMVFC
tristate "IBM Virtual FC support" tristate "IBM Virtual FC support"
depends on PPC_PSERIES && SCSI depends on PPC_PSERIES && SCSI
......
...@@ -128,6 +128,7 @@ obj-$(CONFIG_SCSI_SNI_53C710) += 53c700.o sni_53c710.o ...@@ -128,6 +128,7 @@ obj-$(CONFIG_SCSI_SNI_53C710) += 53c700.o sni_53c710.o
obj-$(CONFIG_SCSI_NSP32) += nsp32.o obj-$(CONFIG_SCSI_NSP32) += nsp32.o
obj-$(CONFIG_SCSI_IPR) += ipr.o obj-$(CONFIG_SCSI_IPR) += ipr.o
obj-$(CONFIG_SCSI_IBMVSCSI) += ibmvscsi/ obj-$(CONFIG_SCSI_IBMVSCSI) += ibmvscsi/
obj-$(CONFIG_SCSI_IBMVSCSIS) += ibmvscsi_tgt/
obj-$(CONFIG_SCSI_IBMVFC) += ibmvscsi/ obj-$(CONFIG_SCSI_IBMVFC) += ibmvscsi/
obj-$(CONFIG_SCSI_HPTIOP) += hptiop.o obj-$(CONFIG_SCSI_HPTIOP) += hptiop.o
obj-$(CONFIG_SCSI_STEX) += stex.o obj-$(CONFIG_SCSI_STEX) += stex.o
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/types.h> #include <linux/types.h>
#include "viosrp.h" #include <scsi/viosrp.h>
#define IBMVFC_NAME "ibmvfc" #define IBMVFC_NAME "ibmvfc"
#define IBMVFC_DRIVER_VERSION "1.0.11" #define IBMVFC_DRIVER_VERSION "1.0.11"
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include "viosrp.h" #include <scsi/viosrp.h>
struct scsi_cmnd; struct scsi_cmnd;
struct Scsi_Host; struct Scsi_Host;
......
obj-$(CONFIG_SCSI_IBMVSCSIS) += ibmvscsis.o
ibmvscsis-y := libsrp.o ibmvscsi_tgt.o
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
#ifndef __LIBSRP_H__
#define __LIBSRP_H__
#include <linux/list.h>
#include <linux/kfifo.h>
#include <scsi/srp.h>
enum srp_valid {
INVALIDATE_CMD_RESP_EL = 0,
VALID_CMD_RESP_EL = 0x80,
VALID_INIT_MSG = 0xC0,
VALID_TRANS_EVENT = 0xFF
};
enum srp_format {
SRP_FORMAT = 1,
MAD_FORMAT = 2,
OS400_FORMAT = 3,
AIX_FORMAT = 4,
LINUX_FORMAT = 5,
MESSAGE_IN_CRQ = 6
};
enum srp_init_msg {
INIT_MSG = 1,
INIT_COMPLETE_MSG = 2
};
enum srp_trans_event {
UNUSED_FORMAT = 0,
PARTNER_FAILED = 1,
PARTNER_DEREGISTER = 2,
MIGRATED = 6
};
enum srp_status {
HEADER_DESCRIPTOR = 0xF1,
PING = 0xF5,
PING_RESPONSE = 0xF6
};
enum srp_mad_version {
MAD_VERSION_1 = 1
};
enum srp_os_type {
OS400 = 1,
LINUX = 2,
AIX = 3,
OFW = 4
};
enum srp_task_attributes {
SRP_SIMPLE_TASK = 0,
SRP_HEAD_TASK = 1,
SRP_ORDERED_TASK = 2,
SRP_ACA_TASK = 4
};
enum {
SRP_TASK_MANAGEMENT_FUNCTION_COMPLETE = 0,
SRP_REQUEST_FIELDS_INVALID = 2,
SRP_TASK_MANAGEMENT_FUNCTION_NOT_SUPPORTED = 4,
SRP_TASK_MANAGEMENT_FUNCTION_FAILED = 5
};
struct srp_buf {
dma_addr_t dma;
void *buf;
};
struct srp_queue {
void *pool;
void *items;
struct kfifo queue;
spinlock_t lock;
};
struct srp_target {
struct device *dev;
spinlock_t lock;
struct list_head cmd_queue;
size_t srp_iu_size;
struct srp_queue iu_queue;
size_t rx_ring_size;
struct srp_buf **rx_ring;
void *ldata;
};
struct iu_entry {
struct srp_target *target;
struct list_head ilist;
dma_addr_t remote_token;
unsigned long flags;
struct srp_buf *sbuf;
u16 iu_len;
};
struct ibmvscsis_cmd;
typedef int (srp_rdma_t)(struct ibmvscsis_cmd *, struct scatterlist *, int,
struct srp_direct_buf *, int,
enum dma_data_direction, unsigned int);
int srp_target_alloc(struct srp_target *, struct device *, size_t, size_t);
void srp_target_free(struct srp_target *);
struct iu_entry *srp_iu_get(struct srp_target *);
void srp_iu_put(struct iu_entry *);
int srp_transfer_data(struct ibmvscsis_cmd *, struct srp_cmd *,
srp_rdma_t, int, int);
u64 srp_data_length(struct srp_cmd *cmd, enum dma_data_direction dir);
int srp_get_desc_table(struct srp_cmd *srp_cmd, enum dma_data_direction *dir,
u64 *data_len);
static inline int srp_cmd_direction(struct srp_cmd *cmd)
{
return (cmd->buf_fmt >> 4) ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
}
#endif
...@@ -492,7 +492,8 @@ void iscsit_aborted_task(struct iscsi_conn *conn, struct iscsi_cmd *cmd) ...@@ -492,7 +492,8 @@ void iscsit_aborted_task(struct iscsi_conn *conn, struct iscsi_cmd *cmd)
bool scsi_cmd = (cmd->iscsi_opcode == ISCSI_OP_SCSI_CMD); bool scsi_cmd = (cmd->iscsi_opcode == ISCSI_OP_SCSI_CMD);
spin_lock_bh(&conn->cmd_lock); spin_lock_bh(&conn->cmd_lock);
if (!list_empty(&cmd->i_conn_node)) if (!list_empty(&cmd->i_conn_node) &&
!(cmd->se_cmd.transport_state & CMD_T_FABRIC_STOP))
list_del_init(&cmd->i_conn_node); list_del_init(&cmd->i_conn_node);
spin_unlock_bh(&conn->cmd_lock); spin_unlock_bh(&conn->cmd_lock);
...@@ -4034,6 +4035,7 @@ int iscsi_target_rx_thread(void *arg) ...@@ -4034,6 +4035,7 @@ int iscsi_target_rx_thread(void *arg)
static void iscsit_release_commands_from_conn(struct iscsi_conn *conn) static void iscsit_release_commands_from_conn(struct iscsi_conn *conn)
{ {
LIST_HEAD(tmp_list);
struct iscsi_cmd *cmd = NULL, *cmd_tmp = NULL; struct iscsi_cmd *cmd = NULL, *cmd_tmp = NULL;
struct iscsi_session *sess = conn->sess; struct iscsi_session *sess = conn->sess;
/* /*
...@@ -4042,18 +4044,26 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn) ...@@ -4042,18 +4044,26 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn)
* has been reset -> returned sleeping pre-handler state. * has been reset -> returned sleeping pre-handler state.
*/ */
spin_lock_bh(&conn->cmd_lock); spin_lock_bh(&conn->cmd_lock);
list_for_each_entry_safe(cmd, cmd_tmp, &conn->conn_cmd_list, i_conn_node) { list_splice_init(&conn->conn_cmd_list, &tmp_list);
list_del_init(&cmd->i_conn_node); list_for_each_entry(cmd, &tmp_list, i_conn_node) {
struct se_cmd *se_cmd = &cmd->se_cmd;
if (se_cmd->se_tfo != NULL) {
spin_lock(&se_cmd->t_state_lock);
se_cmd->transport_state |= CMD_T_FABRIC_STOP;
spin_unlock(&se_cmd->t_state_lock);
}
}
spin_unlock_bh(&conn->cmd_lock); spin_unlock_bh(&conn->cmd_lock);
iscsit_increment_maxcmdsn(cmd, sess); list_for_each_entry_safe(cmd, cmd_tmp, &tmp_list, i_conn_node) {
list_del_init(&cmd->i_conn_node);
iscsit_increment_maxcmdsn(cmd, sess);
iscsit_free_cmd(cmd, true); iscsit_free_cmd(cmd, true);
spin_lock_bh(&conn->cmd_lock);
} }
spin_unlock_bh(&conn->cmd_lock);
} }
static void iscsit_stop_timers_for_cmds( static void iscsit_stop_timers_for_cmds(
......
...@@ -1371,6 +1371,7 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) ...@@ -1371,6 +1371,7 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
} }
login->zero_tsih = zero_tsih; login->zero_tsih = zero_tsih;
if (conn->sess)
conn->sess->se_sess->sup_prot_ops = conn->sess->se_sess->sup_prot_ops =
conn->conn_transport->iscsit_get_sup_prot_ops(conn); conn->conn_transport->iscsit_get_sup_prot_ops(conn);
......
...@@ -821,13 +821,15 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name) ...@@ -821,13 +821,15 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name)
* in ATA and we need to set TPE=1 * in ATA and we need to set TPE=1
*/ */
bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib, bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib,
struct request_queue *q, int block_size) struct request_queue *q)
{ {
int block_size = queue_logical_block_size(q);
if (!blk_queue_discard(q)) if (!blk_queue_discard(q))
return false; return false;
attrib->max_unmap_lba_count = (q->limits.max_discard_sectors << 9) / attrib->max_unmap_lba_count =
block_size; q->limits.max_discard_sectors >> (ilog2(block_size) - 9);
/* /*
* Currently hardcoded to 1 in Linux/SCSI code.. * Currently hardcoded to 1 in Linux/SCSI code..
*/ */
......
...@@ -161,8 +161,7 @@ static int fd_configure_device(struct se_device *dev) ...@@ -161,8 +161,7 @@ static int fd_configure_device(struct se_device *dev)
dev_size, div_u64(dev_size, fd_dev->fd_block_size), dev_size, div_u64(dev_size, fd_dev->fd_block_size),
fd_dev->fd_block_size); fd_dev->fd_block_size);
if (target_configure_unmap_from_queue(&dev->dev_attrib, q, if (target_configure_unmap_from_queue(&dev->dev_attrib, q))
fd_dev->fd_block_size))
pr_debug("IFILE: BLOCK Discard support available," pr_debug("IFILE: BLOCK Discard support available,"
" disabled by default\n"); " disabled by default\n");
/* /*
...@@ -523,7 +522,7 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, ...@@ -523,7 +522,7 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
*/ */
if (cmd->data_length > FD_MAX_BYTES) { if (cmd->data_length > FD_MAX_BYTES) {
pr_err("FILEIO: Not able to process I/O of %u bytes due to" pr_err("FILEIO: Not able to process I/O of %u bytes due to"
"FD_MAX_BYTES: %u iovec count limitiation\n", "FD_MAX_BYTES: %u iovec count limitation\n",
cmd->data_length, FD_MAX_BYTES); cmd->data_length, FD_MAX_BYTES);
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
} }
......
...@@ -121,8 +121,7 @@ static int iblock_configure_device(struct se_device *dev) ...@@ -121,8 +121,7 @@ static int iblock_configure_device(struct se_device *dev)
dev->dev_attrib.hw_max_sectors = queue_max_hw_sectors(q); dev->dev_attrib.hw_max_sectors = queue_max_hw_sectors(q);
dev->dev_attrib.hw_queue_depth = q->nr_requests; dev->dev_attrib.hw_queue_depth = q->nr_requests;
if (target_configure_unmap_from_queue(&dev->dev_attrib, q, if (target_configure_unmap_from_queue(&dev->dev_attrib, q))
dev->dev_attrib.hw_block_size))
pr_debug("IBLOCK: BLOCK Discard support available," pr_debug("IBLOCK: BLOCK Discard support available,"
" disabled by default\n"); " disabled by default\n");
......
...@@ -146,6 +146,7 @@ sense_reason_t target_cmd_size_check(struct se_cmd *cmd, unsigned int size); ...@@ -146,6 +146,7 @@ sense_reason_t target_cmd_size_check(struct se_cmd *cmd, unsigned int size);
void target_qf_do_work(struct work_struct *work); void target_qf_do_work(struct work_struct *work);
bool target_check_wce(struct se_device *dev); bool target_check_wce(struct se_device *dev);
bool target_check_fua(struct se_device *dev); bool target_check_fua(struct se_device *dev);
void __target_execute_cmd(struct se_cmd *, bool);
/* target_core_stat.c */ /* target_core_stat.c */
void target_stat_setup_dev_default_groups(struct se_device *); void target_stat_setup_dev_default_groups(struct se_device *);
......
...@@ -602,7 +602,7 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool succes ...@@ -602,7 +602,7 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool succes
cmd->transport_state |= CMD_T_ACTIVE|CMD_T_BUSY|CMD_T_SENT; cmd->transport_state |= CMD_T_ACTIVE|CMD_T_BUSY|CMD_T_SENT;
spin_unlock_irq(&cmd->t_state_lock); spin_unlock_irq(&cmd->t_state_lock);
__target_execute_cmd(cmd); __target_execute_cmd(cmd, false);
kfree(buf); kfree(buf);
return ret; return ret;
......
...@@ -754,7 +754,15 @@ EXPORT_SYMBOL(target_complete_cmd); ...@@ -754,7 +754,15 @@ EXPORT_SYMBOL(target_complete_cmd);
void target_complete_cmd_with_length(struct se_cmd *cmd, u8 scsi_status, int length) void target_complete_cmd_with_length(struct se_cmd *cmd, u8 scsi_status, int length)
{ {
if (scsi_status == SAM_STAT_GOOD && length < cmd->data_length) { if (scsi_status != SAM_STAT_GOOD) {
return;
}
/*
* Calculate new residual count based upon length of SCSI data
* transferred.
*/
if (length < cmd->data_length) {
if (cmd->se_cmd_flags & SCF_UNDERFLOW_BIT) { if (cmd->se_cmd_flags & SCF_UNDERFLOW_BIT) {
cmd->residual_count += cmd->data_length - length; cmd->residual_count += cmd->data_length - length;
} else { } else {
...@@ -763,6 +771,12 @@ void target_complete_cmd_with_length(struct se_cmd *cmd, u8 scsi_status, int len ...@@ -763,6 +771,12 @@ void target_complete_cmd_with_length(struct se_cmd *cmd, u8 scsi_status, int len
} }
cmd->data_length = length; cmd->data_length = length;
} else if (length > cmd->data_length) {
cmd->se_cmd_flags |= SCF_OVERFLOW_BIT;
cmd->residual_count = length - cmd->data_length;
} else {
cmd->se_cmd_flags &= ~(SCF_OVERFLOW_BIT | SCF_UNDERFLOW_BIT);
cmd->residual_count = 0;
} }
target_complete_cmd(cmd, scsi_status); target_complete_cmd(cmd, scsi_status);
...@@ -1303,23 +1317,6 @@ target_setup_cmd_from_cdb(struct se_cmd *cmd, unsigned char *cdb) ...@@ -1303,23 +1317,6 @@ target_setup_cmd_from_cdb(struct se_cmd *cmd, unsigned char *cdb)
trace_target_sequencer_start(cmd); trace_target_sequencer_start(cmd);
/*
* Check for an existing UNIT ATTENTION condition
*/
ret = target_scsi3_ua_check(cmd);
if (ret)
return ret;
ret = target_alua_state_check(cmd);
if (ret)
return ret;
ret = target_check_reservation(cmd);
if (ret) {
cmd->scsi_status = SAM_STAT_RESERVATION_CONFLICT;
return ret;
}
ret = dev->transport->parse_cdb(cmd); ret = dev->transport->parse_cdb(cmd);
if (ret == TCM_UNSUPPORTED_SCSI_OPCODE) if (ret == TCM_UNSUPPORTED_SCSI_OPCODE)
pr_warn_ratelimited("%s/%s: Unsupported SCSI Opcode 0x%02x, sending CHECK_CONDITION.\n", pr_warn_ratelimited("%s/%s: Unsupported SCSI Opcode 0x%02x, sending CHECK_CONDITION.\n",
...@@ -1761,20 +1758,45 @@ void transport_generic_request_failure(struct se_cmd *cmd, ...@@ -1761,20 +1758,45 @@ void transport_generic_request_failure(struct se_cmd *cmd,
} }
EXPORT_SYMBOL(transport_generic_request_failure); EXPORT_SYMBOL(transport_generic_request_failure);
void __target_execute_cmd(struct se_cmd *cmd) void __target_execute_cmd(struct se_cmd *cmd, bool do_checks)
{ {
sense_reason_t ret; sense_reason_t ret;
if (cmd->execute_cmd) { if (!cmd->execute_cmd) {
ret = cmd->execute_cmd(cmd); ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
goto err;
}
if (do_checks) {
/*
* Check for an existing UNIT ATTENTION condition after
* target_handle_task_attr() has done SAM task attr
* checking, and possibly have already defered execution
* out to target_restart_delayed_cmds() context.
*/
ret = target_scsi3_ua_check(cmd);
if (ret)
goto err;
ret = target_alua_state_check(cmd);
if (ret)
goto err;
ret = target_check_reservation(cmd);
if (ret) { if (ret) {
cmd->scsi_status = SAM_STAT_RESERVATION_CONFLICT;
goto err;
}
}
ret = cmd->execute_cmd(cmd);
if (!ret)
return;
err:
spin_lock_irq(&cmd->t_state_lock); spin_lock_irq(&cmd->t_state_lock);
cmd->transport_state &= ~(CMD_T_BUSY|CMD_T_SENT); cmd->transport_state &= ~(CMD_T_BUSY|CMD_T_SENT);
spin_unlock_irq(&cmd->t_state_lock); spin_unlock_irq(&cmd->t_state_lock);
transport_generic_request_failure(cmd, ret); transport_generic_request_failure(cmd, ret);
}
}
} }
static int target_write_prot_action(struct se_cmd *cmd) static int target_write_prot_action(struct se_cmd *cmd)
...@@ -1819,6 +1841,8 @@ static bool target_handle_task_attr(struct se_cmd *cmd) ...@@ -1819,6 +1841,8 @@ static bool target_handle_task_attr(struct se_cmd *cmd)
if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH)
return false; return false;
cmd->se_cmd_flags |= SCF_TASK_ATTR_SET;
/* /*
* Check for the existence of HEAD_OF_QUEUE, and if true return 1 * Check for the existence of HEAD_OF_QUEUE, and if true return 1
* to allow the passed struct se_cmd list of tasks to the front of the list. * to allow the passed struct se_cmd list of tasks to the front of the list.
...@@ -1899,7 +1923,7 @@ void target_execute_cmd(struct se_cmd *cmd) ...@@ -1899,7 +1923,7 @@ void target_execute_cmd(struct se_cmd *cmd)
return; return;
} }
__target_execute_cmd(cmd); __target_execute_cmd(cmd, true);
} }
EXPORT_SYMBOL(target_execute_cmd); EXPORT_SYMBOL(target_execute_cmd);
...@@ -1923,7 +1947,7 @@ static void target_restart_delayed_cmds(struct se_device *dev) ...@@ -1923,7 +1947,7 @@ static void target_restart_delayed_cmds(struct se_device *dev)
list_del(&cmd->se_delayed_node); list_del(&cmd->se_delayed_node);
spin_unlock(&dev->delayed_cmd_lock); spin_unlock(&dev->delayed_cmd_lock);
__target_execute_cmd(cmd); __target_execute_cmd(cmd, true);
if (cmd->sam_task_attr == TCM_ORDERED_TAG) if (cmd->sam_task_attr == TCM_ORDERED_TAG)
break; break;
...@@ -1941,6 +1965,9 @@ static void transport_complete_task_attr(struct se_cmd *cmd) ...@@ -1941,6 +1965,9 @@ static void transport_complete_task_attr(struct se_cmd *cmd)
if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH)
return; return;
if (!(cmd->se_cmd_flags & SCF_TASK_ATTR_SET))
goto restart;
if (cmd->sam_task_attr == TCM_SIMPLE_TAG) { if (cmd->sam_task_attr == TCM_SIMPLE_TAG) {
atomic_dec_mb(&dev->simple_cmds); atomic_dec_mb(&dev->simple_cmds);
dev->dev_cur_ordered_id++; dev->dev_cur_ordered_id++;
...@@ -1957,7 +1984,7 @@ static void transport_complete_task_attr(struct se_cmd *cmd) ...@@ -1957,7 +1984,7 @@ static void transport_complete_task_attr(struct se_cmd *cmd)
pr_debug("Incremented dev_cur_ordered_id: %u for ORDERED\n", pr_debug("Incremented dev_cur_ordered_id: %u for ORDERED\n",
dev->dev_cur_ordered_id); dev->dev_cur_ordered_id);
} }
restart:
target_restart_delayed_cmds(dev); target_restart_delayed_cmds(dev);
} }
...@@ -2557,15 +2584,10 @@ static void target_release_cmd_kref(struct kref *kref) ...@@ -2557,15 +2584,10 @@ static void target_release_cmd_kref(struct kref *kref)
bool fabric_stop; bool fabric_stop;
spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); spin_lock_irqsave(&se_sess->sess_cmd_lock, flags);
if (list_empty(&se_cmd->se_cmd_list)) {
spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags);
target_free_cmd_mem(se_cmd);
se_cmd->se_tfo->release_cmd(se_cmd);
return;
}
spin_lock(&se_cmd->t_state_lock); spin_lock(&se_cmd->t_state_lock);
fabric_stop = (se_cmd->transport_state & CMD_T_FABRIC_STOP); fabric_stop = (se_cmd->transport_state & CMD_T_FABRIC_STOP) &&
(se_cmd->transport_state & CMD_T_ABORTED);
spin_unlock(&se_cmd->t_state_lock); spin_unlock(&se_cmd->t_state_lock);
if (se_cmd->cmd_wait_set || fabric_stop) { if (se_cmd->cmd_wait_set || fabric_stop) {
......
...@@ -91,6 +91,7 @@ static void ft_tport_delete(struct ft_tport *tport) ...@@ -91,6 +91,7 @@ static void ft_tport_delete(struct ft_tport *tport)
ft_sess_delete_all(tport); ft_sess_delete_all(tport);
lport = tport->lport; lport = tport->lport;
lport->service_params &= ~FCP_SPPF_TARG_FCN;
BUG_ON(tport != lport->prov[FC_TYPE_FCP]); BUG_ON(tport != lport->prov[FC_TYPE_FCP]);
RCU_INIT_POINTER(lport->prov[FC_TYPE_FCP], NULL); RCU_INIT_POINTER(lport->prov[FC_TYPE_FCP], NULL);
...@@ -110,6 +111,7 @@ void ft_lport_add(struct fc_lport *lport, void *arg) ...@@ -110,6 +111,7 @@ void ft_lport_add(struct fc_lport *lport, void *arg)
{ {
mutex_lock(&ft_lport_lock); mutex_lock(&ft_lport_lock);
ft_tport_get(lport); ft_tport_get(lport);
lport->service_params |= FCP_SPPF_TARG_FCN;
mutex_unlock(&ft_lport_lock); mutex_unlock(&ft_lport_lock);
} }
......
...@@ -15,11 +15,6 @@ ...@@ -15,11 +15,6 @@
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */ /* GNU General Public License for more details. */
/* */ /* */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* */
/* */
/* This file contains structures and definitions for IBM RPA (RS/6000 */ /* This file contains structures and definitions for IBM RPA (RS/6000 */
/* platform architecture) implementation of the SRP (SCSI RDMA Protocol) */ /* platform architecture) implementation of the SRP (SCSI RDMA Protocol) */
/* standard. SRP is used on IBM iSeries and pSeries platforms to send SCSI */ /* standard. SRP is used on IBM iSeries and pSeries platforms to send SCSI */
...@@ -189,7 +184,7 @@ struct mad_migration_cap { ...@@ -189,7 +184,7 @@ struct mad_migration_cap {
__be32 ecl; __be32 ecl;
}; };
struct capabilities{ struct capabilities {
__be32 flags; __be32 flags;
char name[SRP_MAX_LOC_LEN]; char name[SRP_MAX_LOC_LEN];
char loc[SRP_MAX_LOC_LEN]; char loc[SRP_MAX_LOC_LEN];
......
...@@ -95,6 +95,6 @@ sense_reason_t passthrough_parse_cdb(struct se_cmd *cmd, ...@@ -95,6 +95,6 @@ sense_reason_t passthrough_parse_cdb(struct se_cmd *cmd,
bool target_sense_desc_format(struct se_device *dev); bool target_sense_desc_format(struct se_device *dev);
sector_t target_to_linux_sector(struct se_device *dev, sector_t lb); sector_t target_to_linux_sector(struct se_device *dev, sector_t lb);
bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib, bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib,
struct request_queue *q, int block_size); struct request_queue *q);
#endif /* TARGET_CORE_BACKEND_H */ #endif /* TARGET_CORE_BACKEND_H */
...@@ -142,6 +142,7 @@ enum se_cmd_flags_table { ...@@ -142,6 +142,7 @@ enum se_cmd_flags_table {
SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC = 0x00200000, SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC = 0x00200000,
SCF_ACK_KREF = 0x00400000, SCF_ACK_KREF = 0x00400000,
SCF_USE_CPUID = 0x00800000, SCF_USE_CPUID = 0x00800000,
SCF_TASK_ATTR_SET = 0x01000000,
}; };
/* /*
......
...@@ -163,7 +163,6 @@ int core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t); ...@@ -163,7 +163,6 @@ int core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t);
void core_tmr_release_req(struct se_tmr_req *); void core_tmr_release_req(struct se_tmr_req *);
int transport_generic_handle_tmr(struct se_cmd *); int transport_generic_handle_tmr(struct se_cmd *);
void transport_generic_request_failure(struct se_cmd *, sense_reason_t); void transport_generic_request_failure(struct se_cmd *, sense_reason_t);
void __target_execute_cmd(struct se_cmd *);
int transport_lookup_tmr_lun(struct se_cmd *, u64); int transport_lookup_tmr_lun(struct se_cmd *, u64);
void core_allocate_nexus_loss_ua(struct se_node_acl *acl); void core_allocate_nexus_loss_ua(struct se_node_acl *acl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment