diff options
author | Christoph Hellwig <hch@lst.de> | 2016-03-29 07:03:35 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2016-03-30 23:06:44 -0400 |
commit | 839559e10601ed4459c802cbfb69747bf1844078 (patch) | |
tree | 7a0201a0b4ff509092dd522cac49ee6f77a16fbd | |
parent | e6e202edf000004422a901dfa301d600e32f17e3 (diff) |
target: add a new add_wwn_groups fabrics method
We need to have the WWN fully initialized before addig default groups to it,
so add a new method to add these groups after the WWN has been initialized.
Also remove the default groups in the core while we're at it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r-- | drivers/target/iscsi/iscsi_target_configfs.c | 19 | ||||
-rw-r--r-- | drivers/target/target_core_fabric_configfs.c | 3 | ||||
-rw-r--r-- | include/target/target_core_fabric.h | 1 |
3 files changed, 15 insertions, 8 deletions
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c index 3c05d1e97f8f..97e5b69e0668 100644 --- a/drivers/target/iscsi/iscsi_target_configfs.c +++ b/drivers/target/iscsi/iscsi_target_configfs.c | |||
@@ -1239,6 +1239,16 @@ static struct se_wwn *lio_target_call_coreaddtiqn( | |||
1239 | if (IS_ERR(tiqn)) | 1239 | if (IS_ERR(tiqn)) |
1240 | return ERR_CAST(tiqn); | 1240 | return ERR_CAST(tiqn); |
1241 | 1241 | ||
1242 | pr_debug("LIO_Target_ConfigFS: REGISTER -> %s\n", tiqn->tiqn); | ||
1243 | pr_debug("LIO_Target_ConfigFS: REGISTER -> Allocated Node:" | ||
1244 | " %s\n", name); | ||
1245 | return &tiqn->tiqn_wwn; | ||
1246 | } | ||
1247 | |||
1248 | static void lio_target_add_wwn_groups(struct se_wwn *wwn) | ||
1249 | { | ||
1250 | struct iscsi_tiqn *tiqn = container_of(wwn, struct iscsi_tiqn, tiqn_wwn); | ||
1251 | |||
1242 | config_group_init_type_name(&tiqn->tiqn_stat_grps.iscsi_instance_group, | 1252 | config_group_init_type_name(&tiqn->tiqn_stat_grps.iscsi_instance_group, |
1243 | "iscsi_instance", &iscsi_stat_instance_cit); | 1253 | "iscsi_instance", &iscsi_stat_instance_cit); |
1244 | configfs_add_default_group(&tiqn->tiqn_stat_grps.iscsi_instance_group, | 1254 | configfs_add_default_group(&tiqn->tiqn_stat_grps.iscsi_instance_group, |
@@ -1263,12 +1273,6 @@ static struct se_wwn *lio_target_call_coreaddtiqn( | |||
1263 | "iscsi_logout_stats", &iscsi_stat_logout_cit); | 1273 | "iscsi_logout_stats", &iscsi_stat_logout_cit); |
1264 | configfs_add_default_group(&tiqn->tiqn_stat_grps.iscsi_logout_stats_group, | 1274 | configfs_add_default_group(&tiqn->tiqn_stat_grps.iscsi_logout_stats_group, |
1265 | &tiqn->tiqn_wwn.fabric_stat_group); | 1275 | &tiqn->tiqn_wwn.fabric_stat_group); |
1266 | |||
1267 | |||
1268 | pr_debug("LIO_Target_ConfigFS: REGISTER -> %s\n", tiqn->tiqn); | ||
1269 | pr_debug("LIO_Target_ConfigFS: REGISTER -> Allocated Node:" | ||
1270 | " %s\n", name); | ||
1271 | return &tiqn->tiqn_wwn; | ||
1272 | } | 1276 | } |
1273 | 1277 | ||
1274 | static void lio_target_call_coredeltiqn( | 1278 | static void lio_target_call_coredeltiqn( |
@@ -1276,8 +1280,6 @@ static void lio_target_call_coredeltiqn( | |||
1276 | { | 1280 | { |
1277 | struct iscsi_tiqn *tiqn = container_of(wwn, struct iscsi_tiqn, tiqn_wwn); | 1281 | struct iscsi_tiqn *tiqn = container_of(wwn, struct iscsi_tiqn, tiqn_wwn); |
1278 | 1282 | ||
1279 | configfs_remove_default_groups(&tiqn->tiqn_wwn.fabric_stat_group); | ||
1280 | |||
1281 | pr_debug("LIO_Target_ConfigFS: DEREGISTER -> %s\n", | 1283 | pr_debug("LIO_Target_ConfigFS: DEREGISTER -> %s\n", |
1282 | tiqn->tiqn); | 1284 | tiqn->tiqn); |
1283 | iscsit_del_tiqn(tiqn); | 1285 | iscsit_del_tiqn(tiqn); |
@@ -1652,6 +1654,7 @@ const struct target_core_fabric_ops iscsi_ops = { | |||
1652 | .aborted_task = lio_aborted_task, | 1654 | .aborted_task = lio_aborted_task, |
1653 | .fabric_make_wwn = lio_target_call_coreaddtiqn, | 1655 | .fabric_make_wwn = lio_target_call_coreaddtiqn, |
1654 | .fabric_drop_wwn = lio_target_call_coredeltiqn, | 1656 | .fabric_drop_wwn = lio_target_call_coredeltiqn, |
1657 | .add_wwn_groups = lio_target_add_wwn_groups, | ||
1655 | .fabric_make_tpg = lio_target_tiqn_addtpg, | 1658 | .fabric_make_tpg = lio_target_tiqn_addtpg, |
1656 | .fabric_drop_tpg = lio_target_tiqn_deltpg, | 1659 | .fabric_drop_tpg = lio_target_tiqn_deltpg, |
1657 | .fabric_make_np = lio_target_call_addnptotpg, | 1660 | .fabric_make_np = lio_target_call_addnptotpg, |
diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c index 5991a4f816d8..31a096aa16ab 100644 --- a/drivers/target/target_core_fabric_configfs.c +++ b/drivers/target/target_core_fabric_configfs.c | |||
@@ -891,6 +891,7 @@ static void target_fabric_release_wwn(struct config_item *item) | |||
891 | struct se_wwn, wwn_group); | 891 | struct se_wwn, wwn_group); |
892 | struct target_fabric_configfs *tf = wwn->wwn_tf; | 892 | struct target_fabric_configfs *tf = wwn->wwn_tf; |
893 | 893 | ||
894 | configfs_remove_default_groups(&wwn->fabric_stat_group); | ||
894 | tf->tf_ops->fabric_drop_wwn(wwn); | 895 | tf->tf_ops->fabric_drop_wwn(wwn); |
895 | } | 896 | } |
896 | 897 | ||
@@ -944,6 +945,8 @@ static struct config_group *target_fabric_make_wwn( | |||
944 | &tf->tf_wwn_fabric_stats_cit); | 945 | &tf->tf_wwn_fabric_stats_cit); |
945 | configfs_add_default_group(&wwn->fabric_stat_group, &wwn->wwn_group); | 946 | configfs_add_default_group(&wwn->fabric_stat_group, &wwn->wwn_group); |
946 | 947 | ||
948 | if (tf->tf_ops->add_wwn_groups) | ||
949 | tf->tf_ops->add_wwn_groups(wwn); | ||
947 | return &wwn->wwn_group; | 950 | return &wwn->wwn_group; |
948 | } | 951 | } |
949 | 952 | ||
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 5a9dd1892b70..8ff6d40a294f 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h | |||
@@ -76,6 +76,7 @@ struct target_core_fabric_ops { | |||
76 | struct se_wwn *(*fabric_make_wwn)(struct target_fabric_configfs *, | 76 | struct se_wwn *(*fabric_make_wwn)(struct target_fabric_configfs *, |
77 | struct config_group *, const char *); | 77 | struct config_group *, const char *); |
78 | void (*fabric_drop_wwn)(struct se_wwn *); | 78 | void (*fabric_drop_wwn)(struct se_wwn *); |
79 | void (*add_wwn_groups)(struct se_wwn *); | ||
79 | struct se_portal_group *(*fabric_make_tpg)(struct se_wwn *, | 80 | struct se_portal_group *(*fabric_make_tpg)(struct se_wwn *, |
80 | struct config_group *, const char *); | 81 | struct config_group *, const char *); |
81 | void (*fabric_drop_tpg)(struct se_portal_group *); | 82 | void (*fabric_drop_tpg)(struct se_portal_group *); |