Commit fb43bd08 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending

Pull scsi target fixes from Nicholas Bellinger:
 "Mostly minor fixes this time, including:

   - Add missing virtio-scsi -> TCM attribute conversion in vhost-scsi.
   - Fix persistent reservations write exclusive handling to allow
     readers for all registered I_T nexuses.
   - Drop arbitrary maximum I/O size limit in order to process I/Os
     larger than 4 MB, required for initiators that don't honor block
     limits EVPD.
   - Drop the now left-over fabric_max_sectors attribute"

* git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
  iscsi-target: Fix typos in enum cmd_flags_table
  MAINTAINERS: Add entry for iSER target driver
  target: Allow Write Exclusive non-reservation holders to READ
  target: Drop left-over fabric_max_sectors attribute
  target: Drop arbitrary maximum I/O size limit
  Documentation/target: Update fabric_ops to latest code
  vhost-scsi: Add missing virtio-scsi -> TCM attribute conversion
parents 721c21c1 8060b8dd
...@@ -389,9 +389,6 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): ...@@ -389,9 +389,6 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
buf += " .release_cmd = " + fabric_mod_name + "_release_cmd,\n" buf += " .release_cmd = " + fabric_mod_name + "_release_cmd,\n"
buf += " .shutdown_session = " + fabric_mod_name + "_shutdown_session,\n" buf += " .shutdown_session = " + fabric_mod_name + "_shutdown_session,\n"
buf += " .close_session = " + fabric_mod_name + "_close_session,\n" buf += " .close_session = " + fabric_mod_name + "_close_session,\n"
buf += " .stop_session = " + fabric_mod_name + "_stop_session,\n"
buf += " .fall_back_to_erl0 = " + fabric_mod_name + "_reset_nexus,\n"
buf += " .sess_logged_in = " + fabric_mod_name + "_sess_logged_in,\n"
buf += " .sess_get_index = " + fabric_mod_name + "_sess_get_index,\n" buf += " .sess_get_index = " + fabric_mod_name + "_sess_get_index,\n"
buf += " .sess_get_initiator_sid = NULL,\n" buf += " .sess_get_initiator_sid = NULL,\n"
buf += " .write_pending = " + fabric_mod_name + "_write_pending,\n" buf += " .write_pending = " + fabric_mod_name + "_write_pending,\n"
...@@ -402,7 +399,7 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): ...@@ -402,7 +399,7 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
buf += " .queue_data_in = " + fabric_mod_name + "_queue_data_in,\n" buf += " .queue_data_in = " + fabric_mod_name + "_queue_data_in,\n"
buf += " .queue_status = " + fabric_mod_name + "_queue_status,\n" buf += " .queue_status = " + fabric_mod_name + "_queue_status,\n"
buf += " .queue_tm_rsp = " + fabric_mod_name + "_queue_tm_rsp,\n" buf += " .queue_tm_rsp = " + fabric_mod_name + "_queue_tm_rsp,\n"
buf += " .is_state_remove = " + fabric_mod_name + "_is_state_remove,\n" buf += " .aborted_task = " + fabric_mod_name + "_aborted_task,\n"
buf += " /*\n" buf += " /*\n"
buf += " * Setup function pointers for generic logic in target_core_fabric_configfs.c\n" buf += " * Setup function pointers for generic logic in target_core_fabric_configfs.c\n"
buf += " */\n" buf += " */\n"
...@@ -428,7 +425,7 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): ...@@ -428,7 +425,7 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
buf += " /*\n" buf += " /*\n"
buf += " * Register the top level struct config_item_type with TCM core\n" buf += " * Register the top level struct config_item_type with TCM core\n"
buf += " */\n" buf += " */\n"
buf += " fabric = target_fabric_configfs_init(THIS_MODULE, \"" + fabric_mod_name[4:] + "\");\n" buf += " fabric = target_fabric_configfs_init(THIS_MODULE, \"" + fabric_mod_name + "\");\n"
buf += " if (IS_ERR(fabric)) {\n" buf += " if (IS_ERR(fabric)) {\n"
buf += " printk(KERN_ERR \"target_fabric_configfs_init() failed\\n\");\n" buf += " printk(KERN_ERR \"target_fabric_configfs_init() failed\\n\");\n"
buf += " return PTR_ERR(fabric);\n" buf += " return PTR_ERR(fabric);\n"
...@@ -595,7 +592,7 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name): ...@@ -595,7 +592,7 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
if re.search('get_fabric_name', fo): if re.search('get_fabric_name', fo):
buf += "char *" + fabric_mod_name + "_get_fabric_name(void)\n" buf += "char *" + fabric_mod_name + "_get_fabric_name(void)\n"
buf += "{\n" buf += "{\n"
buf += " return \"" + fabric_mod_name[4:] + "\";\n" buf += " return \"" + fabric_mod_name + "\";\n"
buf += "}\n\n" buf += "}\n\n"
bufi += "char *" + fabric_mod_name + "_get_fabric_name(void);\n" bufi += "char *" + fabric_mod_name + "_get_fabric_name(void);\n"
continue continue
...@@ -820,27 +817,6 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name): ...@@ -820,27 +817,6 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
buf += "}\n\n" buf += "}\n\n"
bufi += "void " + fabric_mod_name + "_close_session(struct se_session *);\n" bufi += "void " + fabric_mod_name + "_close_session(struct se_session *);\n"
if re.search('stop_session\)\(', fo):
buf += "void " + fabric_mod_name + "_stop_session(struct se_session *se_sess, int sess_sleep , int conn_sleep)\n"
buf += "{\n"
buf += " return;\n"
buf += "}\n\n"
bufi += "void " + fabric_mod_name + "_stop_session(struct se_session *, int, int);\n"
if re.search('fall_back_to_erl0\)\(', fo):
buf += "void " + fabric_mod_name + "_reset_nexus(struct se_session *se_sess)\n"
buf += "{\n"
buf += " return;\n"
buf += "}\n\n"
bufi += "void " + fabric_mod_name + "_reset_nexus(struct se_session *);\n"
if re.search('sess_logged_in\)\(', fo):
buf += "int " + fabric_mod_name + "_sess_logged_in(struct se_session *se_sess)\n"
buf += "{\n"
buf += " return 0;\n"
buf += "}\n\n"
bufi += "int " + fabric_mod_name + "_sess_logged_in(struct se_session *);\n"
if re.search('sess_get_index\)\(', fo): if re.search('sess_get_index\)\(', fo):
buf += "u32 " + fabric_mod_name + "_sess_get_index(struct se_session *se_sess)\n" buf += "u32 " + fabric_mod_name + "_sess_get_index(struct se_session *se_sess)\n"
buf += "{\n" buf += "{\n"
...@@ -898,19 +874,18 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name): ...@@ -898,19 +874,18 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
bufi += "int " + fabric_mod_name + "_queue_status(struct se_cmd *);\n" bufi += "int " + fabric_mod_name + "_queue_status(struct se_cmd *);\n"
if re.search('queue_tm_rsp\)\(', fo): if re.search('queue_tm_rsp\)\(', fo):
buf += "int " + fabric_mod_name + "_queue_tm_rsp(struct se_cmd *se_cmd)\n" buf += "void " + fabric_mod_name + "_queue_tm_rsp(struct se_cmd *se_cmd)\n"
buf += "{\n" buf += "{\n"
buf += " return 0;\n" buf += " return;\n"
buf += "}\n\n" buf += "}\n\n"
bufi += "int " + fabric_mod_name + "_queue_tm_rsp(struct se_cmd *);\n" bufi += "void " + fabric_mod_name + "_queue_tm_rsp(struct se_cmd *);\n"
if re.search('is_state_remove\)\(', fo): if re.search('aborted_task\)\(', fo):
buf += "int " + fabric_mod_name + "_is_state_remove(struct se_cmd *se_cmd)\n" buf += "void " + fabric_mod_name + "_aborted_task(struct se_cmd *se_cmd)\n"
buf += "{\n" buf += "{\n"
buf += " return 0;\n" buf += " return;\n"
buf += "}\n\n" buf += "}\n\n"
bufi += "int " + fabric_mod_name + "_is_state_remove(struct se_cmd *);\n" bufi += "void " + fabric_mod_name + "_aborted_task(struct se_cmd *);\n"
ret = p.write(buf) ret = p.write(buf)
if ret: if ret:
...@@ -1018,11 +993,11 @@ def main(modname, proto_ident): ...@@ -1018,11 +993,11 @@ def main(modname, proto_ident):
tcm_mod_build_kbuild(fabric_mod_dir, fabric_mod_name) tcm_mod_build_kbuild(fabric_mod_dir, fabric_mod_name)
tcm_mod_build_kconfig(fabric_mod_dir, fabric_mod_name) tcm_mod_build_kconfig(fabric_mod_dir, fabric_mod_name)
input = raw_input("Would you like to add " + fabric_mod_name + "to drivers/target/Makefile..? [yes,no]: ") input = raw_input("Would you like to add " + fabric_mod_name + " to drivers/target/Makefile..? [yes,no]: ")
if input == "yes" or input == "y": if input == "yes" or input == "y":
tcm_mod_add_kbuild(tcm_dir, fabric_mod_name) tcm_mod_add_kbuild(tcm_dir, fabric_mod_name)
input = raw_input("Would you like to add " + fabric_mod_name + "to drivers/target/Kconfig..? [yes,no]: ") input = raw_input("Would you like to add " + fabric_mod_name + " to drivers/target/Kconfig..? [yes,no]: ")
if input == "yes" or input == "y": if input == "yes" or input == "y":
tcm_mod_add_kconfig(tcm_dir, fabric_mod_name) tcm_mod_add_kconfig(tcm_dir, fabric_mod_name)
......
...@@ -5280,6 +5280,15 @@ W: www.open-iscsi.org ...@@ -5280,6 +5280,15 @@ W: www.open-iscsi.org
Q: http://patchwork.kernel.org/project/linux-rdma/list/ Q: http://patchwork.kernel.org/project/linux-rdma/list/
F: drivers/infiniband/ulp/iser/ F: drivers/infiniband/ulp/iser/
ISCSI EXTENSIONS FOR RDMA (ISER) TARGET
M: Sagi Grimberg <sagig@mellanox.com>
T: git git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git master
L: linux-rdma@vger.kernel.org
L: target-devel@vger.kernel.org
S: Supported
W: http://www.linux-iscsi.org
F: drivers/infiniband/ulp/isert
ISDN SUBSYSTEM ISDN SUBSYSTEM
M: Karsten Keil <isdn@linux-pingi.de> M: Karsten Keil <isdn@linux-pingi.de>
L: isdn4linux@listserv.isdn4linux.de (subscribers-only) L: isdn4linux@listserv.isdn4linux.de (subscribers-only)
......
...@@ -2027,10 +2027,10 @@ iscsit_process_text_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, ...@@ -2027,10 +2027,10 @@ iscsit_process_text_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
goto reject; goto reject;
} }
if (!strncmp("=All", text_ptr, 4)) { if (!strncmp("=All", text_ptr, 4)) {
cmd->cmd_flags |= IFC_SENDTARGETS_ALL; cmd->cmd_flags |= ICF_SENDTARGETS_ALL;
} else if (!strncmp("=iqn.", text_ptr, 5) || } else if (!strncmp("=iqn.", text_ptr, 5) ||
!strncmp("=eui.", text_ptr, 5)) { !strncmp("=eui.", text_ptr, 5)) {
cmd->cmd_flags |= IFC_SENDTARGETS_SINGLE; cmd->cmd_flags |= ICF_SENDTARGETS_SINGLE;
} else { } else {
pr_err("Unable to locate valid SendTargets=%s value\n", text_ptr); pr_err("Unable to locate valid SendTargets=%s value\n", text_ptr);
goto reject; goto reject;
...@@ -3415,10 +3415,10 @@ iscsit_build_sendtargets_response(struct iscsi_cmd *cmd, ...@@ -3415,10 +3415,10 @@ iscsit_build_sendtargets_response(struct iscsi_cmd *cmd,
return -ENOMEM; return -ENOMEM;
} }
/* /*
* Locate pointer to iqn./eui. string for IFC_SENDTARGETS_SINGLE * Locate pointer to iqn./eui. string for ICF_SENDTARGETS_SINGLE
* explicit case.. * explicit case..
*/ */
if (cmd->cmd_flags & IFC_SENDTARGETS_SINGLE) { if (cmd->cmd_flags & ICF_SENDTARGETS_SINGLE) {
text_ptr = strchr(text_in, '='); text_ptr = strchr(text_in, '=');
if (!text_ptr) { if (!text_ptr) {
pr_err("Unable to locate '=' string in text_in:" pr_err("Unable to locate '=' string in text_in:"
...@@ -3434,7 +3434,7 @@ iscsit_build_sendtargets_response(struct iscsi_cmd *cmd, ...@@ -3434,7 +3434,7 @@ iscsit_build_sendtargets_response(struct iscsi_cmd *cmd,
spin_lock(&tiqn_lock); spin_lock(&tiqn_lock);
list_for_each_entry(tiqn, &g_tiqn_list, tiqn_list) { list_for_each_entry(tiqn, &g_tiqn_list, tiqn_list) {
if ((cmd->cmd_flags & IFC_SENDTARGETS_SINGLE) && if ((cmd->cmd_flags & ICF_SENDTARGETS_SINGLE) &&
strcmp(tiqn->tiqn, text_ptr)) { strcmp(tiqn->tiqn, text_ptr)) {
continue; continue;
} }
...@@ -3512,7 +3512,7 @@ iscsit_build_sendtargets_response(struct iscsi_cmd *cmd, ...@@ -3512,7 +3512,7 @@ iscsit_build_sendtargets_response(struct iscsi_cmd *cmd,
if (end_of_buf) if (end_of_buf)
break; break;
if (cmd->cmd_flags & IFC_SENDTARGETS_SINGLE) if (cmd->cmd_flags & ICF_SENDTARGETS_SINGLE)
break; break;
} }
spin_unlock(&tiqn_lock); spin_unlock(&tiqn_lock);
......
...@@ -135,8 +135,8 @@ enum cmd_flags_table { ...@@ -135,8 +135,8 @@ enum cmd_flags_table {
ICF_CONTIG_MEMORY = 0x00000020, ICF_CONTIG_MEMORY = 0x00000020,
ICF_ATTACHED_TO_RQUEUE = 0x00000040, ICF_ATTACHED_TO_RQUEUE = 0x00000040,
ICF_OOO_CMDSN = 0x00000080, ICF_OOO_CMDSN = 0x00000080,
IFC_SENDTARGETS_ALL = 0x00000100, ICF_SENDTARGETS_ALL = 0x00000100,
IFC_SENDTARGETS_SINGLE = 0x00000200, ICF_SENDTARGETS_SINGLE = 0x00000200,
}; };
/* struct iscsi_cmd->i_state */ /* struct iscsi_cmd->i_state */
......
...@@ -1103,51 +1103,6 @@ int se_dev_set_queue_depth(struct se_device *dev, u32 queue_depth) ...@@ -1103,51 +1103,6 @@ int se_dev_set_queue_depth(struct se_device *dev, u32 queue_depth)
} }
EXPORT_SYMBOL(se_dev_set_queue_depth); EXPORT_SYMBOL(se_dev_set_queue_depth);
int se_dev_set_fabric_max_sectors(struct se_device *dev, u32 fabric_max_sectors)
{
int block_size = dev->dev_attrib.block_size;
if (dev->export_count) {
pr_err("dev[%p]: Unable to change SE Device"
" fabric_max_sectors while export_count is %d\n",
dev, dev->export_count);
return -EINVAL;
}
if (!fabric_max_sectors) {
pr_err("dev[%p]: Illegal ZERO value for"
" fabric_max_sectors\n", dev);
return -EINVAL;
}
if (fabric_max_sectors < DA_STATUS_MAX_SECTORS_MIN) {
pr_err("dev[%p]: Passed fabric_max_sectors: %u less than"
" DA_STATUS_MAX_SECTORS_MIN: %u\n", dev, fabric_max_sectors,
DA_STATUS_MAX_SECTORS_MIN);
return -EINVAL;
}
if (fabric_max_sectors > DA_STATUS_MAX_SECTORS_MAX) {
pr_err("dev[%p]: Passed fabric_max_sectors: %u"
" greater than DA_STATUS_MAX_SECTORS_MAX:"
" %u\n", dev, fabric_max_sectors,
DA_STATUS_MAX_SECTORS_MAX);
return -EINVAL;
}
/*
* Align max_sectors down to PAGE_SIZE to follow transport_allocate_data_tasks()
*/
if (!block_size) {
block_size = 512;
pr_warn("Defaulting to 512 for zero block_size\n");
}
fabric_max_sectors = se_dev_align_max_sectors(fabric_max_sectors,
block_size);
dev->dev_attrib.fabric_max_sectors = fabric_max_sectors;
pr_debug("dev[%p]: SE Device max_sectors changed to %u\n",
dev, fabric_max_sectors);
return 0;
}
EXPORT_SYMBOL(se_dev_set_fabric_max_sectors);
int se_dev_set_optimal_sectors(struct se_device *dev, u32 optimal_sectors) int se_dev_set_optimal_sectors(struct se_device *dev, u32 optimal_sectors)
{ {
if (dev->export_count) { if (dev->export_count) {
...@@ -1156,10 +1111,10 @@ int se_dev_set_optimal_sectors(struct se_device *dev, u32 optimal_sectors) ...@@ -1156,10 +1111,10 @@ int se_dev_set_optimal_sectors(struct se_device *dev, u32 optimal_sectors)
dev, dev->export_count); dev, dev->export_count);
return -EINVAL; return -EINVAL;
} }
if (optimal_sectors > dev->dev_attrib.fabric_max_sectors) { if (optimal_sectors > dev->dev_attrib.hw_max_sectors) {
pr_err("dev[%p]: Passed optimal_sectors %u cannot be" pr_err("dev[%p]: Passed optimal_sectors %u cannot be"
" greater than fabric_max_sectors: %u\n", dev, " greater than hw_max_sectors: %u\n", dev,
optimal_sectors, dev->dev_attrib.fabric_max_sectors); optimal_sectors, dev->dev_attrib.hw_max_sectors);
return -EINVAL; return -EINVAL;
} }
...@@ -1553,8 +1508,6 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name) ...@@ -1553,8 +1508,6 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name)
dev->dev_attrib.unmap_granularity_alignment = dev->dev_attrib.unmap_granularity_alignment =
DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT; DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT;
dev->dev_attrib.max_write_same_len = DA_MAX_WRITE_SAME_LEN; dev->dev_attrib.max_write_same_len = DA_MAX_WRITE_SAME_LEN;
dev->dev_attrib.fabric_max_sectors = DA_FABRIC_MAX_SECTORS;
dev->dev_attrib.optimal_sectors = DA_FABRIC_MAX_SECTORS;
xcopy_lun = &dev->xcopy_lun; xcopy_lun = &dev->xcopy_lun;
xcopy_lun->lun_se_dev = dev; xcopy_lun->lun_se_dev = dev;
...@@ -1595,6 +1548,7 @@ int target_configure_device(struct se_device *dev) ...@@ -1595,6 +1548,7 @@ int target_configure_device(struct se_device *dev)
dev->dev_attrib.hw_max_sectors = dev->dev_attrib.hw_max_sectors =
se_dev_align_max_sectors(dev->dev_attrib.hw_max_sectors, se_dev_align_max_sectors(dev->dev_attrib.hw_max_sectors,
dev->dev_attrib.hw_block_size); dev->dev_attrib.hw_block_size);
dev->dev_attrib.optimal_sectors = dev->dev_attrib.hw_max_sectors;
dev->dev_index = scsi_get_new_index(SCSI_DEVICE_INDEX); dev->dev_index = scsi_get_new_index(SCSI_DEVICE_INDEX);
dev->creation_time = get_jiffies_64(); dev->creation_time = get_jiffies_64();
......
...@@ -621,7 +621,16 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, ...@@ -621,7 +621,16 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
struct fd_prot fd_prot; struct fd_prot fd_prot;
sense_reason_t rc; sense_reason_t rc;
int ret = 0; int ret = 0;
/*
* We are currently limited by the number of iovecs (2048) per
* single vfs_[writev,readv] call.
*/
if (cmd->data_length > FD_MAX_BYTES) {
pr_err("FILEIO: Not able to process I/O of %u bytes due to"
"FD_MAX_BYTES: %u iovec count limitiation\n",
cmd->data_length, FD_MAX_BYTES);
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
}
/* /*
* Call vectorized fileio functions to map struct scatterlist * Call vectorized fileio functions to map struct scatterlist
* physical memory addresses to struct iovec virtual memory. * physical memory addresses to struct iovec virtual memory.
...@@ -959,7 +968,6 @@ static struct configfs_attribute *fileio_backend_dev_attrs[] = { ...@@ -959,7 +968,6 @@ static struct configfs_attribute *fileio_backend_dev_attrs[] = {
&fileio_dev_attrib_hw_block_size.attr, &fileio_dev_attrib_hw_block_size.attr,
&fileio_dev_attrib_block_size.attr, &fileio_dev_attrib_block_size.attr,
&fileio_dev_attrib_hw_max_sectors.attr, &fileio_dev_attrib_hw_max_sectors.attr,
&fileio_dev_attrib_fabric_max_sectors.attr,
&fileio_dev_attrib_optimal_sectors.attr, &fileio_dev_attrib_optimal_sectors.attr,
&fileio_dev_attrib_hw_queue_depth.attr, &fileio_dev_attrib_hw_queue_depth.attr,
&fileio_dev_attrib_queue_depth.attr, &fileio_dev_attrib_queue_depth.attr,
......
...@@ -124,7 +124,7 @@ static int iblock_configure_device(struct se_device *dev) ...@@ -124,7 +124,7 @@ static int iblock_configure_device(struct se_device *dev)
q = bdev_get_queue(bd); q = bdev_get_queue(bd);
dev->dev_attrib.hw_block_size = bdev_logical_block_size(bd); dev->dev_attrib.hw_block_size = bdev_logical_block_size(bd);
dev->dev_attrib.hw_max_sectors = UINT_MAX; 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;
/* /*
...@@ -883,7 +883,6 @@ static struct configfs_attribute *iblock_backend_dev_attrs[] = { ...@@ -883,7 +883,6 @@ static struct configfs_attribute *iblock_backend_dev_attrs[] = {
&iblock_dev_attrib_hw_block_size.attr, &iblock_dev_attrib_hw_block_size.attr,
&iblock_dev_attrib_block_size.attr, &iblock_dev_attrib_block_size.attr,
&iblock_dev_attrib_hw_max_sectors.attr, &iblock_dev_attrib_hw_max_sectors.attr,
&iblock_dev_attrib_fabric_max_sectors.attr,
&iblock_dev_attrib_optimal_sectors.attr, &iblock_dev_attrib_optimal_sectors.attr,
&iblock_dev_attrib_hw_queue_depth.attr, &iblock_dev_attrib_hw_queue_depth.attr,
&iblock_dev_attrib_queue_depth.attr, &iblock_dev_attrib_queue_depth.attr,
......
...@@ -526,6 +526,18 @@ static int core_scsi3_pr_seq_non_holder( ...@@ -526,6 +526,18 @@ static int core_scsi3_pr_seq_non_holder(
" reservation\n", cdb[0], " reservation\n", cdb[0],
core_scsi3_pr_dump_type(pr_reg_type)); core_scsi3_pr_dump_type(pr_reg_type));
return 0;
}
} else if (we && registered_nexus) {
/*
* Reads are allowed for Write Exclusive locks
* from all registrants.
*/
if (cmd->data_direction == DMA_FROM_DEVICE) {
pr_debug("Allowing READ CDB: 0x%02x for %s"
" reservation\n", cdb[0],
core_scsi3_pr_dump_type(pr_reg_type));
return 0; return 0;
} }
} }
......
...@@ -657,7 +657,6 @@ static struct configfs_attribute *rd_mcp_backend_dev_attrs[] = { ...@@ -657,7 +657,6 @@ static struct configfs_attribute *rd_mcp_backend_dev_attrs[] = {
&rd_mcp_dev_attrib_hw_block_size.attr, &rd_mcp_dev_attrib_hw_block_size.attr,
&rd_mcp_dev_attrib_block_size.attr, &rd_mcp_dev_attrib_block_size.attr,
&rd_mcp_dev_attrib_hw_max_sectors.attr, &rd_mcp_dev_attrib_hw_max_sectors.attr,
&rd_mcp_dev_attrib_fabric_max_sectors.attr,
&rd_mcp_dev_attrib_optimal_sectors.attr, &rd_mcp_dev_attrib_optimal_sectors.attr,
&rd_mcp_dev_attrib_hw_queue_depth.attr, &rd_mcp_dev_attrib_hw_queue_depth.attr,
&rd_mcp_dev_attrib_queue_depth.attr, &rd_mcp_dev_attrib_queue_depth.attr,
......
...@@ -953,21 +953,6 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) ...@@ -953,21 +953,6 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
if (cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) { if (cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) {
unsigned long long end_lba; unsigned long long end_lba;
if (sectors > dev->dev_attrib.fabric_max_sectors) {
printk_ratelimited(KERN_ERR "SCSI OP %02xh with too"
" big sectors %u exceeds fabric_max_sectors:"
" %u\n", cdb[0], sectors,
dev->dev_attrib.fabric_max_sectors);
return TCM_INVALID_CDB_FIELD;
}
if (sectors > dev->dev_attrib.hw_max_sectors) {
printk_ratelimited(KERN_ERR "SCSI OP %02xh with too"
" big sectors %u exceeds backend hw_max_sectors:"
" %u\n", cdb[0], sectors,
dev->dev_attrib.hw_max_sectors);
return TCM_INVALID_CDB_FIELD;
}
check_lba: check_lba:
end_lba = dev->transport->get_blocks(dev) + 1; end_lba = dev->transport->get_blocks(dev) + 1;
if (cmd->t_task_lba + sectors > end_lba) { if (cmd->t_task_lba + sectors > end_lba) {
......
...@@ -505,7 +505,6 @@ static sense_reason_t ...@@ -505,7 +505,6 @@ static sense_reason_t
spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf) spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf)
{ {
struct se_device *dev = cmd->se_dev; struct se_device *dev = cmd->se_dev;
u32 max_sectors;
int have_tp = 0; int have_tp = 0;
int opt, min; int opt, min;
...@@ -539,9 +538,7 @@ spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf) ...@@ -539,9 +538,7 @@ spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf)
/* /*
* Set MAXIMUM TRANSFER LENGTH * Set MAXIMUM TRANSFER LENGTH
*/ */
max_sectors = min(dev->dev_attrib.fabric_max_sectors, put_unaligned_be32(dev->dev_attrib.hw_max_sectors, &buf[8]);
dev->dev_attrib.hw_max_sectors);
put_unaligned_be32(max_sectors, &buf[8]);
/* /*
* Set OPTIMAL TRANSFER LENGTH * Set OPTIMAL TRANSFER LENGTH
......
...@@ -1118,7 +1118,6 @@ static struct configfs_attribute *tcmu_backend_dev_attrs[] = { ...@@ -1118,7 +1118,6 @@ static struct configfs_attribute *tcmu_backend_dev_attrs[] = {
&tcmu_dev_attrib_hw_block_size.attr, &tcmu_dev_attrib_hw_block_size.attr,
&tcmu_dev_attrib_block_size.attr, &tcmu_dev_attrib_block_size.attr,
&tcmu_dev_attrib_hw_max_sectors.attr, &tcmu_dev_attrib_hw_max_sectors.attr,
&tcmu_dev_attrib_fabric_max_sectors.attr,
&tcmu_dev_attrib_optimal_sectors.attr, &tcmu_dev_attrib_optimal_sectors.attr,
&tcmu_dev_attrib_hw_queue_depth.attr, &tcmu_dev_attrib_hw_queue_depth.attr,
&tcmu_dev_attrib_queue_depth.attr, &tcmu_dev_attrib_queue_depth.attr,
......
...@@ -911,6 +911,23 @@ vhost_scsi_map_iov_to_prot(struct tcm_vhost_cmd *cmd, ...@@ -911,6 +911,23 @@ vhost_scsi_map_iov_to_prot(struct tcm_vhost_cmd *cmd,
return 0; return 0;
} }
static int vhost_scsi_to_tcm_attr(int attr)
{
switch (attr) {
case VIRTIO_SCSI_S_SIMPLE:
return TCM_SIMPLE_TAG;
case VIRTIO_SCSI_S_ORDERED:
return TCM_ORDERED_TAG;
case VIRTIO_SCSI_S_HEAD:
return TCM_HEAD_TAG;
case VIRTIO_SCSI_S_ACA:
return TCM_ACA_TAG;
default:
break;
}
return TCM_SIMPLE_TAG;
}
static void tcm_vhost_submission_work(struct work_struct *work) static void tcm_vhost_submission_work(struct work_struct *work)
{ {
struct tcm_vhost_cmd *cmd = struct tcm_vhost_cmd *cmd =
...@@ -936,9 +953,10 @@ static void tcm_vhost_submission_work(struct work_struct *work) ...@@ -936,9 +953,10 @@ static void tcm_vhost_submission_work(struct work_struct *work)
rc = target_submit_cmd_map_sgls(se_cmd, tv_nexus->tvn_se_sess, rc = target_submit_cmd_map_sgls(se_cmd, tv_nexus->tvn_se_sess,
cmd->tvc_cdb, &cmd->tvc_sense_buf[0], cmd->tvc_cdb, &cmd->tvc_sense_buf[0],
cmd->tvc_lun, cmd->tvc_exp_data_len, cmd->tvc_lun, cmd->tvc_exp_data_len,
cmd->tvc_task_attr, cmd->tvc_data_direction, vhost_scsi_to_tcm_attr(cmd->tvc_task_attr),
TARGET_SCF_ACK_KREF, sg_ptr, cmd->tvc_sgl_count, cmd->tvc_data_direction, TARGET_SCF_ACK_KREF,
NULL, 0, sg_prot_ptr, cmd->tvc_prot_sgl_count); sg_ptr, cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr,
cmd->tvc_prot_sgl_count);
if (rc < 0) { if (rc < 0) {
transport_send_check_condition_and_sense(se_cmd, transport_send_check_condition_and_sense(se_cmd,
TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0);
......
...@@ -135,7 +135,6 @@ int se_dev_set_is_nonrot(struct se_device *, int); ...@@ -135,7 +135,6 @@ int se_dev_set_is_nonrot(struct se_device *, int);
int se_dev_set_emulate_rest_reord(struct se_device *dev, int); int se_dev_set_emulate_rest_reord(struct se_device *dev, int);
int se_dev_set_queue_depth(struct se_device *, u32); int se_dev_set_queue_depth(struct se_device *, u32);
int se_dev_set_max_sectors(struct se_device *, u32); int se_dev_set_max_sectors(struct se_device *, u32);
int se_dev_set_fabric_max_sectors(struct se_device *, u32);
int se_dev_set_optimal_sectors(struct se_device *, u32); int se_dev_set_optimal_sectors(struct se_device *, u32);
int se_dev_set_block_size(struct se_device *, u32); int se_dev_set_block_size(struct se_device *, u32);
......
...@@ -98,8 +98,6 @@ static struct target_backend_dev_attrib_attribute _backend##_dev_attrib_##_name ...@@ -98,8 +98,6 @@ static struct target_backend_dev_attrib_attribute _backend##_dev_attrib_##_name
TB_DEV_ATTR(_backend, block_size, S_IRUGO | S_IWUSR); \ TB_DEV_ATTR(_backend, block_size, S_IRUGO | S_IWUSR); \
DEF_TB_DEV_ATTRIB_RO(_backend, hw_max_sectors); \ DEF_TB_DEV_ATTRIB_RO(_backend, hw_max_sectors); \
TB_DEV_ATTR_RO(_backend, hw_max_sectors); \ TB_DEV_ATTR_RO(_backend, hw_max_sectors); \
DEF_TB_DEV_ATTRIB(_backend, fabric_max_sectors); \
TB_DEV_ATTR(_backend, fabric_max_sectors, S_IRUGO | S_IWUSR); \
DEF_TB_DEV_ATTRIB(_backend, optimal_sectors); \ DEF_TB_DEV_ATTRIB(_backend, optimal_sectors); \
TB_DEV_ATTR(_backend, optimal_sectors, S_IRUGO | S_IWUSR); \ TB_DEV_ATTR(_backend, optimal_sectors, S_IRUGO | S_IWUSR); \
DEF_TB_DEV_ATTRIB_RO(_backend, hw_queue_depth); \ DEF_TB_DEV_ATTRIB_RO(_backend, hw_queue_depth); \
......
...@@ -77,8 +77,6 @@ ...@@ -77,8 +77,6 @@
#define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0 #define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0
/* Default max_write_same_len, disabled by default */ /* Default max_write_same_len, disabled by default */
#define DA_MAX_WRITE_SAME_LEN 0 #define DA_MAX_WRITE_SAME_LEN 0
/* Default max transfer length */
#define DA_FABRIC_MAX_SECTORS 8192
/* Use a model alias based on the configfs backend device name */ /* Use a model alias based on the configfs backend device name */
#define DA_EMULATE_MODEL_ALIAS 0 #define DA_EMULATE_MODEL_ALIAS 0
/* Emulation for Direct Page Out */ /* Emulation for Direct Page Out */
...@@ -694,7 +692,6 @@ struct se_dev_attrib { ...@@ -694,7 +692,6 @@ struct se_dev_attrib {
u32 hw_block_size; u32 hw_block_size;
u32 block_size; u32 block_size;
u32 hw_max_sectors; u32 hw_max_sectors;
u32 fabric_max_sectors;
u32 optimal_sectors; u32 optimal_sectors;
u32 hw_queue_depth; u32 hw_queue_depth;
u32 queue_depth; u32 queue_depth;
......
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