Commit e986a35a authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Nicholas Bellinger

tcm_loop: Send I_T_NEXUS_LOSS_OCCURRED UA

If the virtual SAS link is set to 'offline' we should be
queueing an I_T_NEXUS_LOSS_OCCURRED UA.
Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent b7446cac
...@@ -1034,6 +1034,11 @@ static ssize_t tcm_loop_tpg_store_transport_status( ...@@ -1034,6 +1034,11 @@ static ssize_t tcm_loop_tpg_store_transport_status(
} }
if (!strncmp(page, "offline", 7)) { if (!strncmp(page, "offline", 7)) {
tl_tpg->tl_transport_status = TCM_TRANSPORT_OFFLINE; tl_tpg->tl_transport_status = TCM_TRANSPORT_OFFLINE;
if (tl_tpg->tl_nexus) {
struct se_session *tl_sess = tl_tpg->tl_nexus->se_sess;
core_allocate_nexus_loss_ua(tl_sess->se_node_acl);
}
return count; return count;
} }
return -EINVAL; return -EINVAL;
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "target_core_internal.h" #include "target_core_internal.h"
#include "target_core_alua.h" #include "target_core_alua.h"
#include "target_core_pr.h" #include "target_core_pr.h"
#include "target_core_ua.h"
extern struct se_device *g_lun0_dev; extern struct se_device *g_lun0_dev;
...@@ -83,6 +84,22 @@ struct se_node_acl *core_tpg_get_initiator_node_acl( ...@@ -83,6 +84,22 @@ struct se_node_acl *core_tpg_get_initiator_node_acl(
} }
EXPORT_SYMBOL(core_tpg_get_initiator_node_acl); EXPORT_SYMBOL(core_tpg_get_initiator_node_acl);
void core_allocate_nexus_loss_ua(
struct se_node_acl *nacl)
{
struct se_dev_entry *deve;
if (!nacl)
return;
rcu_read_lock();
hlist_for_each_entry_rcu(deve, &nacl->lun_entry_hlist, link)
core_scsi3_ua_allocate(deve, 0x29,
ASCQ_29H_NEXUS_LOSS_OCCURRED);
rcu_read_unlock();
}
EXPORT_SYMBOL(core_allocate_nexus_loss_ua);
/* core_tpg_add_node_to_devs(): /* core_tpg_add_node_to_devs():
* *
* *
......
...@@ -152,6 +152,7 @@ int transport_generic_handle_tmr(struct se_cmd *); ...@@ -152,6 +152,7 @@ int transport_generic_handle_tmr(struct se_cmd *);
void transport_generic_request_failure(struct se_cmd *, sense_reason_t); void transport_generic_request_failure(struct se_cmd *, sense_reason_t);
void __target_execute_cmd(struct se_cmd *); void __target_execute_cmd(struct se_cmd *);
int transport_lookup_tmr_lun(struct se_cmd *, u64); int transport_lookup_tmr_lun(struct se_cmd *, u64);
void core_allocate_nexus_loss_ua(struct se_node_acl *acl);
struct se_node_acl *core_tpg_get_initiator_node_acl(struct se_portal_group *tpg, struct se_node_acl *core_tpg_get_initiator_node_acl(struct se_portal_group *tpg,
unsigned char *); unsigned char *);
......
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