target: initialize the nacl base CIT begfore init_nodeacl
authorChristoph Hellwig <hch@lst.de>
Tue, 29 Mar 2016 11:03:34 +0000 (13:03 +0200)
committerNicholas Bellinger <nab@linux-iscsi.org>
Thu, 31 Mar 2016 03:06:43 +0000 (20:06 -0700)
The iSCSI targets wants to add a default group, for which we need to
have the list of default groups initialized previously.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_fabric_configfs.c

index 096790ad6e50d59711847e3dd3bff4f5f331a25c..5991a4f816d8c98df594d017aa8a2fd7689223a8 100644 (file)
@@ -381,14 +381,6 @@ static struct config_group *target_fabric_make_nodeacl(
        if (IS_ERR(se_nacl))
                return ERR_CAST(se_nacl);
 
-       if (tf->tf_ops->fabric_init_nodeacl) {
-               int ret = tf->tf_ops->fabric_init_nodeacl(se_nacl, name);
-               if (ret) {
-                       core_tpg_del_initiator_node_acl(se_nacl);
-                       return ERR_PTR(ret);
-               }
-       }
-
        config_group_init_type_name(&se_nacl->acl_group, name,
                        &tf->tf_tpg_nacl_base_cit);
 
@@ -412,6 +404,15 @@ static struct config_group *target_fabric_make_nodeacl(
        configfs_add_default_group(&se_nacl->acl_fabric_stat_group,
                        &se_nacl->acl_group);
 
+       if (tf->tf_ops->fabric_init_nodeacl) {
+               int ret = tf->tf_ops->fabric_init_nodeacl(se_nacl, name);
+               if (ret) {
+                       configfs_remove_default_groups(&se_nacl->acl_fabric_stat_group);
+                       core_tpg_del_initiator_node_acl(se_nacl);
+                       return ERR_PTR(ret);
+               }
+       }
+
        return &se_nacl->acl_group;
 }