diff options
Diffstat (limited to 'drivers/target')
| -rw-r--r-- | drivers/target/iscsi/iscsi_target.c | 14 | ||||
| -rw-r--r-- | drivers/target/iscsi/iscsi_target_erl0.c | 4 | ||||
| -rw-r--r-- | drivers/target/loopback/tcm_loop.c | 7 | ||||
| -rw-r--r-- | drivers/target/target_core_device.c | 32 | ||||
| -rw-r--r-- | drivers/target/target_core_pscsi.c | 2 | ||||
| -rw-r--r-- | drivers/target/target_core_sbc.c | 3 | ||||
| -rw-r--r-- | drivers/target/target_core_spc.c | 19 | ||||
| -rw-r--r-- | drivers/target/target_core_transport.c | 4 | ||||
| -rw-r--r-- | drivers/target/tcm_fc/tfc_io.c | 3 |
9 files changed, 53 insertions, 35 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 50bad55a0c42..2accb6e47beb 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
| @@ -4256,11 +4256,17 @@ int iscsit_close_connection( | |||
| 4256 | pr_debug("Closing iSCSI connection CID %hu on SID:" | 4256 | pr_debug("Closing iSCSI connection CID %hu on SID:" |
| 4257 | " %u\n", conn->cid, sess->sid); | 4257 | " %u\n", conn->cid, sess->sid); |
| 4258 | /* | 4258 | /* |
| 4259 | * Always up conn_logout_comp just in case the RX Thread is sleeping | 4259 | * Always up conn_logout_comp for the traditional TCP case just in case |
| 4260 | * and the logout response never got sent because the connection | 4260 | * the RX Thread in iscsi_target_rx_opcode() is sleeping and the logout |
| 4261 | * failed. | 4261 | * response never got sent because the connection failed. |
| 4262 | * | ||
| 4263 | * However for iser-target, isert_wait4logout() is using conn_logout_comp | ||
| 4264 | * to signal logout response TX interrupt completion. Go ahead and skip | ||
| 4265 | * this for iser since isert_rx_opcode() does not wait on logout failure, | ||
| 4266 | * and to avoid iscsi_conn pointer dereference in iser-target code. | ||
| 4262 | */ | 4267 | */ |
| 4263 | complete(&conn->conn_logout_comp); | 4268 | if (conn->conn_transport->transport_type == ISCSI_TCP) |
| 4269 | complete(&conn->conn_logout_comp); | ||
| 4264 | 4270 | ||
| 4265 | iscsi_release_thread_set(conn); | 4271 | iscsi_release_thread_set(conn); |
| 4266 | 4272 | ||
diff --git a/drivers/target/iscsi/iscsi_target_erl0.c b/drivers/target/iscsi/iscsi_target_erl0.c index 1c197bad6132..bdd8731a4daa 100644 --- a/drivers/target/iscsi/iscsi_target_erl0.c +++ b/drivers/target/iscsi/iscsi_target_erl0.c | |||
| @@ -22,7 +22,6 @@ | |||
| 22 | #include <target/target_core_fabric.h> | 22 | #include <target/target_core_fabric.h> |
| 23 | 23 | ||
| 24 | #include <target/iscsi/iscsi_target_core.h> | 24 | #include <target/iscsi/iscsi_target_core.h> |
| 25 | #include <target/iscsi/iscsi_transport.h> | ||
| 26 | #include "iscsi_target_seq_pdu_list.h" | 25 | #include "iscsi_target_seq_pdu_list.h" |
| 27 | #include "iscsi_target_tq.h" | 26 | #include "iscsi_target_tq.h" |
| 28 | #include "iscsi_target_erl0.h" | 27 | #include "iscsi_target_erl0.h" |
| @@ -940,8 +939,7 @@ void iscsit_take_action_for_connection_exit(struct iscsi_conn *conn) | |||
| 940 | 939 | ||
| 941 | if (conn->conn_state == TARG_CONN_STATE_IN_LOGOUT) { | 940 | if (conn->conn_state == TARG_CONN_STATE_IN_LOGOUT) { |
| 942 | spin_unlock_bh(&conn->state_lock); | 941 | spin_unlock_bh(&conn->state_lock); |
| 943 | if (conn->conn_transport->transport_type == ISCSI_TCP) | 942 | iscsit_close_connection(conn); |
| 944 | iscsit_close_connection(conn); | ||
| 945 | return; | 943 | return; |
| 946 | } | 944 | } |
| 947 | 945 | ||
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 6b3c32954689..c36bd7c29136 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c | |||
| @@ -953,11 +953,8 @@ static int tcm_loop_make_nexus( | |||
| 953 | transport_free_session(tl_nexus->se_sess); | 953 | transport_free_session(tl_nexus->se_sess); |
| 954 | goto out; | 954 | goto out; |
| 955 | } | 955 | } |
| 956 | /* | 956 | /* Now, register the SAS I_T Nexus as active. */ |
| 957 | * Now, register the SAS I_T Nexus as active with the call to | 957 | transport_register_session(se_tpg, tl_nexus->se_sess->se_node_acl, |
| 958 | * transport_register_session() | ||
| 959 | */ | ||
| 960 | __transport_register_session(se_tpg, tl_nexus->se_sess->se_node_acl, | ||
| 961 | tl_nexus->se_sess, tl_nexus); | 958 | tl_nexus->se_sess, tl_nexus); |
| 962 | tl_tpg->tl_nexus = tl_nexus; | 959 | tl_tpg->tl_nexus = tl_nexus; |
| 963 | pr_debug("TCM_Loop_ConfigFS: Established I_T Nexus to emulated" | 960 | pr_debug("TCM_Loop_ConfigFS: Established I_T Nexus to emulated" |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 58f49ff69b14..79b4ec3ca2db 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
| @@ -650,6 +650,18 @@ static u32 se_dev_align_max_sectors(u32 max_sectors, u32 block_size) | |||
| 650 | return aligned_max_sectors; | 650 | return aligned_max_sectors; |
| 651 | } | 651 | } |
| 652 | 652 | ||
| 653 | bool se_dev_check_wce(struct se_device *dev) | ||
| 654 | { | ||
| 655 | bool wce = false; | ||
| 656 | |||
| 657 | if (dev->transport->get_write_cache) | ||
| 658 | wce = dev->transport->get_write_cache(dev); | ||
| 659 | else if (dev->dev_attrib.emulate_write_cache > 0) | ||
| 660 | wce = true; | ||
| 661 | |||
| 662 | return wce; | ||
| 663 | } | ||
| 664 | |||
| 653 | int se_dev_set_max_unmap_lba_count( | 665 | int se_dev_set_max_unmap_lba_count( |
| 654 | struct se_device *dev, | 666 | struct se_device *dev, |
| 655 | u32 max_unmap_lba_count) | 667 | u32 max_unmap_lba_count) |
| @@ -767,6 +779,16 @@ int se_dev_set_emulate_fua_write(struct se_device *dev, int flag) | |||
| 767 | pr_err("Illegal value %d\n", flag); | 779 | pr_err("Illegal value %d\n", flag); |
| 768 | return -EINVAL; | 780 | return -EINVAL; |
| 769 | } | 781 | } |
| 782 | if (flag && | ||
| 783 | dev->transport->get_write_cache) { | ||
| 784 | pr_err("emulate_fua_write not supported for this device\n"); | ||
| 785 | return -EINVAL; | ||
| 786 | } | ||
| 787 | if (dev->export_count) { | ||
| 788 | pr_err("emulate_fua_write cannot be changed with active" | ||
| 789 | " exports: %d\n", dev->export_count); | ||
| 790 | return -EINVAL; | ||
| 791 | } | ||
| 770 | dev->dev_attrib.emulate_fua_write = flag; | 792 | dev->dev_attrib.emulate_fua_write = flag; |
| 771 | pr_debug("dev[%p]: SE Device Forced Unit Access WRITEs: %d\n", | 793 | pr_debug("dev[%p]: SE Device Forced Unit Access WRITEs: %d\n", |
| 772 | dev, dev->dev_attrib.emulate_fua_write); | 794 | dev, dev->dev_attrib.emulate_fua_write); |
| @@ -801,7 +823,11 @@ int se_dev_set_emulate_write_cache(struct se_device *dev, int flag) | |||
| 801 | pr_err("emulate_write_cache not supported for this device\n"); | 823 | pr_err("emulate_write_cache not supported for this device\n"); |
| 802 | return -EINVAL; | 824 | return -EINVAL; |
| 803 | } | 825 | } |
| 804 | 826 | if (dev->export_count) { | |
| 827 | pr_err("emulate_write_cache cannot be changed with active" | ||
| 828 | " exports: %d\n", dev->export_count); | ||
| 829 | return -EINVAL; | ||
| 830 | } | ||
| 805 | dev->dev_attrib.emulate_write_cache = flag; | 831 | dev->dev_attrib.emulate_write_cache = flag; |
| 806 | pr_debug("dev[%p]: SE Device WRITE_CACHE_EMULATION flag: %d\n", | 832 | pr_debug("dev[%p]: SE Device WRITE_CACHE_EMULATION flag: %d\n", |
| 807 | dev, dev->dev_attrib.emulate_write_cache); | 833 | dev, dev->dev_attrib.emulate_write_cache); |
| @@ -1534,8 +1560,6 @@ int target_configure_device(struct se_device *dev) | |||
| 1534 | ret = dev->transport->configure_device(dev); | 1560 | ret = dev->transport->configure_device(dev); |
| 1535 | if (ret) | 1561 | if (ret) |
| 1536 | goto out; | 1562 | goto out; |
| 1537 | dev->dev_flags |= DF_CONFIGURED; | ||
| 1538 | |||
| 1539 | /* | 1563 | /* |
| 1540 | * XXX: there is not much point to have two different values here.. | 1564 | * XXX: there is not much point to have two different values here.. |
| 1541 | */ | 1565 | */ |
| @@ -1597,6 +1621,8 @@ int target_configure_device(struct se_device *dev) | |||
| 1597 | list_add_tail(&dev->g_dev_node, &g_device_list); | 1621 | list_add_tail(&dev->g_dev_node, &g_device_list); |
| 1598 | mutex_unlock(&g_device_mutex); | 1622 | mutex_unlock(&g_device_mutex); |
| 1599 | 1623 | ||
| 1624 | dev->dev_flags |= DF_CONFIGURED; | ||
| 1625 | |||
| 1600 | return 0; | 1626 | return 0; |
| 1601 | 1627 | ||
| 1602 | out_free_alua: | 1628 | out_free_alua: |
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 1045dcd7bf65..f6c954c4635f 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
| @@ -1121,7 +1121,7 @@ static u32 pscsi_get_device_type(struct se_device *dev) | |||
| 1121 | struct pscsi_dev_virt *pdv = PSCSI_DEV(dev); | 1121 | struct pscsi_dev_virt *pdv = PSCSI_DEV(dev); |
| 1122 | struct scsi_device *sd = pdv->pdv_sd; | 1122 | struct scsi_device *sd = pdv->pdv_sd; |
| 1123 | 1123 | ||
| 1124 | return sd->type; | 1124 | return (sd) ? sd->type : TYPE_NO_LUN; |
| 1125 | } | 1125 | } |
| 1126 | 1126 | ||
| 1127 | static sector_t pscsi_get_blocks(struct se_device *dev) | 1127 | static sector_t pscsi_get_blocks(struct se_device *dev) |
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 9a2f9d3a6e70..3e7297411110 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
| @@ -708,8 +708,7 @@ sbc_check_dpofua(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb) | |||
| 708 | } | 708 | } |
| 709 | } | 709 | } |
| 710 | if (cdb[1] & 0x8) { | 710 | if (cdb[1] & 0x8) { |
| 711 | if (!dev->dev_attrib.emulate_fua_write || | 711 | if (!dev->dev_attrib.emulate_fua_write || !se_dev_check_wce(dev)) { |
| 712 | !dev->dev_attrib.emulate_write_cache) { | ||
| 713 | pr_err("Got CDB: 0x%02x with FUA bit set, but device" | 712 | pr_err("Got CDB: 0x%02x with FUA bit set, but device" |
| 714 | " does not advertise support for FUA write\n", | 713 | " does not advertise support for FUA write\n", |
| 715 | cdb[0]); | 714 | cdb[0]); |
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 460e93109473..6c8bd6bc175c 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c | |||
| @@ -454,19 +454,6 @@ check_scsi_name: | |||
| 454 | } | 454 | } |
| 455 | EXPORT_SYMBOL(spc_emulate_evpd_83); | 455 | EXPORT_SYMBOL(spc_emulate_evpd_83); |
| 456 | 456 | ||
| 457 | static bool | ||
| 458 | spc_check_dev_wce(struct se_device *dev) | ||
| 459 | { | ||
| 460 | bool wce = false; | ||
| 461 | |||
| 462 | if (dev->transport->get_write_cache) | ||
| 463 | wce = dev->transport->get_write_cache(dev); | ||
| 464 | else if (dev->dev_attrib.emulate_write_cache > 0) | ||
| 465 | wce = true; | ||
| 466 | |||
| 467 | return wce; | ||
| 468 | } | ||
| 469 | |||
| 470 | /* Extended INQUIRY Data VPD Page */ | 457 | /* Extended INQUIRY Data VPD Page */ |
| 471 | static sense_reason_t | 458 | static sense_reason_t |
| 472 | spc_emulate_evpd_86(struct se_cmd *cmd, unsigned char *buf) | 459 | spc_emulate_evpd_86(struct se_cmd *cmd, unsigned char *buf) |
| @@ -490,7 +477,7 @@ spc_emulate_evpd_86(struct se_cmd *cmd, unsigned char *buf) | |||
| 490 | buf[5] = 0x07; | 477 | buf[5] = 0x07; |
| 491 | 478 | ||
| 492 | /* If WriteCache emulation is enabled, set V_SUP */ | 479 | /* If WriteCache emulation is enabled, set V_SUP */ |
| 493 | if (spc_check_dev_wce(dev)) | 480 | if (se_dev_check_wce(dev)) |
| 494 | buf[6] = 0x01; | 481 | buf[6] = 0x01; |
| 495 | /* If an LBA map is present set R_SUP */ | 482 | /* If an LBA map is present set R_SUP */ |
| 496 | spin_lock(&cmd->se_dev->t10_alua.lba_map_lock); | 483 | spin_lock(&cmd->se_dev->t10_alua.lba_map_lock); |
| @@ -897,7 +884,7 @@ static int spc_modesense_caching(struct se_cmd *cmd, u8 pc, u8 *p) | |||
| 897 | if (pc == 1) | 884 | if (pc == 1) |
| 898 | goto out; | 885 | goto out; |
| 899 | 886 | ||
| 900 | if (spc_check_dev_wce(dev)) | 887 | if (se_dev_check_wce(dev)) |
| 901 | p[2] = 0x04; /* Write Cache Enable */ | 888 | p[2] = 0x04; /* Write Cache Enable */ |
| 902 | p[12] = 0x20; /* Disabled Read Ahead */ | 889 | p[12] = 0x20; /* Disabled Read Ahead */ |
| 903 | 890 | ||
| @@ -1009,7 +996,7 @@ static sense_reason_t spc_emulate_modesense(struct se_cmd *cmd) | |||
| 1009 | (cmd->se_deve->lun_flags & TRANSPORT_LUNFLAGS_READ_ONLY))) | 996 | (cmd->se_deve->lun_flags & TRANSPORT_LUNFLAGS_READ_ONLY))) |
| 1010 | spc_modesense_write_protect(&buf[length], type); | 997 | spc_modesense_write_protect(&buf[length], type); |
| 1011 | 998 | ||
| 1012 | if ((spc_check_dev_wce(dev)) && | 999 | if ((se_dev_check_wce(dev)) && |
| 1013 | (dev->dev_attrib.emulate_fua_write > 0)) | 1000 | (dev->dev_attrib.emulate_fua_write > 0)) |
| 1014 | spc_modesense_dpofua(&buf[length], type); | 1001 | spc_modesense_dpofua(&buf[length], type); |
| 1015 | 1002 | ||
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 0adc0f650213..ac3cbabdbdf0 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
| @@ -2389,6 +2389,10 @@ int target_get_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd, | |||
| 2389 | list_add_tail(&se_cmd->se_cmd_list, &se_sess->sess_cmd_list); | 2389 | list_add_tail(&se_cmd->se_cmd_list, &se_sess->sess_cmd_list); |
| 2390 | out: | 2390 | out: |
| 2391 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); | 2391 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); |
| 2392 | |||
| 2393 | if (ret && ack_kref) | ||
| 2394 | target_put_sess_cmd(se_sess, se_cmd); | ||
| 2395 | |||
| 2392 | return ret; | 2396 | return ret; |
| 2393 | } | 2397 | } |
| 2394 | EXPORT_SYMBOL(target_get_sess_cmd); | 2398 | EXPORT_SYMBOL(target_get_sess_cmd); |
diff --git a/drivers/target/tcm_fc/tfc_io.c b/drivers/target/tcm_fc/tfc_io.c index 97b486c3dda1..583e755d8091 100644 --- a/drivers/target/tcm_fc/tfc_io.c +++ b/drivers/target/tcm_fc/tfc_io.c | |||
| @@ -359,7 +359,7 @@ void ft_invl_hw_context(struct ft_cmd *cmd) | |||
| 359 | ep = fc_seq_exch(seq); | 359 | ep = fc_seq_exch(seq); |
| 360 | if (ep) { | 360 | if (ep) { |
| 361 | lport = ep->lp; | 361 | lport = ep->lp; |
| 362 | if (lport && (ep->xid <= lport->lro_xid)) | 362 | if (lport && (ep->xid <= lport->lro_xid)) { |
| 363 | /* | 363 | /* |
| 364 | * "ddp_done" trigger invalidation of HW | 364 | * "ddp_done" trigger invalidation of HW |
| 365 | * specific DDP context | 365 | * specific DDP context |
| @@ -374,6 +374,7 @@ void ft_invl_hw_context(struct ft_cmd *cmd) | |||
| 374 | * identified using ep->xid) | 374 | * identified using ep->xid) |
| 375 | */ | 375 | */ |
| 376 | cmd->was_ddp_setup = 0; | 376 | cmd->was_ddp_setup = 0; |
| 377 | } | ||
| 377 | } | 378 | } |
| 378 | } | 379 | } |
| 379 | } | 380 | } |
