iscsi-target: Expose per endpoint dynamic_sessions attribute
authorNicholas Bellinger <nab@linux-iscsi.org>
Sat, 7 Mar 2015 04:40:57 +0000 (20:40 -0800)
committerNicholas Bellinger <nab@linux-iscsi.org>
Sat, 7 Mar 2015 05:25:13 +0000 (21:25 -0800)
This patch exposes a new ../iscsi/$IQN/$TPGT/dynamic_sessions attribute
to dump the currently active sessions by iSCSI InitiatorName that have
been created with dynamically generated se_node_acls.

This information is useful so that user-space can optionally perform
dynamic -> explicit NodeACL conversion based on $INITIATOR_WWPN.

Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/iscsi/iscsi_target_configfs.c

index 48384b675e624b9b04011fe03750c11170961ef1..95a67f60407391ea008d5f91ce5975e03bc331b6 100644 (file)
@@ -1410,8 +1410,18 @@ out:
 
 TF_TPG_BASE_ATTR(lio_target, enable, S_IRUGO | S_IWUSR);
 
+static ssize_t lio_target_tpg_show_dynamic_sessions(
+       struct se_portal_group *se_tpg,
+       char *page)
+{
+       return target_show_dynamic_sessions(se_tpg, page);
+}
+
+TF_TPG_BASE_ATTR_RO(lio_target, dynamic_sessions);
+
 static struct configfs_attribute *lio_target_tpg_attrs[] = {
        &lio_target_tpg_enable.attr,
+       &lio_target_tpg_dynamic_sessions.attr,
        NULL,
 };