aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2015-06-18 05:43:38 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2015-07-24 01:08:22 -0400
commite986a35aba67558381d5cec59a14c4d0b20f0d47 (patch)
tree58535b746aea2c97f16b10981bfcf674f2df5f27
parentb7446cacfb433f5e89ff94afecbc349e404aee21 (diff)
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: Hannes Reinecke <hare@suse.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/target/loopback/tcm_loop.c5
-rw-r--r--drivers/target/target_core_tpg.c17
-rw-r--r--include/target/target_core_fabric.h1
3 files changed, 23 insertions, 0 deletions
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index b179d934cee1..5bc85ffed720 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -1034,6 +1034,11 @@ static ssize_t tcm_loop_tpg_store_transport_status(
1034 } 1034 }
1035 if (!strncmp(page, "offline", 7)) { 1035 if (!strncmp(page, "offline", 7)) {
1036 tl_tpg->tl_transport_status = TCM_TRANSPORT_OFFLINE; 1036 tl_tpg->tl_transport_status = TCM_TRANSPORT_OFFLINE;
1037 if (tl_tpg->tl_nexus) {
1038 struct se_session *tl_sess = tl_tpg->tl_nexus->se_sess;
1039
1040 core_allocate_nexus_loss_ua(tl_sess->se_node_acl);
1041 }
1037 return count; 1042 return count;
1038 } 1043 }
1039 return -EINVAL; 1044 return -EINVAL;
diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c
index babde4ad841f..2d0381dd105c 100644
--- a/drivers/target/target_core_tpg.c
+++ b/drivers/target/target_core_tpg.c
@@ -41,6 +41,7 @@
41#include "target_core_internal.h" 41#include "target_core_internal.h"
42#include "target_core_alua.h" 42#include "target_core_alua.h"
43#include "target_core_pr.h" 43#include "target_core_pr.h"
44#include "target_core_ua.h"
44 45
45extern struct se_device *g_lun0_dev; 46extern struct se_device *g_lun0_dev;
46 47
@@ -83,6 +84,22 @@ struct se_node_acl *core_tpg_get_initiator_node_acl(
83} 84}
84EXPORT_SYMBOL(core_tpg_get_initiator_node_acl); 85EXPORT_SYMBOL(core_tpg_get_initiator_node_acl);
85 86
87void core_allocate_nexus_loss_ua(
88 struct se_node_acl *nacl)
89{
90 struct se_dev_entry *deve;
91
92 if (!nacl)
93 return;
94
95 rcu_read_lock();
96 hlist_for_each_entry_rcu(deve, &nacl->lun_entry_hlist, link)
97 core_scsi3_ua_allocate(deve, 0x29,
98 ASCQ_29H_NEXUS_LOSS_OCCURRED);
99 rcu_read_unlock();
100}
101EXPORT_SYMBOL(core_allocate_nexus_loss_ua);
102
86/* core_tpg_add_node_to_devs(): 103/* core_tpg_add_node_to_devs():
87 * 104 *
88 * 105 *
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 18afef91b447..69355feabd1d 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -152,6 +152,7 @@ int transport_generic_handle_tmr(struct se_cmd *);
152void transport_generic_request_failure(struct se_cmd *, sense_reason_t); 152void transport_generic_request_failure(struct se_cmd *, sense_reason_t);
153void __target_execute_cmd(struct se_cmd *); 153void __target_execute_cmd(struct se_cmd *);
154int transport_lookup_tmr_lun(struct se_cmd *, u64); 154int transport_lookup_tmr_lun(struct se_cmd *, u64);
155void core_allocate_nexus_loss_ua(struct se_node_acl *acl);
155 156
156struct se_node_acl *core_tpg_get_initiator_node_acl(struct se_portal_group *tpg, 157struct se_node_acl *core_tpg_get_initiator_node_acl(struct se_portal_group *tpg,
157 unsigned char *); 158 unsigned char *);