diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-05-31 14:31:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-05-31 14:31:42 -0400 |
commit | dae8f283bf30738593f6d2a4623945c5e6d7794e (patch) | |
tree | f4ef01f19ff8cbdae0eaac61f12236ed5e9f297d | |
parent | 30a5f11896a26a345e934e18e9a62c714bc1ceed (diff) | |
parent | b2feda4feb1b0ea74c0916b4a35b038bbfef9c82 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
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
24 files changed, 180 insertions, 287 deletions
diff --git a/Documentation/target/tcmu-design.txt b/Documentation/target/tcmu-design.txt index 43e94ea6d2ca..263b907517ac 100644 --- a/Documentation/target/tcmu-design.txt +++ b/Documentation/target/tcmu-design.txt | |||
@@ -15,8 +15,7 @@ Contents: | |||
15 | a) Discovering and configuring TCMU uio devices | 15 | a) Discovering and configuring TCMU uio devices |
16 | b) Waiting for events on the device(s) | 16 | b) Waiting for events on the device(s) |
17 | c) Managing the command ring | 17 | c) Managing the command ring |
18 | 3) Command filtering and pass_level | 18 | 3) A final note |
19 | 4) A final note | ||
20 | 19 | ||
21 | 20 | ||
22 | TCM Userspace Design | 21 | TCM Userspace Design |
@@ -324,7 +323,7 @@ int handle_device_events(int fd, void *map) | |||
324 | /* Process events from cmd ring until we catch up with cmd_head */ | 323 | /* Process events from cmd ring until we catch up with cmd_head */ |
325 | while (ent != (void *)mb + mb->cmdr_off + mb->cmd_head) { | 324 | while (ent != (void *)mb + mb->cmdr_off + mb->cmd_head) { |
326 | 325 | ||
327 | if (tcmu_hdr_get_op(&ent->hdr) == TCMU_OP_CMD) { | 326 | if (tcmu_hdr_get_op(ent->hdr.len_op) == TCMU_OP_CMD) { |
328 | uint8_t *cdb = (void *)mb + ent->req.cdb_off; | 327 | uint8_t *cdb = (void *)mb + ent->req.cdb_off; |
329 | bool success = true; | 328 | bool success = true; |
330 | 329 | ||
@@ -339,8 +338,12 @@ int handle_device_events(int fd, void *map) | |||
339 | ent->rsp.scsi_status = SCSI_CHECK_CONDITION; | 338 | ent->rsp.scsi_status = SCSI_CHECK_CONDITION; |
340 | } | 339 | } |
341 | } | 340 | } |
341 | else if (tcmu_hdr_get_op(ent->hdr.len_op) != TCMU_OP_PAD) { | ||
342 | /* Tell the kernel we didn't handle unknown opcodes */ | ||
343 | ent->hdr.uflags |= TCMU_UFLAG_UNKNOWN_OP; | ||
344 | } | ||
342 | else { | 345 | else { |
343 | /* Do nothing for PAD entries */ | 346 | /* Do nothing for PAD entries except update cmd_tail */ |
344 | } | 347 | } |
345 | 348 | ||
346 | /* update cmd_tail */ | 349 | /* update cmd_tail */ |
@@ -360,28 +363,6 @@ int handle_device_events(int fd, void *map) | |||
360 | } | 363 | } |
361 | 364 | ||
362 | 365 | ||
363 | Command filtering and pass_level | ||
364 | -------------------------------- | ||
365 | |||
366 | TCMU supports a "pass_level" option with valid values of 0 or 1. When | ||
367 | the value is 0 (the default), nearly all SCSI commands received for | ||
368 | the device are passed through to the handler. This allows maximum | ||
369 | flexibility but increases the amount of code required by the handler, | ||
370 | to support all mandatory SCSI commands. If pass_level is set to 1, | ||
371 | then only IO-related commands are presented, and the rest are handled | ||
372 | by LIO's in-kernel command emulation. The commands presented at level | ||
373 | 1 include all versions of: | ||
374 | |||
375 | READ | ||
376 | WRITE | ||
377 | WRITE_VERIFY | ||
378 | XDWRITEREAD | ||
379 | WRITE_SAME | ||
380 | COMPARE_AND_WRITE | ||
381 | SYNCHRONIZE_CACHE | ||
382 | UNMAP | ||
383 | |||
384 | |||
385 | A final note | 366 | A final note |
386 | ------------ | 367 | ------------ |
387 | 368 | ||
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 327529ee85eb..3f40319a55da 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
@@ -547,11 +547,11 @@ isert_create_pi_ctx(struct fast_reg_descriptor *desc, | |||
547 | return 0; | 547 | return 0; |
548 | 548 | ||
549 | err_prot_mr: | 549 | err_prot_mr: |
550 | ib_dereg_mr(desc->pi_ctx->prot_mr); | 550 | ib_dereg_mr(pi_ctx->prot_mr); |
551 | err_prot_frpl: | 551 | err_prot_frpl: |
552 | ib_free_fast_reg_page_list(desc->pi_ctx->prot_frpl); | 552 | ib_free_fast_reg_page_list(pi_ctx->prot_frpl); |
553 | err_pi_ctx: | 553 | err_pi_ctx: |
554 | kfree(desc->pi_ctx); | 554 | kfree(pi_ctx); |
555 | 555 | ||
556 | return ret; | 556 | return ret; |
557 | } | 557 | } |
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 68c2002e78bf..5c9e680aa375 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c | |||
@@ -1020,8 +1020,7 @@ static void tcm_qla2xxx_depend_tpg(struct work_struct *work) | |||
1020 | struct se_portal_group *se_tpg = &base_tpg->se_tpg; | 1020 | struct se_portal_group *se_tpg = &base_tpg->se_tpg; |
1021 | struct scsi_qla_host *base_vha = base_tpg->lport->qla_vha; | 1021 | struct scsi_qla_host *base_vha = base_tpg->lport->qla_vha; |
1022 | 1022 | ||
1023 | if (!configfs_depend_item(se_tpg->se_tpg_tfo->tf_subsys, | 1023 | if (!target_depend_item(&se_tpg->tpg_group.cg_item)) { |
1024 | &se_tpg->tpg_group.cg_item)) { | ||
1025 | atomic_set(&base_tpg->lport_tpg_enabled, 1); | 1024 | atomic_set(&base_tpg->lport_tpg_enabled, 1); |
1026 | qlt_enable_vha(base_vha); | 1025 | qlt_enable_vha(base_vha); |
1027 | } | 1026 | } |
@@ -1037,8 +1036,7 @@ static void tcm_qla2xxx_undepend_tpg(struct work_struct *work) | |||
1037 | 1036 | ||
1038 | if (!qlt_stop_phase1(base_vha->vha_tgt.qla_tgt)) { | 1037 | if (!qlt_stop_phase1(base_vha->vha_tgt.qla_tgt)) { |
1039 | atomic_set(&base_tpg->lport_tpg_enabled, 0); | 1038 | atomic_set(&base_tpg->lport_tpg_enabled, 0); |
1040 | configfs_undepend_item(se_tpg->se_tpg_tfo->tf_subsys, | 1039 | target_undepend_item(&se_tpg->tpg_group.cg_item); |
1041 | &se_tpg->tpg_group.cg_item); | ||
1042 | } | 1040 | } |
1043 | complete(&base_tpg->tpg_base_comp); | 1041 | complete(&base_tpg->tpg_base_comp); |
1044 | } | 1042 | } |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 34871a628b11..74e6114ff18f 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -230,7 +230,7 @@ int iscsit_access_np(struct iscsi_np *np, struct iscsi_portal_group *tpg) | |||
230 | * Here we serialize access across the TIQN+TPG Tuple. | 230 | * Here we serialize access across the TIQN+TPG Tuple. |
231 | */ | 231 | */ |
232 | ret = down_interruptible(&tpg->np_login_sem); | 232 | ret = down_interruptible(&tpg->np_login_sem); |
233 | if ((ret != 0) || signal_pending(current)) | 233 | if (ret != 0) |
234 | return -1; | 234 | return -1; |
235 | 235 | ||
236 | spin_lock_bh(&tpg->tpg_state_lock); | 236 | spin_lock_bh(&tpg->tpg_state_lock); |
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index 8ce94ff744e6..70d799dfab03 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
@@ -346,6 +346,7 @@ static int iscsi_login_zero_tsih_s1( | |||
346 | if (IS_ERR(sess->se_sess)) { | 346 | if (IS_ERR(sess->se_sess)) { |
347 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | 347 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, |
348 | ISCSI_LOGIN_STATUS_NO_RESOURCES); | 348 | ISCSI_LOGIN_STATUS_NO_RESOURCES); |
349 | kfree(sess->sess_ops); | ||
349 | kfree(sess); | 350 | kfree(sess); |
350 | return -ENOMEM; | 351 | return -ENOMEM; |
351 | } | 352 | } |
diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c index e8a240818353..5e3295fe404d 100644 --- a/drivers/target/iscsi/iscsi_target_tpg.c +++ b/drivers/target/iscsi/iscsi_target_tpg.c | |||
@@ -161,10 +161,7 @@ struct iscsi_portal_group *iscsit_get_tpg_from_np( | |||
161 | int iscsit_get_tpg( | 161 | int iscsit_get_tpg( |
162 | struct iscsi_portal_group *tpg) | 162 | struct iscsi_portal_group *tpg) |
163 | { | 163 | { |
164 | int ret; | 164 | return mutex_lock_interruptible(&tpg->tpg_access_lock); |
165 | |||
166 | ret = mutex_lock_interruptible(&tpg->tpg_access_lock); | ||
167 | return ((ret != 0) || signal_pending(current)) ? -1 : 0; | ||
168 | } | 165 | } |
169 | 166 | ||
170 | void iscsit_put_tpg(struct iscsi_portal_group *tpg) | 167 | void iscsit_put_tpg(struct iscsi_portal_group *tpg) |
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c index 75cbde1f7c5b..4f8d4d459aa4 100644 --- a/drivers/target/target_core_alua.c +++ b/drivers/target/target_core_alua.c | |||
@@ -704,7 +704,7 @@ target_alua_state_check(struct se_cmd *cmd) | |||
704 | 704 | ||
705 | if (dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE) | 705 | if (dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE) |
706 | return 0; | 706 | return 0; |
707 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 707 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
708 | return 0; | 708 | return 0; |
709 | 709 | ||
710 | if (!port) | 710 | if (!port) |
@@ -2377,7 +2377,7 @@ ssize_t core_alua_store_secondary_write_metadata( | |||
2377 | 2377 | ||
2378 | int core_setup_alua(struct se_device *dev) | 2378 | int core_setup_alua(struct se_device *dev) |
2379 | { | 2379 | { |
2380 | if (dev->transport->transport_type != TRANSPORT_PLUGIN_PHBA_PDEV && | 2380 | if (!(dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) && |
2381 | !(dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE)) { | 2381 | !(dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE)) { |
2382 | struct t10_alua_lu_gp_member *lu_gp_mem; | 2382 | struct t10_alua_lu_gp_member *lu_gp_mem; |
2383 | 2383 | ||
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index ddaf76a4ac2a..e7b0430a0575 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -212,10 +212,6 @@ static struct config_group *target_core_register_fabric( | |||
212 | 212 | ||
213 | pr_debug("Target_Core_ConfigFS: REGISTER -> Allocated Fabric:" | 213 | pr_debug("Target_Core_ConfigFS: REGISTER -> Allocated Fabric:" |
214 | " %s\n", tf->tf_group.cg_item.ci_name); | 214 | " %s\n", tf->tf_group.cg_item.ci_name); |
215 | /* | ||
216 | * Setup tf_ops.tf_subsys pointer for usage with configfs_depend_item() | ||
217 | */ | ||
218 | tf->tf_ops.tf_subsys = tf->tf_subsys; | ||
219 | tf->tf_fabric = &tf->tf_group.cg_item; | 215 | tf->tf_fabric = &tf->tf_group.cg_item; |
220 | pr_debug("Target_Core_ConfigFS: REGISTER -> Set tf->tf_fabric" | 216 | pr_debug("Target_Core_ConfigFS: REGISTER -> Set tf->tf_fabric" |
221 | " for %s\n", name); | 217 | " for %s\n", name); |
@@ -291,10 +287,17 @@ static struct configfs_subsystem target_core_fabrics = { | |||
291 | }, | 287 | }, |
292 | }; | 288 | }; |
293 | 289 | ||
294 | struct configfs_subsystem *target_core_subsystem[] = { | 290 | int target_depend_item(struct config_item *item) |
295 | &target_core_fabrics, | 291 | { |
296 | NULL, | 292 | return configfs_depend_item(&target_core_fabrics, item); |
297 | }; | 293 | } |
294 | EXPORT_SYMBOL(target_depend_item); | ||
295 | |||
296 | void target_undepend_item(struct config_item *item) | ||
297 | { | ||
298 | return configfs_undepend_item(&target_core_fabrics, item); | ||
299 | } | ||
300 | EXPORT_SYMBOL(target_undepend_item); | ||
298 | 301 | ||
299 | /*############################################################################## | 302 | /*############################################################################## |
300 | // Start functions called by external Target Fabrics Modules | 303 | // Start functions called by external Target Fabrics Modules |
@@ -467,7 +470,6 @@ int target_register_template(const struct target_core_fabric_ops *fo) | |||
467 | * struct target_fabric_configfs->tf_cit_tmpl | 470 | * struct target_fabric_configfs->tf_cit_tmpl |
468 | */ | 471 | */ |
469 | tf->tf_module = fo->module; | 472 | tf->tf_module = fo->module; |
470 | tf->tf_subsys = target_core_subsystem[0]; | ||
471 | snprintf(tf->tf_name, TARGET_FABRIC_NAME_SIZE, "%s", fo->name); | 473 | snprintf(tf->tf_name, TARGET_FABRIC_NAME_SIZE, "%s", fo->name); |
472 | 474 | ||
473 | tf->tf_ops = *fo; | 475 | tf->tf_ops = *fo; |
@@ -809,7 +811,7 @@ static ssize_t target_core_dev_pr_show_attr_res_holder(struct se_device *dev, | |||
809 | { | 811 | { |
810 | int ret; | 812 | int ret; |
811 | 813 | ||
812 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 814 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
813 | return sprintf(page, "Passthrough\n"); | 815 | return sprintf(page, "Passthrough\n"); |
814 | 816 | ||
815 | spin_lock(&dev->dev_reservation_lock); | 817 | spin_lock(&dev->dev_reservation_lock); |
@@ -960,7 +962,7 @@ SE_DEV_PR_ATTR_RO(res_pr_type); | |||
960 | static ssize_t target_core_dev_pr_show_attr_res_type( | 962 | static ssize_t target_core_dev_pr_show_attr_res_type( |
961 | struct se_device *dev, char *page) | 963 | struct se_device *dev, char *page) |
962 | { | 964 | { |
963 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 965 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
964 | return sprintf(page, "SPC_PASSTHROUGH\n"); | 966 | return sprintf(page, "SPC_PASSTHROUGH\n"); |
965 | else if (dev->dev_reservation_flags & DRF_SPC2_RESERVATIONS) | 967 | else if (dev->dev_reservation_flags & DRF_SPC2_RESERVATIONS) |
966 | return sprintf(page, "SPC2_RESERVATIONS\n"); | 968 | return sprintf(page, "SPC2_RESERVATIONS\n"); |
@@ -973,7 +975,7 @@ SE_DEV_PR_ATTR_RO(res_type); | |||
973 | static ssize_t target_core_dev_pr_show_attr_res_aptpl_active( | 975 | static ssize_t target_core_dev_pr_show_attr_res_aptpl_active( |
974 | struct se_device *dev, char *page) | 976 | struct se_device *dev, char *page) |
975 | { | 977 | { |
976 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 978 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
977 | return 0; | 979 | return 0; |
978 | 980 | ||
979 | return sprintf(page, "APTPL Bit Status: %s\n", | 981 | return sprintf(page, "APTPL Bit Status: %s\n", |
@@ -988,7 +990,7 @@ SE_DEV_PR_ATTR_RO(res_aptpl_active); | |||
988 | static ssize_t target_core_dev_pr_show_attr_res_aptpl_metadata( | 990 | static ssize_t target_core_dev_pr_show_attr_res_aptpl_metadata( |
989 | struct se_device *dev, char *page) | 991 | struct se_device *dev, char *page) |
990 | { | 992 | { |
991 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 993 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
992 | return 0; | 994 | return 0; |
993 | 995 | ||
994 | return sprintf(page, "Ready to process PR APTPL metadata..\n"); | 996 | return sprintf(page, "Ready to process PR APTPL metadata..\n"); |
@@ -1035,7 +1037,7 @@ static ssize_t target_core_dev_pr_store_attr_res_aptpl_metadata( | |||
1035 | u16 port_rpti = 0, tpgt = 0; | 1037 | u16 port_rpti = 0, tpgt = 0; |
1036 | u8 type = 0, scope; | 1038 | u8 type = 0, scope; |
1037 | 1039 | ||
1038 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 1040 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
1039 | return 0; | 1041 | return 0; |
1040 | if (dev->dev_reservation_flags & DRF_SPC2_RESERVATIONS) | 1042 | if (dev->dev_reservation_flags & DRF_SPC2_RESERVATIONS) |
1041 | return 0; | 1043 | return 0; |
@@ -2870,7 +2872,7 @@ static int __init target_core_init_configfs(void) | |||
2870 | { | 2872 | { |
2871 | struct config_group *target_cg, *hba_cg = NULL, *alua_cg = NULL; | 2873 | struct config_group *target_cg, *hba_cg = NULL, *alua_cg = NULL; |
2872 | struct config_group *lu_gp_cg = NULL; | 2874 | struct config_group *lu_gp_cg = NULL; |
2873 | struct configfs_subsystem *subsys; | 2875 | struct configfs_subsystem *subsys = &target_core_fabrics; |
2874 | struct t10_alua_lu_gp *lu_gp; | 2876 | struct t10_alua_lu_gp *lu_gp; |
2875 | int ret; | 2877 | int ret; |
2876 | 2878 | ||
@@ -2878,7 +2880,6 @@ static int __init target_core_init_configfs(void) | |||
2878 | " Engine: %s on %s/%s on "UTS_RELEASE"\n", | 2880 | " Engine: %s on %s/%s on "UTS_RELEASE"\n", |
2879 | TARGET_CORE_VERSION, utsname()->sysname, utsname()->machine); | 2881 | TARGET_CORE_VERSION, utsname()->sysname, utsname()->machine); |
2880 | 2882 | ||
2881 | subsys = target_core_subsystem[0]; | ||
2882 | config_group_init(&subsys->su_group); | 2883 | config_group_init(&subsys->su_group); |
2883 | mutex_init(&subsys->su_mutex); | 2884 | mutex_init(&subsys->su_mutex); |
2884 | 2885 | ||
@@ -3008,13 +3009,10 @@ out_global: | |||
3008 | 3009 | ||
3009 | static void __exit target_core_exit_configfs(void) | 3010 | static void __exit target_core_exit_configfs(void) |
3010 | { | 3011 | { |
3011 | struct configfs_subsystem *subsys; | ||
3012 | struct config_group *hba_cg, *alua_cg, *lu_gp_cg; | 3012 | struct config_group *hba_cg, *alua_cg, *lu_gp_cg; |
3013 | struct config_item *item; | 3013 | struct config_item *item; |
3014 | int i; | 3014 | int i; |
3015 | 3015 | ||
3016 | subsys = target_core_subsystem[0]; | ||
3017 | |||
3018 | lu_gp_cg = &alua_lu_gps_group; | 3016 | lu_gp_cg = &alua_lu_gps_group; |
3019 | for (i = 0; lu_gp_cg->default_groups[i]; i++) { | 3017 | for (i = 0; lu_gp_cg->default_groups[i]; i++) { |
3020 | item = &lu_gp_cg->default_groups[i]->cg_item; | 3018 | item = &lu_gp_cg->default_groups[i]->cg_item; |
@@ -3045,8 +3043,8 @@ static void __exit target_core_exit_configfs(void) | |||
3045 | * We expect subsys->su_group.default_groups to be released | 3043 | * We expect subsys->su_group.default_groups to be released |
3046 | * by configfs subsystem provider logic.. | 3044 | * by configfs subsystem provider logic.. |
3047 | */ | 3045 | */ |
3048 | configfs_unregister_subsystem(subsys); | 3046 | configfs_unregister_subsystem(&target_core_fabrics); |
3049 | kfree(subsys->su_group.default_groups); | 3047 | kfree(target_core_fabrics.su_group.default_groups); |
3050 | 3048 | ||
3051 | core_alua_free_lu_gp(default_lu_gp); | 3049 | core_alua_free_lu_gp(default_lu_gp); |
3052 | default_lu_gp = NULL; | 3050 | default_lu_gp = NULL; |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 7faa6aef9a4d..ce5f768181ff 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/kthread.h> | 33 | #include <linux/kthread.h> |
34 | #include <linux/in.h> | 34 | #include <linux/in.h> |
35 | #include <linux/export.h> | 35 | #include <linux/export.h> |
36 | #include <asm/unaligned.h> | ||
36 | #include <net/sock.h> | 37 | #include <net/sock.h> |
37 | #include <net/tcp.h> | 38 | #include <net/tcp.h> |
38 | #include <scsi/scsi.h> | 39 | #include <scsi/scsi.h> |
@@ -527,7 +528,7 @@ static void core_export_port( | |||
527 | list_add_tail(&port->sep_list, &dev->dev_sep_list); | 528 | list_add_tail(&port->sep_list, &dev->dev_sep_list); |
528 | spin_unlock(&dev->se_port_lock); | 529 | spin_unlock(&dev->se_port_lock); |
529 | 530 | ||
530 | if (dev->transport->transport_type != TRANSPORT_PLUGIN_PHBA_PDEV && | 531 | if (!(dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) && |
531 | !(dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE)) { | 532 | !(dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE)) { |
532 | tg_pt_gp_mem = core_alua_allocate_tg_pt_gp_mem(port); | 533 | tg_pt_gp_mem = core_alua_allocate_tg_pt_gp_mem(port); |
533 | if (IS_ERR(tg_pt_gp_mem) || !tg_pt_gp_mem) { | 534 | if (IS_ERR(tg_pt_gp_mem) || !tg_pt_gp_mem) { |
@@ -1603,7 +1604,7 @@ int target_configure_device(struct se_device *dev) | |||
1603 | * anything virtual (IBLOCK, FILEIO, RAMDISK), but not for TCM/pSCSI | 1604 | * anything virtual (IBLOCK, FILEIO, RAMDISK), but not for TCM/pSCSI |
1604 | * passthrough because this is being provided by the backend LLD. | 1605 | * passthrough because this is being provided by the backend LLD. |
1605 | */ | 1606 | */ |
1606 | if (dev->transport->transport_type != TRANSPORT_PLUGIN_PHBA_PDEV) { | 1607 | if (!(dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH)) { |
1607 | strncpy(&dev->t10_wwn.vendor[0], "LIO-ORG", 8); | 1608 | strncpy(&dev->t10_wwn.vendor[0], "LIO-ORG", 8); |
1608 | strncpy(&dev->t10_wwn.model[0], | 1609 | strncpy(&dev->t10_wwn.model[0], |
1609 | dev->transport->inquiry_prod, 16); | 1610 | dev->transport->inquiry_prod, 16); |
@@ -1707,3 +1708,76 @@ void core_dev_release_virtual_lun0(void) | |||
1707 | target_free_device(g_lun0_dev); | 1708 | target_free_device(g_lun0_dev); |
1708 | core_delete_hba(hba); | 1709 | core_delete_hba(hba); |
1709 | } | 1710 | } |
1711 | |||
1712 | /* | ||
1713 | * Common CDB parsing for kernel and user passthrough. | ||
1714 | */ | ||
1715 | sense_reason_t | ||
1716 | passthrough_parse_cdb(struct se_cmd *cmd, | ||
1717 | sense_reason_t (*exec_cmd)(struct se_cmd *cmd)) | ||
1718 | { | ||
1719 | unsigned char *cdb = cmd->t_task_cdb; | ||
1720 | |||
1721 | /* | ||
1722 | * Clear a lun set in the cdb if the initiator talking to use spoke | ||
1723 | * and old standards version, as we can't assume the underlying device | ||
1724 | * won't choke up on it. | ||
1725 | */ | ||
1726 | switch (cdb[0]) { | ||
1727 | case READ_10: /* SBC - RDProtect */ | ||
1728 | case READ_12: /* SBC - RDProtect */ | ||
1729 | case READ_16: /* SBC - RDProtect */ | ||
1730 | case SEND_DIAGNOSTIC: /* SPC - SELF-TEST Code */ | ||
1731 | case VERIFY: /* SBC - VRProtect */ | ||
1732 | case VERIFY_16: /* SBC - VRProtect */ | ||
1733 | case WRITE_VERIFY: /* SBC - VRProtect */ | ||
1734 | case WRITE_VERIFY_12: /* SBC - VRProtect */ | ||
1735 | case MAINTENANCE_IN: /* SPC - Parameter Data Format for SA RTPG */ | ||
1736 | break; | ||
1737 | default: | ||
1738 | cdb[1] &= 0x1f; /* clear logical unit number */ | ||
1739 | break; | ||
1740 | } | ||
1741 | |||
1742 | /* | ||
1743 | * For REPORT LUNS we always need to emulate the response, for everything | ||
1744 | * else, pass it up. | ||
1745 | */ | ||
1746 | if (cdb[0] == REPORT_LUNS) { | ||
1747 | cmd->execute_cmd = spc_emulate_report_luns; | ||
1748 | return TCM_NO_SENSE; | ||
1749 | } | ||
1750 | |||
1751 | /* Set DATA_CDB flag for ops that should have it */ | ||
1752 | switch (cdb[0]) { | ||
1753 | case READ_6: | ||
1754 | case READ_10: | ||
1755 | case READ_12: | ||
1756 | case READ_16: | ||
1757 | case WRITE_6: | ||
1758 | case WRITE_10: | ||
1759 | case WRITE_12: | ||
1760 | case WRITE_16: | ||
1761 | case WRITE_VERIFY: | ||
1762 | case WRITE_VERIFY_12: | ||
1763 | case 0x8e: /* WRITE_VERIFY_16 */ | ||
1764 | case COMPARE_AND_WRITE: | ||
1765 | case XDWRITEREAD_10: | ||
1766 | cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB; | ||
1767 | break; | ||
1768 | case VARIABLE_LENGTH_CMD: | ||
1769 | switch (get_unaligned_be16(&cdb[8])) { | ||
1770 | case READ_32: | ||
1771 | case WRITE_32: | ||
1772 | case 0x0c: /* WRITE_VERIFY_32 */ | ||
1773 | case XDWRITEREAD_32: | ||
1774 | cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB; | ||
1775 | break; | ||
1776 | } | ||
1777 | } | ||
1778 | |||
1779 | cmd->execute_cmd = exec_cmd; | ||
1780 | |||
1781 | return TCM_NO_SENSE; | ||
1782 | } | ||
1783 | EXPORT_SYMBOL(passthrough_parse_cdb); | ||
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index f7e6e51aed36..3f27bfd816d8 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c | |||
@@ -958,7 +958,6 @@ static struct se_subsystem_api fileio_template = { | |||
958 | .inquiry_prod = "FILEIO", | 958 | .inquiry_prod = "FILEIO", |
959 | .inquiry_rev = FD_VERSION, | 959 | .inquiry_rev = FD_VERSION, |
960 | .owner = THIS_MODULE, | 960 | .owner = THIS_MODULE, |
961 | .transport_type = TRANSPORT_PLUGIN_VHBA_PDEV, | ||
962 | .attach_hba = fd_attach_hba, | 961 | .attach_hba = fd_attach_hba, |
963 | .detach_hba = fd_detach_hba, | 962 | .detach_hba = fd_detach_hba, |
964 | .alloc_device = fd_alloc_device, | 963 | .alloc_device = fd_alloc_device, |
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 1b7947c2510f..8c965683789f 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c | |||
@@ -904,7 +904,6 @@ static struct se_subsystem_api iblock_template = { | |||
904 | .inquiry_prod = "IBLOCK", | 904 | .inquiry_prod = "IBLOCK", |
905 | .inquiry_rev = IBLOCK_VERSION, | 905 | .inquiry_rev = IBLOCK_VERSION, |
906 | .owner = THIS_MODULE, | 906 | .owner = THIS_MODULE, |
907 | .transport_type = TRANSPORT_PLUGIN_VHBA_PDEV, | ||
908 | .attach_hba = iblock_attach_hba, | 907 | .attach_hba = iblock_attach_hba, |
909 | .detach_hba = iblock_detach_hba, | 908 | .detach_hba = iblock_detach_hba, |
910 | .alloc_device = iblock_alloc_device, | 909 | .alloc_device = iblock_alloc_device, |
diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h index 874a9bc988d8..68bd7f5d9f73 100644 --- a/drivers/target/target_core_internal.h +++ b/drivers/target/target_core_internal.h | |||
@@ -4,9 +4,6 @@ | |||
4 | /* target_core_alua.c */ | 4 | /* target_core_alua.c */ |
5 | extern struct t10_alua_lu_gp *default_lu_gp; | 5 | extern struct t10_alua_lu_gp *default_lu_gp; |
6 | 6 | ||
7 | /* target_core_configfs.c */ | ||
8 | extern struct configfs_subsystem *target_core_subsystem[]; | ||
9 | |||
10 | /* target_core_device.c */ | 7 | /* target_core_device.c */ |
11 | extern struct mutex g_device_mutex; | 8 | extern struct mutex g_device_mutex; |
12 | extern struct list_head g_device_list; | 9 | extern struct list_head g_device_list; |
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index c1aa9655e96e..a15411c79ae9 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
@@ -1367,41 +1367,26 @@ void core_scsi3_free_all_registrations( | |||
1367 | 1367 | ||
1368 | static int core_scsi3_tpg_depend_item(struct se_portal_group *tpg) | 1368 | static int core_scsi3_tpg_depend_item(struct se_portal_group *tpg) |
1369 | { | 1369 | { |
1370 | return configfs_depend_item(tpg->se_tpg_tfo->tf_subsys, | 1370 | return target_depend_item(&tpg->tpg_group.cg_item); |
1371 | &tpg->tpg_group.cg_item); | ||
1372 | } | 1371 | } |
1373 | 1372 | ||
1374 | static void core_scsi3_tpg_undepend_item(struct se_portal_group *tpg) | 1373 | static void core_scsi3_tpg_undepend_item(struct se_portal_group *tpg) |
1375 | { | 1374 | { |
1376 | configfs_undepend_item(tpg->se_tpg_tfo->tf_subsys, | 1375 | target_undepend_item(&tpg->tpg_group.cg_item); |
1377 | &tpg->tpg_group.cg_item); | ||
1378 | |||
1379 | atomic_dec_mb(&tpg->tpg_pr_ref_count); | 1376 | atomic_dec_mb(&tpg->tpg_pr_ref_count); |
1380 | } | 1377 | } |
1381 | 1378 | ||
1382 | static int core_scsi3_nodeacl_depend_item(struct se_node_acl *nacl) | 1379 | static int core_scsi3_nodeacl_depend_item(struct se_node_acl *nacl) |
1383 | { | 1380 | { |
1384 | struct se_portal_group *tpg = nacl->se_tpg; | ||
1385 | |||
1386 | if (nacl->dynamic_node_acl) | 1381 | if (nacl->dynamic_node_acl) |
1387 | return 0; | 1382 | return 0; |
1388 | 1383 | return target_depend_item(&nacl->acl_group.cg_item); | |
1389 | return configfs_depend_item(tpg->se_tpg_tfo->tf_subsys, | ||
1390 | &nacl->acl_group.cg_item); | ||
1391 | } | 1384 | } |
1392 | 1385 | ||
1393 | static void core_scsi3_nodeacl_undepend_item(struct se_node_acl *nacl) | 1386 | static void core_scsi3_nodeacl_undepend_item(struct se_node_acl *nacl) |
1394 | { | 1387 | { |
1395 | struct se_portal_group *tpg = nacl->se_tpg; | 1388 | if (!nacl->dynamic_node_acl) |
1396 | 1389 | target_undepend_item(&nacl->acl_group.cg_item); | |
1397 | if (nacl->dynamic_node_acl) { | ||
1398 | atomic_dec_mb(&nacl->acl_pr_ref_count); | ||
1399 | return; | ||
1400 | } | ||
1401 | |||
1402 | configfs_undepend_item(tpg->se_tpg_tfo->tf_subsys, | ||
1403 | &nacl->acl_group.cg_item); | ||
1404 | |||
1405 | atomic_dec_mb(&nacl->acl_pr_ref_count); | 1390 | atomic_dec_mb(&nacl->acl_pr_ref_count); |
1406 | } | 1391 | } |
1407 | 1392 | ||
@@ -1419,8 +1404,7 @@ static int core_scsi3_lunacl_depend_item(struct se_dev_entry *se_deve) | |||
1419 | nacl = lun_acl->se_lun_nacl; | 1404 | nacl = lun_acl->se_lun_nacl; |
1420 | tpg = nacl->se_tpg; | 1405 | tpg = nacl->se_tpg; |
1421 | 1406 | ||
1422 | return configfs_depend_item(tpg->se_tpg_tfo->tf_subsys, | 1407 | return target_depend_item(&lun_acl->se_lun_group.cg_item); |
1423 | &lun_acl->se_lun_group.cg_item); | ||
1424 | } | 1408 | } |
1425 | 1409 | ||
1426 | static void core_scsi3_lunacl_undepend_item(struct se_dev_entry *se_deve) | 1410 | static void core_scsi3_lunacl_undepend_item(struct se_dev_entry *se_deve) |
@@ -1438,9 +1422,7 @@ static void core_scsi3_lunacl_undepend_item(struct se_dev_entry *se_deve) | |||
1438 | nacl = lun_acl->se_lun_nacl; | 1422 | nacl = lun_acl->se_lun_nacl; |
1439 | tpg = nacl->se_tpg; | 1423 | tpg = nacl->se_tpg; |
1440 | 1424 | ||
1441 | configfs_undepend_item(tpg->se_tpg_tfo->tf_subsys, | 1425 | target_undepend_item(&lun_acl->se_lun_group.cg_item); |
1442 | &lun_acl->se_lun_group.cg_item); | ||
1443 | |||
1444 | atomic_dec_mb(&se_deve->pr_ref_count); | 1426 | atomic_dec_mb(&se_deve->pr_ref_count); |
1445 | } | 1427 | } |
1446 | 1428 | ||
@@ -4111,7 +4093,7 @@ target_check_reservation(struct se_cmd *cmd) | |||
4111 | return 0; | 4093 | return 0; |
4112 | if (dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE) | 4094 | if (dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE) |
4113 | return 0; | 4095 | return 0; |
4114 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 4096 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
4115 | return 0; | 4097 | return 0; |
4116 | 4098 | ||
4117 | spin_lock(&dev->dev_reservation_lock); | 4099 | spin_lock(&dev->dev_reservation_lock); |
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index f6c954c4635f..ecc5eaef13d6 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
@@ -521,6 +521,7 @@ static int pscsi_configure_device(struct se_device *dev) | |||
521 | " pdv_host_id: %d\n", pdv->pdv_host_id); | 521 | " pdv_host_id: %d\n", pdv->pdv_host_id); |
522 | return -EINVAL; | 522 | return -EINVAL; |
523 | } | 523 | } |
524 | pdv->pdv_lld_host = sh; | ||
524 | } | 525 | } |
525 | } else { | 526 | } else { |
526 | if (phv->phv_mode == PHV_VIRTUAL_HOST_ID) { | 527 | if (phv->phv_mode == PHV_VIRTUAL_HOST_ID) { |
@@ -603,6 +604,8 @@ static void pscsi_free_device(struct se_device *dev) | |||
603 | if ((phv->phv_mode == PHV_LLD_SCSI_HOST_NO) && | 604 | if ((phv->phv_mode == PHV_LLD_SCSI_HOST_NO) && |
604 | (phv->phv_lld_host != NULL)) | 605 | (phv->phv_lld_host != NULL)) |
605 | scsi_host_put(phv->phv_lld_host); | 606 | scsi_host_put(phv->phv_lld_host); |
607 | else if (pdv->pdv_lld_host) | ||
608 | scsi_host_put(pdv->pdv_lld_host); | ||
606 | 609 | ||
607 | if ((sd->type == TYPE_DISK) || (sd->type == TYPE_ROM)) | 610 | if ((sd->type == TYPE_DISK) || (sd->type == TYPE_ROM)) |
608 | scsi_device_put(sd); | 611 | scsi_device_put(sd); |
@@ -970,64 +973,13 @@ fail: | |||
970 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 973 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
971 | } | 974 | } |
972 | 975 | ||
973 | /* | ||
974 | * Clear a lun set in the cdb if the initiator talking to use spoke | ||
975 | * and old standards version, as we can't assume the underlying device | ||
976 | * won't choke up on it. | ||
977 | */ | ||
978 | static inline void pscsi_clear_cdb_lun(unsigned char *cdb) | ||
979 | { | ||
980 | switch (cdb[0]) { | ||
981 | case READ_10: /* SBC - RDProtect */ | ||
982 | case READ_12: /* SBC - RDProtect */ | ||
983 | case READ_16: /* SBC - RDProtect */ | ||
984 | case SEND_DIAGNOSTIC: /* SPC - SELF-TEST Code */ | ||
985 | case VERIFY: /* SBC - VRProtect */ | ||
986 | case VERIFY_16: /* SBC - VRProtect */ | ||
987 | case WRITE_VERIFY: /* SBC - VRProtect */ | ||
988 | case WRITE_VERIFY_12: /* SBC - VRProtect */ | ||
989 | case MAINTENANCE_IN: /* SPC - Parameter Data Format for SA RTPG */ | ||
990 | break; | ||
991 | default: | ||
992 | cdb[1] &= 0x1f; /* clear logical unit number */ | ||
993 | break; | ||
994 | } | ||
995 | } | ||
996 | |||
997 | static sense_reason_t | 976 | static sense_reason_t |
998 | pscsi_parse_cdb(struct se_cmd *cmd) | 977 | pscsi_parse_cdb(struct se_cmd *cmd) |
999 | { | 978 | { |
1000 | unsigned char *cdb = cmd->t_task_cdb; | ||
1001 | |||
1002 | if (cmd->se_cmd_flags & SCF_BIDI) | 979 | if (cmd->se_cmd_flags & SCF_BIDI) |
1003 | return TCM_UNSUPPORTED_SCSI_OPCODE; | 980 | return TCM_UNSUPPORTED_SCSI_OPCODE; |
1004 | 981 | ||
1005 | pscsi_clear_cdb_lun(cdb); | 982 | return passthrough_parse_cdb(cmd, pscsi_execute_cmd); |
1006 | |||
1007 | /* | ||
1008 | * For REPORT LUNS we always need to emulate the response, for everything | ||
1009 | * else the default for pSCSI is to pass the command to the underlying | ||
1010 | * LLD / physical hardware. | ||
1011 | */ | ||
1012 | switch (cdb[0]) { | ||
1013 | case REPORT_LUNS: | ||
1014 | cmd->execute_cmd = spc_emulate_report_luns; | ||
1015 | return 0; | ||
1016 | case READ_6: | ||
1017 | case READ_10: | ||
1018 | case READ_12: | ||
1019 | case READ_16: | ||
1020 | case WRITE_6: | ||
1021 | case WRITE_10: | ||
1022 | case WRITE_12: | ||
1023 | case WRITE_16: | ||
1024 | case WRITE_VERIFY: | ||
1025 | cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB; | ||
1026 | /* FALLTHROUGH*/ | ||
1027 | default: | ||
1028 | cmd->execute_cmd = pscsi_execute_cmd; | ||
1029 | return 0; | ||
1030 | } | ||
1031 | } | 983 | } |
1032 | 984 | ||
1033 | static sense_reason_t | 985 | static sense_reason_t |
@@ -1189,7 +1141,7 @@ static struct configfs_attribute *pscsi_backend_dev_attrs[] = { | |||
1189 | static struct se_subsystem_api pscsi_template = { | 1141 | static struct se_subsystem_api pscsi_template = { |
1190 | .name = "pscsi", | 1142 | .name = "pscsi", |
1191 | .owner = THIS_MODULE, | 1143 | .owner = THIS_MODULE, |
1192 | .transport_type = TRANSPORT_PLUGIN_PHBA_PDEV, | 1144 | .transport_flags = TRANSPORT_FLAG_PASSTHROUGH, |
1193 | .attach_hba = pscsi_attach_hba, | 1145 | .attach_hba = pscsi_attach_hba, |
1194 | .detach_hba = pscsi_detach_hba, | 1146 | .detach_hba = pscsi_detach_hba, |
1195 | .pmode_enable_hba = pscsi_pmode_enable_hba, | 1147 | .pmode_enable_hba = pscsi_pmode_enable_hba, |
diff --git a/drivers/target/target_core_pscsi.h b/drivers/target/target_core_pscsi.h index 1bd757dff8ee..820d3052b775 100644 --- a/drivers/target/target_core_pscsi.h +++ b/drivers/target/target_core_pscsi.h | |||
@@ -45,6 +45,7 @@ struct pscsi_dev_virt { | |||
45 | int pdv_lun_id; | 45 | int pdv_lun_id; |
46 | struct block_device *pdv_bd; | 46 | struct block_device *pdv_bd; |
47 | struct scsi_device *pdv_sd; | 47 | struct scsi_device *pdv_sd; |
48 | struct Scsi_Host *pdv_lld_host; | ||
48 | } ____cacheline_aligned; | 49 | } ____cacheline_aligned; |
49 | 50 | ||
50 | typedef enum phv_modes { | 51 | typedef enum phv_modes { |
diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c index a263bf5fab8d..d16489b6a1a4 100644 --- a/drivers/target/target_core_rd.c +++ b/drivers/target/target_core_rd.c | |||
@@ -733,7 +733,6 @@ static struct se_subsystem_api rd_mcp_template = { | |||
733 | .name = "rd_mcp", | 733 | .name = "rd_mcp", |
734 | .inquiry_prod = "RAMDISK-MCP", | 734 | .inquiry_prod = "RAMDISK-MCP", |
735 | .inquiry_rev = RD_MCP_VERSION, | 735 | .inquiry_rev = RD_MCP_VERSION, |
736 | .transport_type = TRANSPORT_PLUGIN_VHBA_VDEV, | ||
737 | .attach_hba = rd_attach_hba, | 736 | .attach_hba = rd_attach_hba, |
738 | .detach_hba = rd_detach_hba, | 737 | .detach_hba = rd_detach_hba, |
739 | .alloc_device = rd_alloc_device, | 738 | .alloc_device = rd_alloc_device, |
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 8855781ac653..733824e3825f 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
@@ -568,7 +568,7 @@ sbc_compare_and_write(struct se_cmd *cmd) | |||
568 | * comparision using SGLs at cmd->t_bidi_data_sg.. | 568 | * comparision using SGLs at cmd->t_bidi_data_sg.. |
569 | */ | 569 | */ |
570 | rc = down_interruptible(&dev->caw_sem); | 570 | rc = down_interruptible(&dev->caw_sem); |
571 | if ((rc != 0) || signal_pending(current)) { | 571 | if (rc != 0) { |
572 | cmd->transport_complete_callback = NULL; | 572 | cmd->transport_complete_callback = NULL; |
573 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 573 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
574 | } | 574 | } |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 3fe5cb240b6f..675f2d9d1f14 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -1196,7 +1196,7 @@ transport_check_alloc_task_attr(struct se_cmd *cmd) | |||
1196 | * Check if SAM Task Attribute emulation is enabled for this | 1196 | * Check if SAM Task Attribute emulation is enabled for this |
1197 | * struct se_device storage object | 1197 | * struct se_device storage object |
1198 | */ | 1198 | */ |
1199 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 1199 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
1200 | return 0; | 1200 | return 0; |
1201 | 1201 | ||
1202 | if (cmd->sam_task_attr == TCM_ACA_TAG) { | 1202 | if (cmd->sam_task_attr == TCM_ACA_TAG) { |
@@ -1770,7 +1770,7 @@ static int target_write_prot_action(struct se_cmd *cmd) | |||
1770 | sectors, 0, NULL, 0); | 1770 | sectors, 0, NULL, 0); |
1771 | if (unlikely(cmd->pi_err)) { | 1771 | if (unlikely(cmd->pi_err)) { |
1772 | spin_lock_irq(&cmd->t_state_lock); | 1772 | spin_lock_irq(&cmd->t_state_lock); |
1773 | cmd->transport_state &= ~CMD_T_BUSY|CMD_T_SENT; | 1773 | cmd->transport_state &= ~(CMD_T_BUSY|CMD_T_SENT); |
1774 | spin_unlock_irq(&cmd->t_state_lock); | 1774 | spin_unlock_irq(&cmd->t_state_lock); |
1775 | transport_generic_request_failure(cmd, cmd->pi_err); | 1775 | transport_generic_request_failure(cmd, cmd->pi_err); |
1776 | return -1; | 1776 | return -1; |
@@ -1787,7 +1787,7 @@ static bool target_handle_task_attr(struct se_cmd *cmd) | |||
1787 | { | 1787 | { |
1788 | struct se_device *dev = cmd->se_dev; | 1788 | struct se_device *dev = cmd->se_dev; |
1789 | 1789 | ||
1790 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 1790 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
1791 | return false; | 1791 | return false; |
1792 | 1792 | ||
1793 | /* | 1793 | /* |
@@ -1868,7 +1868,7 @@ void target_execute_cmd(struct se_cmd *cmd) | |||
1868 | 1868 | ||
1869 | if (target_handle_task_attr(cmd)) { | 1869 | if (target_handle_task_attr(cmd)) { |
1870 | spin_lock_irq(&cmd->t_state_lock); | 1870 | spin_lock_irq(&cmd->t_state_lock); |
1871 | cmd->transport_state &= ~CMD_T_BUSY|CMD_T_SENT; | 1871 | cmd->transport_state &= ~(CMD_T_BUSY | CMD_T_SENT); |
1872 | spin_unlock_irq(&cmd->t_state_lock); | 1872 | spin_unlock_irq(&cmd->t_state_lock); |
1873 | return; | 1873 | return; |
1874 | } | 1874 | } |
@@ -1912,7 +1912,7 @@ static void transport_complete_task_attr(struct se_cmd *cmd) | |||
1912 | { | 1912 | { |
1913 | struct se_device *dev = cmd->se_dev; | 1913 | struct se_device *dev = cmd->se_dev; |
1914 | 1914 | ||
1915 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 1915 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
1916 | return; | 1916 | return; |
1917 | 1917 | ||
1918 | if (cmd->sam_task_attr == TCM_SIMPLE_TAG) { | 1918 | if (cmd->sam_task_attr == TCM_SIMPLE_TAG) { |
@@ -1957,8 +1957,7 @@ static void transport_complete_qf(struct se_cmd *cmd) | |||
1957 | case DMA_TO_DEVICE: | 1957 | case DMA_TO_DEVICE: |
1958 | if (cmd->se_cmd_flags & SCF_BIDI) { | 1958 | if (cmd->se_cmd_flags & SCF_BIDI) { |
1959 | ret = cmd->se_tfo->queue_data_in(cmd); | 1959 | ret = cmd->se_tfo->queue_data_in(cmd); |
1960 | if (ret < 0) | 1960 | break; |
1961 | break; | ||
1962 | } | 1961 | } |
1963 | /* Fall through for DMA_TO_DEVICE */ | 1962 | /* Fall through for DMA_TO_DEVICE */ |
1964 | case DMA_NONE: | 1963 | case DMA_NONE: |
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index dbc872a6c981..07d2996d8c1f 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c | |||
@@ -71,13 +71,6 @@ struct tcmu_hba { | |||
71 | u32 host_id; | 71 | u32 host_id; |
72 | }; | 72 | }; |
73 | 73 | ||
74 | /* User wants all cmds or just some */ | ||
75 | enum passthru_level { | ||
76 | TCMU_PASS_ALL = 0, | ||
77 | TCMU_PASS_IO, | ||
78 | TCMU_PASS_INVALID, | ||
79 | }; | ||
80 | |||
81 | #define TCMU_CONFIG_LEN 256 | 74 | #define TCMU_CONFIG_LEN 256 |
82 | 75 | ||
83 | struct tcmu_dev { | 76 | struct tcmu_dev { |
@@ -89,7 +82,6 @@ struct tcmu_dev { | |||
89 | #define TCMU_DEV_BIT_OPEN 0 | 82 | #define TCMU_DEV_BIT_OPEN 0 |
90 | #define TCMU_DEV_BIT_BROKEN 1 | 83 | #define TCMU_DEV_BIT_BROKEN 1 |
91 | unsigned long flags; | 84 | unsigned long flags; |
92 | enum passthru_level pass_level; | ||
93 | 85 | ||
94 | struct uio_info uio_info; | 86 | struct uio_info uio_info; |
95 | 87 | ||
@@ -683,8 +675,6 @@ static struct se_device *tcmu_alloc_device(struct se_hba *hba, const char *name) | |||
683 | setup_timer(&udev->timeout, tcmu_device_timedout, | 675 | setup_timer(&udev->timeout, tcmu_device_timedout, |
684 | (unsigned long)udev); | 676 | (unsigned long)udev); |
685 | 677 | ||
686 | udev->pass_level = TCMU_PASS_ALL; | ||
687 | |||
688 | return &udev->se_dev; | 678 | return &udev->se_dev; |
689 | } | 679 | } |
690 | 680 | ||
@@ -948,13 +938,13 @@ static void tcmu_free_device(struct se_device *dev) | |||
948 | } | 938 | } |
949 | 939 | ||
950 | enum { | 940 | enum { |
951 | Opt_dev_config, Opt_dev_size, Opt_err, Opt_pass_level, | 941 | Opt_dev_config, Opt_dev_size, Opt_hw_block_size, Opt_err, |
952 | }; | 942 | }; |
953 | 943 | ||
954 | static match_table_t tokens = { | 944 | static match_table_t tokens = { |
955 | {Opt_dev_config, "dev_config=%s"}, | 945 | {Opt_dev_config, "dev_config=%s"}, |
956 | {Opt_dev_size, "dev_size=%u"}, | 946 | {Opt_dev_size, "dev_size=%u"}, |
957 | {Opt_pass_level, "pass_level=%u"}, | 947 | {Opt_hw_block_size, "hw_block_size=%u"}, |
958 | {Opt_err, NULL} | 948 | {Opt_err, NULL} |
959 | }; | 949 | }; |
960 | 950 | ||
@@ -965,7 +955,7 @@ static ssize_t tcmu_set_configfs_dev_params(struct se_device *dev, | |||
965 | char *orig, *ptr, *opts, *arg_p; | 955 | char *orig, *ptr, *opts, *arg_p; |
966 | substring_t args[MAX_OPT_ARGS]; | 956 | substring_t args[MAX_OPT_ARGS]; |
967 | int ret = 0, token; | 957 | int ret = 0, token; |
968 | int arg; | 958 | unsigned long tmp_ul; |
969 | 959 | ||
970 | opts = kstrdup(page, GFP_KERNEL); | 960 | opts = kstrdup(page, GFP_KERNEL); |
971 | if (!opts) | 961 | if (!opts) |
@@ -998,15 +988,23 @@ static ssize_t tcmu_set_configfs_dev_params(struct se_device *dev, | |||
998 | if (ret < 0) | 988 | if (ret < 0) |
999 | pr_err("kstrtoul() failed for dev_size=\n"); | 989 | pr_err("kstrtoul() failed for dev_size=\n"); |
1000 | break; | 990 | break; |
1001 | case Opt_pass_level: | 991 | case Opt_hw_block_size: |
1002 | match_int(args, &arg); | 992 | arg_p = match_strdup(&args[0]); |
1003 | if (arg >= TCMU_PASS_INVALID) { | 993 | if (!arg_p) { |
1004 | pr_warn("TCMU: Invalid pass_level: %d\n", arg); | 994 | ret = -ENOMEM; |
1005 | break; | 995 | break; |
1006 | } | 996 | } |
1007 | 997 | ret = kstrtoul(arg_p, 0, &tmp_ul); | |
1008 | pr_debug("TCMU: Setting pass_level to %d\n", arg); | 998 | kfree(arg_p); |
1009 | udev->pass_level = arg; | 999 | if (ret < 0) { |
1000 | pr_err("kstrtoul() failed for hw_block_size=\n"); | ||
1001 | break; | ||
1002 | } | ||
1003 | if (!tmp_ul) { | ||
1004 | pr_err("hw_block_size must be nonzero\n"); | ||
1005 | break; | ||
1006 | } | ||
1007 | dev->dev_attrib.hw_block_size = tmp_ul; | ||
1010 | break; | 1008 | break; |
1011 | default: | 1009 | default: |
1012 | break; | 1010 | break; |
@@ -1024,8 +1022,7 @@ static ssize_t tcmu_show_configfs_dev_params(struct se_device *dev, char *b) | |||
1024 | 1022 | ||
1025 | bl = sprintf(b + bl, "Config: %s ", | 1023 | bl = sprintf(b + bl, "Config: %s ", |
1026 | udev->dev_config[0] ? udev->dev_config : "NULL"); | 1024 | udev->dev_config[0] ? udev->dev_config : "NULL"); |
1027 | bl += sprintf(b + bl, "Size: %zu PassLevel: %u\n", | 1025 | bl += sprintf(b + bl, "Size: %zu\n", udev->dev_size); |
1028 | udev->dev_size, udev->pass_level); | ||
1029 | 1026 | ||
1030 | return bl; | 1027 | return bl; |
1031 | } | 1028 | } |
@@ -1039,20 +1036,6 @@ static sector_t tcmu_get_blocks(struct se_device *dev) | |||
1039 | } | 1036 | } |
1040 | 1037 | ||
1041 | static sense_reason_t | 1038 | static sense_reason_t |
1042 | tcmu_execute_rw(struct se_cmd *se_cmd, struct scatterlist *sgl, u32 sgl_nents, | ||
1043 | enum dma_data_direction data_direction) | ||
1044 | { | ||
1045 | int ret; | ||
1046 | |||
1047 | ret = tcmu_queue_cmd(se_cmd); | ||
1048 | |||
1049 | if (ret != 0) | ||
1050 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
1051 | else | ||
1052 | return TCM_NO_SENSE; | ||
1053 | } | ||
1054 | |||
1055 | static sense_reason_t | ||
1056 | tcmu_pass_op(struct se_cmd *se_cmd) | 1039 | tcmu_pass_op(struct se_cmd *se_cmd) |
1057 | { | 1040 | { |
1058 | int ret = tcmu_queue_cmd(se_cmd); | 1041 | int ret = tcmu_queue_cmd(se_cmd); |
@@ -1063,91 +1046,29 @@ tcmu_pass_op(struct se_cmd *se_cmd) | |||
1063 | return TCM_NO_SENSE; | 1046 | return TCM_NO_SENSE; |
1064 | } | 1047 | } |
1065 | 1048 | ||
1066 | static struct sbc_ops tcmu_sbc_ops = { | ||
1067 | .execute_rw = tcmu_execute_rw, | ||
1068 | .execute_sync_cache = tcmu_pass_op, | ||
1069 | .execute_write_same = tcmu_pass_op, | ||
1070 | .execute_write_same_unmap = tcmu_pass_op, | ||
1071 | .execute_unmap = tcmu_pass_op, | ||
1072 | }; | ||
1073 | |||
1074 | static sense_reason_t | 1049 | static sense_reason_t |
1075 | tcmu_parse_cdb(struct se_cmd *cmd) | 1050 | tcmu_parse_cdb(struct se_cmd *cmd) |
1076 | { | 1051 | { |
1077 | unsigned char *cdb = cmd->t_task_cdb; | 1052 | return passthrough_parse_cdb(cmd, tcmu_pass_op); |
1078 | struct tcmu_dev *udev = TCMU_DEV(cmd->se_dev); | ||
1079 | sense_reason_t ret; | ||
1080 | |||
1081 | switch (udev->pass_level) { | ||
1082 | case TCMU_PASS_ALL: | ||
1083 | /* We're just like pscsi, then */ | ||
1084 | /* | ||
1085 | * For REPORT LUNS we always need to emulate the response, for everything | ||
1086 | * else, pass it up. | ||
1087 | */ | ||
1088 | switch (cdb[0]) { | ||
1089 | case REPORT_LUNS: | ||
1090 | cmd->execute_cmd = spc_emulate_report_luns; | ||
1091 | break; | ||
1092 | case READ_6: | ||
1093 | case READ_10: | ||
1094 | case READ_12: | ||
1095 | case READ_16: | ||
1096 | case WRITE_6: | ||
1097 | case WRITE_10: | ||
1098 | case WRITE_12: | ||
1099 | case WRITE_16: | ||
1100 | case WRITE_VERIFY: | ||
1101 | cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB; | ||
1102 | /* FALLTHROUGH */ | ||
1103 | default: | ||
1104 | cmd->execute_cmd = tcmu_pass_op; | ||
1105 | } | ||
1106 | ret = TCM_NO_SENSE; | ||
1107 | break; | ||
1108 | case TCMU_PASS_IO: | ||
1109 | ret = sbc_parse_cdb(cmd, &tcmu_sbc_ops); | ||
1110 | break; | ||
1111 | default: | ||
1112 | pr_err("Unknown tcm-user pass level %d\n", udev->pass_level); | ||
1113 | ret = TCM_CHECK_CONDITION_ABORT_CMD; | ||
1114 | } | ||
1115 | |||
1116 | return ret; | ||
1117 | } | 1053 | } |
1118 | 1054 | ||
1119 | DEF_TB_DEFAULT_ATTRIBS(tcmu); | 1055 | DEF_TB_DEV_ATTRIB_RO(tcmu, hw_pi_prot_type); |
1056 | TB_DEV_ATTR_RO(tcmu, hw_pi_prot_type); | ||
1057 | |||
1058 | DEF_TB_DEV_ATTRIB_RO(tcmu, hw_block_size); | ||
1059 | TB_DEV_ATTR_RO(tcmu, hw_block_size); | ||
1060 | |||
1061 | DEF_TB_DEV_ATTRIB_RO(tcmu, hw_max_sectors); | ||
1062 | TB_DEV_ATTR_RO(tcmu, hw_max_sectors); | ||
1063 | |||
1064 | DEF_TB_DEV_ATTRIB_RO(tcmu, hw_queue_depth); | ||
1065 | TB_DEV_ATTR_RO(tcmu, hw_queue_depth); | ||
1120 | 1066 | ||
1121 | static struct configfs_attribute *tcmu_backend_dev_attrs[] = { | 1067 | static struct configfs_attribute *tcmu_backend_dev_attrs[] = { |
1122 | &tcmu_dev_attrib_emulate_model_alias.attr, | ||
1123 | &tcmu_dev_attrib_emulate_dpo.attr, | ||
1124 | &tcmu_dev_attrib_emulate_fua_write.attr, | ||
1125 | &tcmu_dev_attrib_emulate_fua_read.attr, | ||
1126 | &tcmu_dev_attrib_emulate_write_cache.attr, | ||
1127 | &tcmu_dev_attrib_emulate_ua_intlck_ctrl.attr, | ||
1128 | &tcmu_dev_attrib_emulate_tas.attr, | ||
1129 | &tcmu_dev_attrib_emulate_tpu.attr, | ||
1130 | &tcmu_dev_attrib_emulate_tpws.attr, | ||
1131 | &tcmu_dev_attrib_emulate_caw.attr, | ||
1132 | &tcmu_dev_attrib_emulate_3pc.attr, | ||
1133 | &tcmu_dev_attrib_pi_prot_type.attr, | ||
1134 | &tcmu_dev_attrib_hw_pi_prot_type.attr, | 1068 | &tcmu_dev_attrib_hw_pi_prot_type.attr, |
1135 | &tcmu_dev_attrib_pi_prot_format.attr, | ||
1136 | &tcmu_dev_attrib_enforce_pr_isids.attr, | ||
1137 | &tcmu_dev_attrib_is_nonrot.attr, | ||
1138 | &tcmu_dev_attrib_emulate_rest_reord.attr, | ||
1139 | &tcmu_dev_attrib_force_pr_aptpl.attr, | ||
1140 | &tcmu_dev_attrib_hw_block_size.attr, | 1069 | &tcmu_dev_attrib_hw_block_size.attr, |
1141 | &tcmu_dev_attrib_block_size.attr, | ||
1142 | &tcmu_dev_attrib_hw_max_sectors.attr, | 1070 | &tcmu_dev_attrib_hw_max_sectors.attr, |
1143 | &tcmu_dev_attrib_optimal_sectors.attr, | ||
1144 | &tcmu_dev_attrib_hw_queue_depth.attr, | 1071 | &tcmu_dev_attrib_hw_queue_depth.attr, |
1145 | &tcmu_dev_attrib_queue_depth.attr, | ||
1146 | &tcmu_dev_attrib_max_unmap_lba_count.attr, | ||
1147 | &tcmu_dev_attrib_max_unmap_block_desc_count.attr, | ||
1148 | &tcmu_dev_attrib_unmap_granularity.attr, | ||
1149 | &tcmu_dev_attrib_unmap_granularity_alignment.attr, | ||
1150 | &tcmu_dev_attrib_max_write_same_len.attr, | ||
1151 | NULL, | 1072 | NULL, |
1152 | }; | 1073 | }; |
1153 | 1074 | ||
@@ -1156,7 +1077,7 @@ static struct se_subsystem_api tcmu_template = { | |||
1156 | .inquiry_prod = "USER", | 1077 | .inquiry_prod = "USER", |
1157 | .inquiry_rev = TCMU_VERSION, | 1078 | .inquiry_rev = TCMU_VERSION, |
1158 | .owner = THIS_MODULE, | 1079 | .owner = THIS_MODULE, |
1159 | .transport_type = TRANSPORT_PLUGIN_VHBA_PDEV, | 1080 | .transport_flags = TRANSPORT_FLAG_PASSTHROUGH, |
1160 | .attach_hba = tcmu_attach_hba, | 1081 | .attach_hba = tcmu_attach_hba, |
1161 | .detach_hba = tcmu_detach_hba, | 1082 | .detach_hba = tcmu_detach_hba, |
1162 | .alloc_device = tcmu_alloc_device, | 1083 | .alloc_device = tcmu_alloc_device, |
diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index a600ff15dcfd..8fd680ac941b 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c | |||
@@ -58,7 +58,6 @@ static int target_xcopy_locate_se_dev_e4(struct se_cmd *se_cmd, struct xcopy_op | |||
58 | bool src) | 58 | bool src) |
59 | { | 59 | { |
60 | struct se_device *se_dev; | 60 | struct se_device *se_dev; |
61 | struct configfs_subsystem *subsys = target_core_subsystem[0]; | ||
62 | unsigned char tmp_dev_wwn[XCOPY_NAA_IEEE_REGEX_LEN], *dev_wwn; | 61 | unsigned char tmp_dev_wwn[XCOPY_NAA_IEEE_REGEX_LEN], *dev_wwn; |
63 | int rc; | 62 | int rc; |
64 | 63 | ||
@@ -90,8 +89,7 @@ static int target_xcopy_locate_se_dev_e4(struct se_cmd *se_cmd, struct xcopy_op | |||
90 | " se_dev\n", xop->src_dev); | 89 | " se_dev\n", xop->src_dev); |
91 | } | 90 | } |
92 | 91 | ||
93 | rc = configfs_depend_item(subsys, | 92 | rc = target_depend_item(&se_dev->dev_group.cg_item); |
94 | &se_dev->dev_group.cg_item); | ||
95 | if (rc != 0) { | 93 | if (rc != 0) { |
96 | pr_err("configfs_depend_item attempt failed:" | 94 | pr_err("configfs_depend_item attempt failed:" |
97 | " %d for se_dev: %p\n", rc, se_dev); | 95 | " %d for se_dev: %p\n", rc, se_dev); |
@@ -99,8 +97,8 @@ static int target_xcopy_locate_se_dev_e4(struct se_cmd *se_cmd, struct xcopy_op | |||
99 | return rc; | 97 | return rc; |
100 | } | 98 | } |
101 | 99 | ||
102 | pr_debug("Called configfs_depend_item for subsys: %p se_dev: %p" | 100 | pr_debug("Called configfs_depend_item for se_dev: %p" |
103 | " se_dev->se_dev_group: %p\n", subsys, se_dev, | 101 | " se_dev->se_dev_group: %p\n", se_dev, |
104 | &se_dev->dev_group); | 102 | &se_dev->dev_group); |
105 | 103 | ||
106 | mutex_unlock(&g_device_mutex); | 104 | mutex_unlock(&g_device_mutex); |
@@ -373,7 +371,6 @@ static int xcopy_pt_get_cmd_state(struct se_cmd *se_cmd) | |||
373 | 371 | ||
374 | static void xcopy_pt_undepend_remotedev(struct xcopy_op *xop) | 372 | static void xcopy_pt_undepend_remotedev(struct xcopy_op *xop) |
375 | { | 373 | { |
376 | struct configfs_subsystem *subsys = target_core_subsystem[0]; | ||
377 | struct se_device *remote_dev; | 374 | struct se_device *remote_dev; |
378 | 375 | ||
379 | if (xop->op_origin == XCOL_SOURCE_RECV_OP) | 376 | if (xop->op_origin == XCOL_SOURCE_RECV_OP) |
@@ -381,11 +378,11 @@ static void xcopy_pt_undepend_remotedev(struct xcopy_op *xop) | |||
381 | else | 378 | else |
382 | remote_dev = xop->src_dev; | 379 | remote_dev = xop->src_dev; |
383 | 380 | ||
384 | pr_debug("Calling configfs_undepend_item for subsys: %p" | 381 | pr_debug("Calling configfs_undepend_item for" |
385 | " remote_dev: %p remote_dev->dev_group: %p\n", | 382 | " remote_dev: %p remote_dev->dev_group: %p\n", |
386 | subsys, remote_dev, &remote_dev->dev_group.cg_item); | 383 | remote_dev, &remote_dev->dev_group.cg_item); |
387 | 384 | ||
388 | configfs_undepend_item(subsys, &remote_dev->dev_group.cg_item); | 385 | target_undepend_item(&remote_dev->dev_group.cg_item); |
389 | } | 386 | } |
390 | 387 | ||
391 | static void xcopy_pt_release_cmd(struct se_cmd *se_cmd) | 388 | static void xcopy_pt_release_cmd(struct se_cmd *se_cmd) |
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 5e19bb53b3a9..ea32b386797f 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
@@ -1409,8 +1409,7 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs, | |||
1409 | * dependency now. | 1409 | * dependency now. |
1410 | */ | 1410 | */ |
1411 | se_tpg = &tpg->se_tpg; | 1411 | se_tpg = &tpg->se_tpg; |
1412 | ret = configfs_depend_item(se_tpg->se_tpg_tfo->tf_subsys, | 1412 | ret = target_depend_item(&se_tpg->tpg_group.cg_item); |
1413 | &se_tpg->tpg_group.cg_item); | ||
1414 | if (ret) { | 1413 | if (ret) { |
1415 | pr_warn("configfs_depend_item() failed: %d\n", ret); | 1414 | pr_warn("configfs_depend_item() failed: %d\n", ret); |
1416 | kfree(vs_tpg); | 1415 | kfree(vs_tpg); |
@@ -1513,8 +1512,7 @@ vhost_scsi_clear_endpoint(struct vhost_scsi *vs, | |||
1513 | * to allow vhost-scsi WWPN se_tpg->tpg_group shutdown to occur. | 1512 | * to allow vhost-scsi WWPN se_tpg->tpg_group shutdown to occur. |
1514 | */ | 1513 | */ |
1515 | se_tpg = &tpg->se_tpg; | 1514 | se_tpg = &tpg->se_tpg; |
1516 | configfs_undepend_item(se_tpg->se_tpg_tfo->tf_subsys, | 1515 | target_undepend_item(&se_tpg->tpg_group.cg_item); |
1517 | &se_tpg->tpg_group.cg_item); | ||
1518 | } | 1516 | } |
1519 | if (match) { | 1517 | if (match) { |
1520 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { | 1518 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { |
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h index d61be7297b2c..5f1225706993 100644 --- a/include/target/target_core_backend.h +++ b/include/target/target_core_backend.h | |||
@@ -1,9 +1,7 @@ | |||
1 | #ifndef TARGET_CORE_BACKEND_H | 1 | #ifndef TARGET_CORE_BACKEND_H |
2 | #define TARGET_CORE_BACKEND_H | 2 | #define TARGET_CORE_BACKEND_H |
3 | 3 | ||
4 | #define TRANSPORT_PLUGIN_PHBA_PDEV 1 | 4 | #define TRANSPORT_FLAG_PASSTHROUGH 1 |
5 | #define TRANSPORT_PLUGIN_VHBA_PDEV 2 | ||
6 | #define TRANSPORT_PLUGIN_VHBA_VDEV 3 | ||
7 | 5 | ||
8 | struct target_backend_cits { | 6 | struct target_backend_cits { |
9 | struct config_item_type tb_dev_cit; | 7 | struct config_item_type tb_dev_cit; |
@@ -22,7 +20,7 @@ struct se_subsystem_api { | |||
22 | char inquiry_rev[4]; | 20 | char inquiry_rev[4]; |
23 | struct module *owner; | 21 | struct module *owner; |
24 | 22 | ||
25 | u8 transport_type; | 23 | u8 transport_flags; |
26 | 24 | ||
27 | int (*attach_hba)(struct se_hba *, u32); | 25 | int (*attach_hba)(struct se_hba *, u32); |
28 | void (*detach_hba)(struct se_hba *); | 26 | void (*detach_hba)(struct se_hba *); |
@@ -138,5 +136,7 @@ int se_dev_set_queue_depth(struct se_device *, u32); | |||
138 | int se_dev_set_max_sectors(struct se_device *, u32); | 136 | int se_dev_set_max_sectors(struct se_device *, u32); |
139 | int se_dev_set_optimal_sectors(struct se_device *, u32); | 137 | int se_dev_set_optimal_sectors(struct se_device *, u32); |
140 | int se_dev_set_block_size(struct se_device *, u32); | 138 | int se_dev_set_block_size(struct se_device *, u32); |
139 | sense_reason_t passthrough_parse_cdb(struct se_cmd *cmd, | ||
140 | sense_reason_t (*exec_cmd)(struct se_cmd *cmd)); | ||
141 | 141 | ||
142 | #endif /* TARGET_CORE_BACKEND_H */ | 142 | #endif /* TARGET_CORE_BACKEND_H */ |
diff --git a/include/target/target_core_configfs.h b/include/target/target_core_configfs.h index 25bb04c4209e..b99c01170392 100644 --- a/include/target/target_core_configfs.h +++ b/include/target/target_core_configfs.h | |||
@@ -40,8 +40,6 @@ struct target_fabric_configfs { | |||
40 | struct config_item *tf_fabric; | 40 | struct config_item *tf_fabric; |
41 | /* Passed from fabric modules */ | 41 | /* Passed from fabric modules */ |
42 | struct config_item_type *tf_fabric_cit; | 42 | struct config_item_type *tf_fabric_cit; |
43 | /* Pointer to target core subsystem */ | ||
44 | struct configfs_subsystem *tf_subsys; | ||
45 | /* Pointer to fabric's struct module */ | 43 | /* Pointer to fabric's struct module */ |
46 | struct module *tf_module; | 44 | struct module *tf_module; |
47 | struct target_core_fabric_ops tf_ops; | 45 | struct target_core_fabric_ops tf_ops; |
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 17c7f5ac7ea0..0f4dc3768587 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h | |||
@@ -4,7 +4,6 @@ | |||
4 | struct target_core_fabric_ops { | 4 | struct target_core_fabric_ops { |
5 | struct module *module; | 5 | struct module *module; |
6 | const char *name; | 6 | const char *name; |
7 | struct configfs_subsystem *tf_subsys; | ||
8 | char *(*get_fabric_name)(void); | 7 | char *(*get_fabric_name)(void); |
9 | u8 (*get_fabric_proto_ident)(struct se_portal_group *); | 8 | u8 (*get_fabric_proto_ident)(struct se_portal_group *); |
10 | char *(*tpg_get_wwn)(struct se_portal_group *); | 9 | char *(*tpg_get_wwn)(struct se_portal_group *); |
@@ -109,6 +108,9 @@ struct target_core_fabric_ops { | |||
109 | int target_register_template(const struct target_core_fabric_ops *fo); | 108 | int target_register_template(const struct target_core_fabric_ops *fo); |
110 | void target_unregister_template(const struct target_core_fabric_ops *fo); | 109 | void target_unregister_template(const struct target_core_fabric_ops *fo); |
111 | 110 | ||
111 | int target_depend_item(struct config_item *item); | ||
112 | void target_undepend_item(struct config_item *item); | ||
113 | |||
112 | struct se_session *transport_init_session(enum target_prot_op); | 114 | struct se_session *transport_init_session(enum target_prot_op); |
113 | int transport_alloc_session_tags(struct se_session *, unsigned int, | 115 | int transport_alloc_session_tags(struct se_session *, unsigned int, |
114 | unsigned int); | 116 | unsigned int); |