summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2015-06-11 10:01:29 +0200
committerNicholas Bellinger <nab@linux-iscsi.org>2015-06-23 00:43:02 -0700
commit7c0d0d51d26497866d2951a35f1736fc765e4fcf (patch)
treede87ed7f9cef0c0b6df62595f78ad7afa70302e0
parentb5aafb16ebdb713e9e5ac60db2940fe4baf6328f (diff)
downloadlinux-7c0d0d51d26497866d2951a35f1736fc765e4fcf.tar.gz
linux-7c0d0d51d26497866d2951a35f1736fc765e4fcf.tar.bz2
linux-7c0d0d51d26497866d2951a35f1736fc765e4fcf.zip
target: Send UA when changing LUN inventory
When changind the LUN inventory via core_enable_device_list_for_node() or core_disable_device_list_for_node() a REPORTED LUNS DATA HAS CHANGED UA should be send. (Convert to target_luns_data_has_changed helper usage - hch) Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/target/target_core_device.c23
-rw-r--r--drivers/target/target_core_ua.h1
2 files changed, 20 insertions, 4 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index b6df5b9a6890..52448483ed9b 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -293,10 +293,22 @@ void target_pr_kref_release(struct kref *kref)
complete(&deve->pr_comp);
}
-/* core_enable_device_list_for_node():
- *
- *
- */
+static void
+target_luns_data_has_changed(struct se_node_acl *nacl, struct se_dev_entry *new,
+ bool skip_new)
+{
+ struct se_dev_entry *tmp;
+
+ rcu_read_lock();
+ hlist_for_each_entry_rcu(tmp, &nacl->lun_entry_hlist, link) {
+ if (skip_new && tmp == new)
+ continue;
+ core_scsi3_ua_allocate(tmp, 0x3F,
+ ASCQ_3FH_REPORTED_LUNS_DATA_HAS_CHANGED);
+ }
+ rcu_read_unlock();
+}
+
int core_enable_device_list_for_node(
struct se_lun *lun,
struct se_lun_acl *lun_acl,
@@ -360,6 +372,7 @@ int core_enable_device_list_for_node(
kref_put(&orig->pr_kref, target_pr_kref_release);
wait_for_completion(&orig->pr_comp);
+ target_luns_data_has_changed(nacl, new, true);
kfree_rcu(orig, rcu_head);
return 0;
}
@@ -373,6 +386,7 @@ int core_enable_device_list_for_node(
list_add_tail(&new->lun_link, &lun->lun_deve_list);
spin_unlock(&lun->lun_deve_lock);
+ target_luns_data_has_changed(nacl, new, true);
return 0;
}
@@ -428,6 +442,7 @@ void core_disable_device_list_for_node(
kfree_rcu(orig, rcu_head);
core_scsi3_free_pr_reg_from_nacl(dev, nacl);
+ target_luns_data_has_changed(nacl, NULL, false);
}
/* core_clear_lun_from_tpg():
diff --git a/drivers/target/target_core_ua.h b/drivers/target/target_core_ua.h
index 59278d662e66..bd6e78ba153d 100644
--- a/drivers/target/target_core_ua.h
+++ b/drivers/target/target_core_ua.h
@@ -26,6 +26,7 @@
#define ASCQ_2CH_PREVIOUS_RESERVATION_CONFLICT_STATUS 0x09
#define ASCQ_3FH_INQUIRY_DATA_HAS_CHANGED 0x03
+#define ASCQ_3FH_REPORTED_LUNS_DATA_HAS_CHANGED 0x0E
extern struct kmem_cache *se_ua_cache;