1 /*******************************************************************************
2 * This file contains the configfs implementation for iSCSI Target mode
3 * from the LIO-Target Project.
5 * \u00a9 Copyright 2007-2011 RisingTide Systems LLC.
7 * Licensed to the Linux Foundation under the General Public License (GPL) version 2.
9 * Author: Nicholas A. Bellinger <nab@linux-iscsi.org>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 ****************************************************************************/
22 #include <linux/configfs.h>
23 #include <linux/ctype.h>
24 #include <linux/export.h>
25 #include <linux/inet.h>
26 #include <target/target_core_base.h>
27 #include <target/target_core_fabric.h>
28 #include <target/target_core_fabric_configfs.h>
29 #include <target/target_core_configfs.h>
30 #include <target/configfs_macros.h>
31 #include <target/iscsi/iscsi_transport.h>
33 #include "iscsi_target_core.h"
34 #include "iscsi_target_parameters.h"
35 #include "iscsi_target_device.h"
36 #include "iscsi_target_erl0.h"
37 #include "iscsi_target_nodeattrib.h"
38 #include "iscsi_target_tpg.h"
39 #include "iscsi_target_util.h"
40 #include "iscsi_target.h"
41 #include "iscsi_target_stat.h"
42 #include "iscsi_target_configfs.h"
44 struct target_fabric_configfs *lio_target_fabric_configfs;
46 struct lio_target_configfs_attribute {
47 struct configfs_attribute attr;
48 ssize_t (*show)(void *, char *);
49 ssize_t (*store)(void *, const char *, size_t);
52 /* Start items for lio_target_portal_cit */
54 static ssize_t lio_target_np_show_sctp(
55 struct se_tpg_np *se_tpg_np,
58 struct iscsi_tpg_np *tpg_np = container_of(se_tpg_np,
59 struct iscsi_tpg_np, se_tpg_np);
60 struct iscsi_tpg_np *tpg_np_sctp;
63 tpg_np_sctp = iscsit_tpg_locate_child_np(tpg_np, ISCSI_SCTP_TCP);
65 rb = sprintf(page, "1\n");
67 rb = sprintf(page, "0\n");
72 static ssize_t lio_target_np_store_sctp(
73 struct se_tpg_np *se_tpg_np,
78 struct iscsi_portal_group *tpg;
79 struct iscsi_tpg_np *tpg_np = container_of(se_tpg_np,
80 struct iscsi_tpg_np, se_tpg_np);
81 struct iscsi_tpg_np *tpg_np_sctp = NULL;
85 ret = kstrtou32(page, 0, &op);
88 if ((op != 1) && (op != 0)) {
89 pr_err("Illegal value for tpg_enable: %u\n", op);
94 pr_err("Unable to locate struct iscsi_np from"
95 " struct iscsi_tpg_np\n");
100 if (iscsit_get_tpg(tpg) < 0)
105 * Use existing np->np_sockaddr for SCTP network portal reference
107 tpg_np_sctp = iscsit_tpg_add_network_portal(tpg, &np->np_sockaddr,
108 np->np_ip, tpg_np, ISCSI_SCTP_TCP);
109 if (!tpg_np_sctp || IS_ERR(tpg_np_sctp))
112 tpg_np_sctp = iscsit_tpg_locate_child_np(tpg_np, ISCSI_SCTP_TCP);
116 ret = iscsit_tpg_del_network_portal(tpg, tpg_np_sctp);
128 TF_NP_BASE_ATTR(lio_target, sctp, S_IRUGO | S_IWUSR);
130 static ssize_t lio_target_np_show_iser(
131 struct se_tpg_np *se_tpg_np,
134 struct iscsi_tpg_np *tpg_np = container_of(se_tpg_np,
135 struct iscsi_tpg_np, se_tpg_np);
136 struct iscsi_tpg_np *tpg_np_iser;
139 tpg_np_iser = iscsit_tpg_locate_child_np(tpg_np, ISCSI_INFINIBAND);
141 rb = sprintf(page, "1\n");
143 rb = sprintf(page, "0\n");
148 static ssize_t lio_target_np_store_iser(
149 struct se_tpg_np *se_tpg_np,
154 struct iscsi_portal_group *tpg;
155 struct iscsi_tpg_np *tpg_np = container_of(se_tpg_np,
156 struct iscsi_tpg_np, se_tpg_np);
157 struct iscsi_tpg_np *tpg_np_iser = NULL;
162 op = simple_strtoul(page, &endptr, 0);
163 if ((op != 1) && (op != 0)) {
164 pr_err("Illegal value for tpg_enable: %u\n", op);
169 pr_err("Unable to locate struct iscsi_np from"
170 " struct iscsi_tpg_np\n");
175 if (iscsit_get_tpg(tpg) < 0)
179 rc = request_module("ib_isert");
181 pr_warn("Unable to request_module for ib_isert\n");
185 tpg_np_iser = iscsit_tpg_add_network_portal(tpg, &np->np_sockaddr,
186 np->np_ip, tpg_np, ISCSI_INFINIBAND);
187 if (IS_ERR(tpg_np_iser)) {
188 rc = PTR_ERR(tpg_np_iser);
192 tpg_np_iser = iscsit_tpg_locate_child_np(tpg_np, ISCSI_INFINIBAND);
194 rc = iscsit_tpg_del_network_portal(tpg, tpg_np_iser);
207 TF_NP_BASE_ATTR(lio_target, iser, S_IRUGO | S_IWUSR);
209 static struct configfs_attribute *lio_target_portal_attrs[] = {
210 &lio_target_np_sctp.attr,
211 &lio_target_np_iser.attr,
215 /* Stop items for lio_target_portal_cit */
217 /* Start items for lio_target_np_cit */
219 #define MAX_PORTAL_LEN 256
221 static struct se_tpg_np *lio_target_call_addnptotpg(
222 struct se_portal_group *se_tpg,
223 struct config_group *group,
226 struct iscsi_portal_group *tpg;
227 struct iscsi_tpg_np *tpg_np;
228 char *str, *str2, *ip_str, *port_str;
229 struct __kernel_sockaddr_storage sockaddr;
230 struct sockaddr_in *sock_in;
231 struct sockaddr_in6 *sock_in6;
234 char buf[MAX_PORTAL_LEN + 1];
236 if (strlen(name) > MAX_PORTAL_LEN) {
237 pr_err("strlen(name): %d exceeds MAX_PORTAL_LEN: %d\n",
238 (int)strlen(name), MAX_PORTAL_LEN);
239 return ERR_PTR(-EOVERFLOW);
241 memset(buf, 0, MAX_PORTAL_LEN + 1);
242 snprintf(buf, MAX_PORTAL_LEN + 1, "%s", name);
244 memset(&sockaddr, 0, sizeof(struct __kernel_sockaddr_storage));
246 str = strstr(buf, "[");
250 str2 = strstr(str, "]");
252 pr_err("Unable to locate trailing \"]\""
253 " in IPv6 iSCSI network portal address\n");
254 return ERR_PTR(-EINVAL);
256 str++; /* Skip over leading "[" */
257 *str2 = '\0'; /* Terminate the IPv6 address */
258 str2++; /* Skip over the "]" */
259 port_str = strstr(str2, ":");
261 pr_err("Unable to locate \":port\""
262 " in IPv6 iSCSI network portal address\n");
263 return ERR_PTR(-EINVAL);
265 *port_str = '\0'; /* Terminate string for IP */
266 port_str++; /* Skip over ":" */
268 ret = strict_strtoul(port_str, 0, &port);
270 pr_err("strict_strtoul() failed for port_str: %d\n", ret);
273 sock_in6 = (struct sockaddr_in6 *)&sockaddr;
274 sock_in6->sin6_family = AF_INET6;
275 sock_in6->sin6_port = htons((unsigned short)port);
276 ret = in6_pton(str, IPV6_ADDRESS_SPACE,
277 (void *)&sock_in6->sin6_addr.in6_u, -1, &end);
279 pr_err("in6_pton returned: %d\n", ret);
280 return ERR_PTR(-EINVAL);
283 str = ip_str = &buf[0];
284 port_str = strstr(ip_str, ":");
286 pr_err("Unable to locate \":port\""
287 " in IPv4 iSCSI network portal address\n");
288 return ERR_PTR(-EINVAL);
290 *port_str = '\0'; /* Terminate string for IP */
291 port_str++; /* Skip over ":" */
293 ret = strict_strtoul(port_str, 0, &port);
295 pr_err("strict_strtoul() failed for port_str: %d\n", ret);
298 sock_in = (struct sockaddr_in *)&sockaddr;
299 sock_in->sin_family = AF_INET;
300 sock_in->sin_port = htons((unsigned short)port);
301 sock_in->sin_addr.s_addr = in_aton(ip_str);
303 tpg = container_of(se_tpg, struct iscsi_portal_group, tpg_se_tpg);
304 ret = iscsit_get_tpg(tpg);
306 return ERR_PTR(-EINVAL);
308 pr_debug("LIO_Target_ConfigFS: REGISTER -> %s TPGT: %hu"
310 config_item_name(&se_tpg->se_tpg_wwn->wwn_group.cg_item),
313 * Assume ISCSI_TCP by default. Other network portals for other
316 * Traditional iSCSI over SCTP (initial support)
317 * iSER/TCP (TODO, hardware available)
318 * iSER/SCTP (TODO, software emulation with osc-iwarp)
319 * iSER/IB (TODO, hardware available)
321 * can be enabled with attributes under
322 * sys/kernel/config/iscsi/$IQN/$TPG/np/$IP:$PORT/
325 tpg_np = iscsit_tpg_add_network_portal(tpg, &sockaddr, str, NULL,
327 if (IS_ERR(tpg_np)) {
329 return ERR_CAST(tpg_np);
331 pr_debug("LIO_Target_ConfigFS: addnptotpg done!\n");
334 return &tpg_np->se_tpg_np;
337 static void lio_target_call_delnpfromtpg(
338 struct se_tpg_np *se_tpg_np)
340 struct iscsi_portal_group *tpg;
341 struct iscsi_tpg_np *tpg_np;
342 struct se_portal_group *se_tpg;
345 tpg_np = container_of(se_tpg_np, struct iscsi_tpg_np, se_tpg_np);
347 ret = iscsit_get_tpg(tpg);
351 se_tpg = &tpg->tpg_se_tpg;
352 pr_debug("LIO_Target_ConfigFS: DEREGISTER -> %s TPGT: %hu"
353 " PORTAL: %s:%hu\n", config_item_name(&se_tpg->se_tpg_wwn->wwn_group.cg_item),
354 tpg->tpgt, tpg_np->tpg_np->np_ip, tpg_np->tpg_np->np_port);
356 ret = iscsit_tpg_del_network_portal(tpg, tpg_np);
360 pr_debug("LIO_Target_ConfigFS: delnpfromtpg done!\n");
365 /* End items for lio_target_np_cit */
367 /* Start items for lio_target_nacl_attrib_cit */
369 #define DEF_NACL_ATTRIB(name) \
370 static ssize_t iscsi_nacl_attrib_show_##name( \
371 struct se_node_acl *se_nacl, \
374 struct iscsi_node_acl *nacl = container_of(se_nacl, struct iscsi_node_acl, \
377 return sprintf(page, "%u\n", ISCSI_NODE_ATTRIB(nacl)->name); \
380 static ssize_t iscsi_nacl_attrib_store_##name( \
381 struct se_node_acl *se_nacl, \
385 struct iscsi_node_acl *nacl = container_of(se_nacl, struct iscsi_node_acl, \
390 ret = kstrtou32(page, 0, &val); \
393 ret = iscsit_na_##name(nacl, val); \
400 #define NACL_ATTR(_name, _mode) TF_NACL_ATTRIB_ATTR(iscsi, _name, _mode);
402 * Define iscsi_node_attrib_s_dataout_timeout
404 DEF_NACL_ATTRIB(dataout_timeout);
405 NACL_ATTR(dataout_timeout, S_IRUGO | S_IWUSR);
407 * Define iscsi_node_attrib_s_dataout_timeout_retries
409 DEF_NACL_ATTRIB(dataout_timeout_retries);
410 NACL_ATTR(dataout_timeout_retries, S_IRUGO | S_IWUSR);
412 * Define iscsi_node_attrib_s_default_erl
414 DEF_NACL_ATTRIB(default_erl);
415 NACL_ATTR(default_erl, S_IRUGO | S_IWUSR);
417 * Define iscsi_node_attrib_s_nopin_timeout
419 DEF_NACL_ATTRIB(nopin_timeout);
420 NACL_ATTR(nopin_timeout, S_IRUGO | S_IWUSR);
422 * Define iscsi_node_attrib_s_nopin_response_timeout
424 DEF_NACL_ATTRIB(nopin_response_timeout);
425 NACL_ATTR(nopin_response_timeout, S_IRUGO | S_IWUSR);
427 * Define iscsi_node_attrib_s_random_datain_pdu_offsets
429 DEF_NACL_ATTRIB(random_datain_pdu_offsets);
430 NACL_ATTR(random_datain_pdu_offsets, S_IRUGO | S_IWUSR);
432 * Define iscsi_node_attrib_s_random_datain_seq_offsets
434 DEF_NACL_ATTRIB(random_datain_seq_offsets);
435 NACL_ATTR(random_datain_seq_offsets, S_IRUGO | S_IWUSR);
437 * Define iscsi_node_attrib_s_random_r2t_offsets
439 DEF_NACL_ATTRIB(random_r2t_offsets);
440 NACL_ATTR(random_r2t_offsets, S_IRUGO | S_IWUSR);
442 static struct configfs_attribute *lio_target_nacl_attrib_attrs[] = {
443 &iscsi_nacl_attrib_dataout_timeout.attr,
444 &iscsi_nacl_attrib_dataout_timeout_retries.attr,
445 &iscsi_nacl_attrib_default_erl.attr,
446 &iscsi_nacl_attrib_nopin_timeout.attr,
447 &iscsi_nacl_attrib_nopin_response_timeout.attr,
448 &iscsi_nacl_attrib_random_datain_pdu_offsets.attr,
449 &iscsi_nacl_attrib_random_datain_seq_offsets.attr,
450 &iscsi_nacl_attrib_random_r2t_offsets.attr,
454 /* End items for lio_target_nacl_attrib_cit */
456 /* Start items for lio_target_nacl_auth_cit */
458 #define __DEF_NACL_AUTH_STR(prefix, name, flags) \
459 static ssize_t __iscsi_##prefix##_show_##name( \
460 struct iscsi_node_acl *nacl, \
463 struct iscsi_node_auth *auth = &nacl->node_auth; \
465 if (!capable(CAP_SYS_ADMIN)) \
467 return snprintf(page, PAGE_SIZE, "%s\n", auth->name); \
470 static ssize_t __iscsi_##prefix##_store_##name( \
471 struct iscsi_node_acl *nacl, \
475 struct iscsi_node_auth *auth = &nacl->node_auth; \
477 if (!capable(CAP_SYS_ADMIN)) \
480 snprintf(auth->name, sizeof(auth->name), "%s", page); \
481 if (!strncmp("NULL", auth->name, 4)) \
482 auth->naf_flags &= ~flags; \
484 auth->naf_flags |= flags; \
486 if ((auth->naf_flags & NAF_USERID_IN_SET) && \
487 (auth->naf_flags & NAF_PASSWORD_IN_SET)) \
488 auth->authenticate_target = 1; \
490 auth->authenticate_target = 0; \
495 #define __DEF_NACL_AUTH_INT(prefix, name) \
496 static ssize_t __iscsi_##prefix##_show_##name( \
497 struct iscsi_node_acl *nacl, \
500 struct iscsi_node_auth *auth = &nacl->node_auth; \
502 if (!capable(CAP_SYS_ADMIN)) \
505 return snprintf(page, PAGE_SIZE, "%d\n", auth->name); \
508 #define DEF_NACL_AUTH_STR(name, flags) \
509 __DEF_NACL_AUTH_STR(nacl_auth, name, flags) \
510 static ssize_t iscsi_nacl_auth_show_##name( \
511 struct se_node_acl *nacl, \
514 return __iscsi_nacl_auth_show_##name(container_of(nacl, \
515 struct iscsi_node_acl, se_node_acl), page); \
517 static ssize_t iscsi_nacl_auth_store_##name( \
518 struct se_node_acl *nacl, \
522 return __iscsi_nacl_auth_store_##name(container_of(nacl, \
523 struct iscsi_node_acl, se_node_acl), page, count); \
526 #define DEF_NACL_AUTH_INT(name) \
527 __DEF_NACL_AUTH_INT(nacl_auth, name) \
528 static ssize_t iscsi_nacl_auth_show_##name( \
529 struct se_node_acl *nacl, \
532 return __iscsi_nacl_auth_show_##name(container_of(nacl, \
533 struct iscsi_node_acl, se_node_acl), page); \
536 #define AUTH_ATTR(_name, _mode) TF_NACL_AUTH_ATTR(iscsi, _name, _mode);
537 #define AUTH_ATTR_RO(_name) TF_NACL_AUTH_ATTR_RO(iscsi, _name);
540 * One-way authentication userid
542 DEF_NACL_AUTH_STR(userid, NAF_USERID_SET);
543 AUTH_ATTR(userid, S_IRUGO | S_IWUSR);
545 * One-way authentication password
547 DEF_NACL_AUTH_STR(password, NAF_PASSWORD_SET);
548 AUTH_ATTR(password, S_IRUGO | S_IWUSR);
550 * Enforce mutual authentication
552 DEF_NACL_AUTH_INT(authenticate_target);
553 AUTH_ATTR_RO(authenticate_target);
555 * Mutual authentication userid
557 DEF_NACL_AUTH_STR(userid_mutual, NAF_USERID_IN_SET);
558 AUTH_ATTR(userid_mutual, S_IRUGO | S_IWUSR);
560 * Mutual authentication password
562 DEF_NACL_AUTH_STR(password_mutual, NAF_PASSWORD_IN_SET);
563 AUTH_ATTR(password_mutual, S_IRUGO | S_IWUSR);
565 static struct configfs_attribute *lio_target_nacl_auth_attrs[] = {
566 &iscsi_nacl_auth_userid.attr,
567 &iscsi_nacl_auth_password.attr,
568 &iscsi_nacl_auth_authenticate_target.attr,
569 &iscsi_nacl_auth_userid_mutual.attr,
570 &iscsi_nacl_auth_password_mutual.attr,
574 /* End items for lio_target_nacl_auth_cit */
576 /* Start items for lio_target_nacl_param_cit */
578 #define DEF_NACL_PARAM(name) \
579 static ssize_t iscsi_nacl_param_show_##name( \
580 struct se_node_acl *se_nacl, \
583 struct iscsi_session *sess; \
584 struct se_session *se_sess; \
587 spin_lock_bh(&se_nacl->nacl_sess_lock); \
588 se_sess = se_nacl->nacl_sess; \
590 rb = snprintf(page, PAGE_SIZE, \
591 "No Active iSCSI Session\n"); \
593 sess = se_sess->fabric_sess_ptr; \
594 rb = snprintf(page, PAGE_SIZE, "%u\n", \
595 (u32)sess->sess_ops->name); \
597 spin_unlock_bh(&se_nacl->nacl_sess_lock); \
602 #define NACL_PARAM_ATTR(_name) TF_NACL_PARAM_ATTR_RO(iscsi, _name);
604 DEF_NACL_PARAM(MaxConnections);
605 NACL_PARAM_ATTR(MaxConnections);
607 DEF_NACL_PARAM(InitialR2T);
608 NACL_PARAM_ATTR(InitialR2T);
610 DEF_NACL_PARAM(ImmediateData);
611 NACL_PARAM_ATTR(ImmediateData);
613 DEF_NACL_PARAM(MaxBurstLength);
614 NACL_PARAM_ATTR(MaxBurstLength);
616 DEF_NACL_PARAM(FirstBurstLength);
617 NACL_PARAM_ATTR(FirstBurstLength);
619 DEF_NACL_PARAM(DefaultTime2Wait);
620 NACL_PARAM_ATTR(DefaultTime2Wait);
622 DEF_NACL_PARAM(DefaultTime2Retain);
623 NACL_PARAM_ATTR(DefaultTime2Retain);
625 DEF_NACL_PARAM(MaxOutstandingR2T);
626 NACL_PARAM_ATTR(MaxOutstandingR2T);
628 DEF_NACL_PARAM(DataPDUInOrder);
629 NACL_PARAM_ATTR(DataPDUInOrder);
631 DEF_NACL_PARAM(DataSequenceInOrder);
632 NACL_PARAM_ATTR(DataSequenceInOrder);
634 DEF_NACL_PARAM(ErrorRecoveryLevel);
635 NACL_PARAM_ATTR(ErrorRecoveryLevel);
637 static struct configfs_attribute *lio_target_nacl_param_attrs[] = {
638 &iscsi_nacl_param_MaxConnections.attr,
639 &iscsi_nacl_param_InitialR2T.attr,
640 &iscsi_nacl_param_ImmediateData.attr,
641 &iscsi_nacl_param_MaxBurstLength.attr,
642 &iscsi_nacl_param_FirstBurstLength.attr,
643 &iscsi_nacl_param_DefaultTime2Wait.attr,
644 &iscsi_nacl_param_DefaultTime2Retain.attr,
645 &iscsi_nacl_param_MaxOutstandingR2T.attr,
646 &iscsi_nacl_param_DataPDUInOrder.attr,
647 &iscsi_nacl_param_DataSequenceInOrder.attr,
648 &iscsi_nacl_param_ErrorRecoveryLevel.attr,
652 /* End items for lio_target_nacl_param_cit */
654 /* Start items for lio_target_acl_cit */
656 static ssize_t lio_target_nacl_show_info(
657 struct se_node_acl *se_nacl,
660 struct iscsi_session *sess;
661 struct iscsi_conn *conn;
662 struct se_session *se_sess;
665 spin_lock_bh(&se_nacl->nacl_sess_lock);
666 se_sess = se_nacl->nacl_sess;
668 rb += sprintf(page+rb, "No active iSCSI Session for Initiator"
669 " Endpoint: %s\n", se_nacl->initiatorname);
671 sess = se_sess->fabric_sess_ptr;
673 if (sess->sess_ops->InitiatorName)
674 rb += sprintf(page+rb, "InitiatorName: %s\n",
675 sess->sess_ops->InitiatorName);
676 if (sess->sess_ops->InitiatorAlias)
677 rb += sprintf(page+rb, "InitiatorAlias: %s\n",
678 sess->sess_ops->InitiatorAlias);
680 rb += sprintf(page+rb, "LIO Session ID: %u "
681 "ISID: 0x%02x %02x %02x %02x %02x %02x "
682 "TSIH: %hu ", sess->sid,
683 sess->isid[0], sess->isid[1], sess->isid[2],
684 sess->isid[3], sess->isid[4], sess->isid[5],
686 rb += sprintf(page+rb, "SessionType: %s\n",
687 (sess->sess_ops->SessionType) ?
688 "Discovery" : "Normal");
689 rb += sprintf(page+rb, "Session State: ");
690 switch (sess->session_state) {
691 case TARG_SESS_STATE_FREE:
692 rb += sprintf(page+rb, "TARG_SESS_FREE\n");
694 case TARG_SESS_STATE_ACTIVE:
695 rb += sprintf(page+rb, "TARG_SESS_STATE_ACTIVE\n");
697 case TARG_SESS_STATE_LOGGED_IN:
698 rb += sprintf(page+rb, "TARG_SESS_STATE_LOGGED_IN\n");
700 case TARG_SESS_STATE_FAILED:
701 rb += sprintf(page+rb, "TARG_SESS_STATE_FAILED\n");
703 case TARG_SESS_STATE_IN_CONTINUE:
704 rb += sprintf(page+rb, "TARG_SESS_STATE_IN_CONTINUE\n");
707 rb += sprintf(page+rb, "ERROR: Unknown Session"
712 rb += sprintf(page+rb, "---------------------[iSCSI Session"
713 " Values]-----------------------\n");
714 rb += sprintf(page+rb, " CmdSN/WR : CmdSN/WC : ExpCmdSN"
715 " : MaxCmdSN : ITT : TTT\n");
716 rb += sprintf(page+rb, " 0x%08x 0x%08x 0x%08x 0x%08x"
719 (sess->max_cmd_sn - sess->exp_cmd_sn) + 1,
720 sess->exp_cmd_sn, sess->max_cmd_sn,
721 sess->init_task_tag, sess->targ_xfer_tag);
722 rb += sprintf(page+rb, "----------------------[iSCSI"
723 " Connections]-------------------------\n");
725 spin_lock(&sess->conn_lock);
726 list_for_each_entry(conn, &sess->sess_conn_list, conn_list) {
727 rb += sprintf(page+rb, "CID: %hu Connection"
728 " State: ", conn->cid);
729 switch (conn->conn_state) {
730 case TARG_CONN_STATE_FREE:
731 rb += sprintf(page+rb,
732 "TARG_CONN_STATE_FREE\n");
734 case TARG_CONN_STATE_XPT_UP:
735 rb += sprintf(page+rb,
736 "TARG_CONN_STATE_XPT_UP\n");
738 case TARG_CONN_STATE_IN_LOGIN:
739 rb += sprintf(page+rb,
740 "TARG_CONN_STATE_IN_LOGIN\n");
742 case TARG_CONN_STATE_LOGGED_IN:
743 rb += sprintf(page+rb,
744 "TARG_CONN_STATE_LOGGED_IN\n");
746 case TARG_CONN_STATE_IN_LOGOUT:
747 rb += sprintf(page+rb,
748 "TARG_CONN_STATE_IN_LOGOUT\n");
750 case TARG_CONN_STATE_LOGOUT_REQUESTED:
751 rb += sprintf(page+rb,
752 "TARG_CONN_STATE_LOGOUT_REQUESTED\n");
754 case TARG_CONN_STATE_CLEANUP_WAIT:
755 rb += sprintf(page+rb,
756 "TARG_CONN_STATE_CLEANUP_WAIT\n");
759 rb += sprintf(page+rb,
760 "ERROR: Unknown Connection State!\n");
764 rb += sprintf(page+rb, " Address %s %s", conn->login_ip,
765 (conn->network_transport == ISCSI_TCP) ?
767 rb += sprintf(page+rb, " StatSN: 0x%08x\n",
770 spin_unlock(&sess->conn_lock);
772 spin_unlock_bh(&se_nacl->nacl_sess_lock);
777 TF_NACL_BASE_ATTR_RO(lio_target, info);
779 static ssize_t lio_target_nacl_show_cmdsn_depth(
780 struct se_node_acl *se_nacl,
783 return sprintf(page, "%u\n", se_nacl->queue_depth);
786 static ssize_t lio_target_nacl_store_cmdsn_depth(
787 struct se_node_acl *se_nacl,
791 struct se_portal_group *se_tpg = se_nacl->se_tpg;
792 struct iscsi_portal_group *tpg = container_of(se_tpg,
793 struct iscsi_portal_group, tpg_se_tpg);
794 struct config_item *acl_ci, *tpg_ci, *wwn_ci;
798 ret = kstrtou32(page, 0, &cmdsn_depth);
801 if (cmdsn_depth > TA_DEFAULT_CMDSN_DEPTH_MAX) {
802 pr_err("Passed cmdsn_depth: %u exceeds"
803 " TA_DEFAULT_CMDSN_DEPTH_MAX: %u\n", cmdsn_depth,
804 TA_DEFAULT_CMDSN_DEPTH_MAX);
807 acl_ci = &se_nacl->acl_group.cg_item;
809 pr_err("Unable to locatel acl_ci\n");
812 tpg_ci = &acl_ci->ci_parent->ci_group->cg_item;
814 pr_err("Unable to locate tpg_ci\n");
817 wwn_ci = &tpg_ci->ci_group->cg_item;
819 pr_err("Unable to locate config_item wwn_ci\n");
823 if (iscsit_get_tpg(tpg) < 0)
826 * iscsit_tpg_set_initiator_node_queue_depth() assumes force=1
828 ret = iscsit_tpg_set_initiator_node_queue_depth(tpg,
829 config_item_name(acl_ci), cmdsn_depth, 1);
831 pr_debug("LIO_Target_ConfigFS: %s/%s Set CmdSN Window: %u for"
832 "InitiatorName: %s\n", config_item_name(wwn_ci),
833 config_item_name(tpg_ci), cmdsn_depth,
834 config_item_name(acl_ci));
837 return (!ret) ? count : (ssize_t)ret;
840 TF_NACL_BASE_ATTR(lio_target, cmdsn_depth, S_IRUGO | S_IWUSR);
842 static ssize_t lio_target_nacl_show_tag(
843 struct se_node_acl *se_nacl,
846 return snprintf(page, PAGE_SIZE, "%s", se_nacl->acl_tag);
849 static ssize_t lio_target_nacl_store_tag(
850 struct se_node_acl *se_nacl,
856 ret = core_tpg_set_initiator_node_tag(se_nacl->se_tpg, se_nacl, page);
863 TF_NACL_BASE_ATTR(lio_target, tag, S_IRUGO | S_IWUSR);
865 static struct configfs_attribute *lio_target_initiator_attrs[] = {
866 &lio_target_nacl_info.attr,
867 &lio_target_nacl_cmdsn_depth.attr,
868 &lio_target_nacl_tag.attr,
872 static struct se_node_acl *lio_tpg_alloc_fabric_acl(
873 struct se_portal_group *se_tpg)
875 struct iscsi_node_acl *acl;
877 acl = kzalloc(sizeof(struct iscsi_node_acl), GFP_KERNEL);
879 pr_err("Unable to allocate memory for struct iscsi_node_acl\n");
883 return &acl->se_node_acl;
886 static struct se_node_acl *lio_target_make_nodeacl(
887 struct se_portal_group *se_tpg,
888 struct config_group *group,
891 struct config_group *stats_cg;
892 struct iscsi_node_acl *acl;
893 struct se_node_acl *se_nacl_new, *se_nacl;
894 struct iscsi_portal_group *tpg = container_of(se_tpg,
895 struct iscsi_portal_group, tpg_se_tpg);
898 se_nacl_new = lio_tpg_alloc_fabric_acl(se_tpg);
900 return ERR_PTR(-ENOMEM);
902 cmdsn_depth = ISCSI_TPG_ATTRIB(tpg)->default_cmdsn_depth;
904 * se_nacl_new may be released by core_tpg_add_initiator_node_acl()
905 * when converting a NdoeACL from demo mode -> explict
907 se_nacl = core_tpg_add_initiator_node_acl(se_tpg, se_nacl_new,
912 acl = container_of(se_nacl, struct iscsi_node_acl, se_node_acl);
913 stats_cg = &se_nacl->acl_fabric_stat_group;
915 stats_cg->default_groups = kmalloc(sizeof(struct config_group *) * 2,
917 if (!stats_cg->default_groups) {
918 pr_err("Unable to allocate memory for"
919 " stats_cg->default_groups\n");
920 core_tpg_del_initiator_node_acl(se_tpg, se_nacl, 1);
922 return ERR_PTR(-ENOMEM);
925 stats_cg->default_groups[0] = &NODE_STAT_GRPS(acl)->iscsi_sess_stats_group;
926 stats_cg->default_groups[1] = NULL;
927 config_group_init_type_name(&NODE_STAT_GRPS(acl)->iscsi_sess_stats_group,
928 "iscsi_sess_stats", &iscsi_stat_sess_cit);
933 static void lio_target_drop_nodeacl(
934 struct se_node_acl *se_nacl)
936 struct se_portal_group *se_tpg = se_nacl->se_tpg;
937 struct iscsi_node_acl *acl = container_of(se_nacl,
938 struct iscsi_node_acl, se_node_acl);
939 struct config_item *df_item;
940 struct config_group *stats_cg;
943 stats_cg = &acl->se_node_acl.acl_fabric_stat_group;
944 for (i = 0; stats_cg->default_groups[i]; i++) {
945 df_item = &stats_cg->default_groups[i]->cg_item;
946 stats_cg->default_groups[i] = NULL;
947 config_item_put(df_item);
949 kfree(stats_cg->default_groups);
951 core_tpg_del_initiator_node_acl(se_tpg, se_nacl, 1);
955 /* End items for lio_target_acl_cit */
957 /* Start items for lio_target_tpg_attrib_cit */
959 #define DEF_TPG_ATTRIB(name) \
961 static ssize_t iscsi_tpg_attrib_show_##name( \
962 struct se_portal_group *se_tpg, \
965 struct iscsi_portal_group *tpg = container_of(se_tpg, \
966 struct iscsi_portal_group, tpg_se_tpg); \
969 if (iscsit_get_tpg(tpg) < 0) \
972 rb = sprintf(page, "%u\n", ISCSI_TPG_ATTRIB(tpg)->name); \
973 iscsit_put_tpg(tpg); \
977 static ssize_t iscsi_tpg_attrib_store_##name( \
978 struct se_portal_group *se_tpg, \
982 struct iscsi_portal_group *tpg = container_of(se_tpg, \
983 struct iscsi_portal_group, tpg_se_tpg); \
987 if (iscsit_get_tpg(tpg) < 0) \
990 ret = kstrtou32(page, 0, &val); \
993 ret = iscsit_ta_##name(tpg, val); \
997 iscsit_put_tpg(tpg); \
1000 iscsit_put_tpg(tpg); \
1004 #define TPG_ATTR(_name, _mode) TF_TPG_ATTRIB_ATTR(iscsi, _name, _mode);
1007 * Define iscsi_tpg_attrib_s_authentication
1009 DEF_TPG_ATTRIB(authentication);
1010 TPG_ATTR(authentication, S_IRUGO | S_IWUSR);
1012 * Define iscsi_tpg_attrib_s_login_timeout
1014 DEF_TPG_ATTRIB(login_timeout);
1015 TPG_ATTR(login_timeout, S_IRUGO | S_IWUSR);
1017 * Define iscsi_tpg_attrib_s_netif_timeout
1019 DEF_TPG_ATTRIB(netif_timeout);
1020 TPG_ATTR(netif_timeout, S_IRUGO | S_IWUSR);
1022 * Define iscsi_tpg_attrib_s_generate_node_acls
1024 DEF_TPG_ATTRIB(generate_node_acls);
1025 TPG_ATTR(generate_node_acls, S_IRUGO | S_IWUSR);
1027 * Define iscsi_tpg_attrib_s_default_cmdsn_depth
1029 DEF_TPG_ATTRIB(default_cmdsn_depth);
1030 TPG_ATTR(default_cmdsn_depth, S_IRUGO | S_IWUSR);
1032 Define iscsi_tpg_attrib_s_cache_dynamic_acls
1034 DEF_TPG_ATTRIB(cache_dynamic_acls);
1035 TPG_ATTR(cache_dynamic_acls, S_IRUGO | S_IWUSR);
1037 * Define iscsi_tpg_attrib_s_demo_mode_write_protect
1039 DEF_TPG_ATTRIB(demo_mode_write_protect);
1040 TPG_ATTR(demo_mode_write_protect, S_IRUGO | S_IWUSR);
1042 * Define iscsi_tpg_attrib_s_prod_mode_write_protect
1044 DEF_TPG_ATTRIB(prod_mode_write_protect);
1045 TPG_ATTR(prod_mode_write_protect, S_IRUGO | S_IWUSR);
1047 static struct configfs_attribute *lio_target_tpg_attrib_attrs[] = {
1048 &iscsi_tpg_attrib_authentication.attr,
1049 &iscsi_tpg_attrib_login_timeout.attr,
1050 &iscsi_tpg_attrib_netif_timeout.attr,
1051 &iscsi_tpg_attrib_generate_node_acls.attr,
1052 &iscsi_tpg_attrib_default_cmdsn_depth.attr,
1053 &iscsi_tpg_attrib_cache_dynamic_acls.attr,
1054 &iscsi_tpg_attrib_demo_mode_write_protect.attr,
1055 &iscsi_tpg_attrib_prod_mode_write_protect.attr,
1059 /* End items for lio_target_tpg_attrib_cit */
1061 /* Start items for lio_target_tpg_auth_cit */
1063 #define __DEF_TPG_AUTH_STR(prefix, name, flags) \
1064 static ssize_t __iscsi_##prefix##_show_##name( \
1065 struct se_portal_group *se_tpg, \
1068 struct iscsi_portal_group *tpg = container_of(se_tpg, \
1069 struct iscsi_portal_group, tpg_se_tpg); \
1070 struct iscsi_node_auth *auth = &tpg->tpg_demo_auth; \
1072 if (!capable(CAP_SYS_ADMIN)) \
1075 return snprintf(page, PAGE_SIZE, "%s\n", auth->name); \
1078 static ssize_t __iscsi_##prefix##_store_##name( \
1079 struct se_portal_group *se_tpg, \
1083 struct iscsi_portal_group *tpg = container_of(se_tpg, \
1084 struct iscsi_portal_group, tpg_se_tpg); \
1085 struct iscsi_node_auth *auth = &tpg->tpg_demo_auth; \
1087 if (!capable(CAP_SYS_ADMIN)) \
1090 snprintf(auth->name, sizeof(auth->name), "%s", page); \
1091 if (!(strncmp("NULL", auth->name, 4))) \
1092 auth->naf_flags &= ~flags; \
1094 auth->naf_flags |= flags; \
1096 if ((auth->naf_flags & NAF_USERID_IN_SET) && \
1097 (auth->naf_flags & NAF_PASSWORD_IN_SET)) \
1098 auth->authenticate_target = 1; \
1100 auth->authenticate_target = 0; \
1105 #define __DEF_TPG_AUTH_INT(prefix, name) \
1106 static ssize_t __iscsi_##prefix##_show_##name( \
1107 struct se_portal_group *se_tpg, \
1110 struct iscsi_portal_group *tpg = container_of(se_tpg, \
1111 struct iscsi_portal_group, tpg_se_tpg); \
1112 struct iscsi_node_auth *auth = &tpg->tpg_demo_auth; \
1114 if (!capable(CAP_SYS_ADMIN)) \
1117 return snprintf(page, PAGE_SIZE, "%d\n", auth->name); \
1120 #define DEF_TPG_AUTH_STR(name, flags) \
1121 __DEF_TPG_AUTH_STR(tpg_auth, name, flags) \
1122 static ssize_t iscsi_tpg_auth_show_##name( \
1123 struct se_portal_group *se_tpg, \
1126 return __iscsi_tpg_auth_show_##name(se_tpg, page); \
1129 static ssize_t iscsi_tpg_auth_store_##name( \
1130 struct se_portal_group *se_tpg, \
1134 return __iscsi_tpg_auth_store_##name(se_tpg, page, count); \
1137 #define DEF_TPG_AUTH_INT(name) \
1138 __DEF_TPG_AUTH_INT(tpg_auth, name) \
1139 static ssize_t iscsi_tpg_auth_show_##name( \
1140 struct se_portal_group *se_tpg, \
1143 return __iscsi_tpg_auth_show_##name(se_tpg, page); \
1146 #define TPG_AUTH_ATTR(_name, _mode) TF_TPG_AUTH_ATTR(iscsi, _name, _mode);
1147 #define TPG_AUTH_ATTR_RO(_name) TF_TPG_AUTH_ATTR_RO(iscsi, _name);
1150 * * One-way authentication userid
1152 DEF_TPG_AUTH_STR(userid, NAF_USERID_SET);
1153 TPG_AUTH_ATTR(userid, S_IRUGO | S_IWUSR);
1155 * * One-way authentication password
1157 DEF_TPG_AUTH_STR(password, NAF_PASSWORD_SET);
1158 TPG_AUTH_ATTR(password, S_IRUGO | S_IWUSR);
1160 * * Enforce mutual authentication
1162 DEF_TPG_AUTH_INT(authenticate_target);
1163 TPG_AUTH_ATTR_RO(authenticate_target);
1165 * * Mutual authentication userid
1167 DEF_TPG_AUTH_STR(userid_mutual, NAF_USERID_IN_SET);
1168 TPG_AUTH_ATTR(userid_mutual, S_IRUGO | S_IWUSR);
1170 * * Mutual authentication password
1172 DEF_TPG_AUTH_STR(password_mutual, NAF_PASSWORD_IN_SET);
1173 TPG_AUTH_ATTR(password_mutual, S_IRUGO | S_IWUSR);
1175 static struct configfs_attribute *lio_target_tpg_auth_attrs[] = {
1176 &iscsi_tpg_auth_userid.attr,
1177 &iscsi_tpg_auth_password.attr,
1178 &iscsi_tpg_auth_authenticate_target.attr,
1179 &iscsi_tpg_auth_userid_mutual.attr,
1180 &iscsi_tpg_auth_password_mutual.attr,
1184 /* End items for lio_target_tpg_auth_cit */
1186 /* Start items for lio_target_tpg_param_cit */
1188 #define DEF_TPG_PARAM(name) \
1189 static ssize_t iscsi_tpg_param_show_##name( \
1190 struct se_portal_group *se_tpg, \
1193 struct iscsi_portal_group *tpg = container_of(se_tpg, \
1194 struct iscsi_portal_group, tpg_se_tpg); \
1195 struct iscsi_param *param; \
1198 if (iscsit_get_tpg(tpg) < 0) \
1201 param = iscsi_find_param_from_key(__stringify(name), \
1204 iscsit_put_tpg(tpg); \
1207 rb = snprintf(page, PAGE_SIZE, "%s\n", param->value); \
1209 iscsit_put_tpg(tpg); \
1212 static ssize_t iscsi_tpg_param_store_##name( \
1213 struct se_portal_group *se_tpg, \
1217 struct iscsi_portal_group *tpg = container_of(se_tpg, \
1218 struct iscsi_portal_group, tpg_se_tpg); \
1222 buf = kzalloc(PAGE_SIZE, GFP_KERNEL); \
1225 len = snprintf(buf, PAGE_SIZE, "%s=%s", __stringify(name), page); \
1226 if (isspace(buf[len-1])) \
1227 buf[len-1] = '\0'; /* Kill newline */ \
1229 if (iscsit_get_tpg(tpg) < 0) { \
1234 ret = iscsi_change_param_value(buf, tpg->param_list, 1); \
1239 iscsit_put_tpg(tpg); \
1243 iscsit_put_tpg(tpg); \
1247 #define TPG_PARAM_ATTR(_name, _mode) TF_TPG_PARAM_ATTR(iscsi, _name, _mode);
1249 DEF_TPG_PARAM(AuthMethod);
1250 TPG_PARAM_ATTR(AuthMethod, S_IRUGO | S_IWUSR);
1252 DEF_TPG_PARAM(HeaderDigest);
1253 TPG_PARAM_ATTR(HeaderDigest, S_IRUGO | S_IWUSR);
1255 DEF_TPG_PARAM(DataDigest);
1256 TPG_PARAM_ATTR(DataDigest, S_IRUGO | S_IWUSR);
1258 DEF_TPG_PARAM(MaxConnections);
1259 TPG_PARAM_ATTR(MaxConnections, S_IRUGO | S_IWUSR);
1261 DEF_TPG_PARAM(TargetAlias);
1262 TPG_PARAM_ATTR(TargetAlias, S_IRUGO | S_IWUSR);
1264 DEF_TPG_PARAM(InitialR2T);
1265 TPG_PARAM_ATTR(InitialR2T, S_IRUGO | S_IWUSR);
1267 DEF_TPG_PARAM(ImmediateData);
1268 TPG_PARAM_ATTR(ImmediateData, S_IRUGO | S_IWUSR);
1270 DEF_TPG_PARAM(MaxRecvDataSegmentLength);
1271 TPG_PARAM_ATTR(MaxRecvDataSegmentLength, S_IRUGO | S_IWUSR);
1273 DEF_TPG_PARAM(MaxXmitDataSegmentLength);
1274 TPG_PARAM_ATTR(MaxXmitDataSegmentLength, S_IRUGO | S_IWUSR);
1276 DEF_TPG_PARAM(MaxBurstLength);
1277 TPG_PARAM_ATTR(MaxBurstLength, S_IRUGO | S_IWUSR);
1279 DEF_TPG_PARAM(FirstBurstLength);
1280 TPG_PARAM_ATTR(FirstBurstLength, S_IRUGO | S_IWUSR);
1282 DEF_TPG_PARAM(DefaultTime2Wait);
1283 TPG_PARAM_ATTR(DefaultTime2Wait, S_IRUGO | S_IWUSR);
1285 DEF_TPG_PARAM(DefaultTime2Retain);
1286 TPG_PARAM_ATTR(DefaultTime2Retain, S_IRUGO | S_IWUSR);
1288 DEF_TPG_PARAM(MaxOutstandingR2T);
1289 TPG_PARAM_ATTR(MaxOutstandingR2T, S_IRUGO | S_IWUSR);
1291 DEF_TPG_PARAM(DataPDUInOrder);
1292 TPG_PARAM_ATTR(DataPDUInOrder, S_IRUGO | S_IWUSR);
1294 DEF_TPG_PARAM(DataSequenceInOrder);
1295 TPG_PARAM_ATTR(DataSequenceInOrder, S_IRUGO | S_IWUSR);
1297 DEF_TPG_PARAM(ErrorRecoveryLevel);
1298 TPG_PARAM_ATTR(ErrorRecoveryLevel, S_IRUGO | S_IWUSR);
1300 DEF_TPG_PARAM(IFMarker);
1301 TPG_PARAM_ATTR(IFMarker, S_IRUGO | S_IWUSR);
1303 DEF_TPG_PARAM(OFMarker);
1304 TPG_PARAM_ATTR(OFMarker, S_IRUGO | S_IWUSR);
1306 DEF_TPG_PARAM(IFMarkInt);
1307 TPG_PARAM_ATTR(IFMarkInt, S_IRUGO | S_IWUSR);
1309 DEF_TPG_PARAM(OFMarkInt);
1310 TPG_PARAM_ATTR(OFMarkInt, S_IRUGO | S_IWUSR);
1312 static struct configfs_attribute *lio_target_tpg_param_attrs[] = {
1313 &iscsi_tpg_param_AuthMethod.attr,
1314 &iscsi_tpg_param_HeaderDigest.attr,
1315 &iscsi_tpg_param_DataDigest.attr,
1316 &iscsi_tpg_param_MaxConnections.attr,
1317 &iscsi_tpg_param_TargetAlias.attr,
1318 &iscsi_tpg_param_InitialR2T.attr,
1319 &iscsi_tpg_param_ImmediateData.attr,
1320 &iscsi_tpg_param_MaxRecvDataSegmentLength.attr,
1321 &iscsi_tpg_param_MaxXmitDataSegmentLength.attr,
1322 &iscsi_tpg_param_MaxBurstLength.attr,
1323 &iscsi_tpg_param_FirstBurstLength.attr,
1324 &iscsi_tpg_param_DefaultTime2Wait.attr,
1325 &iscsi_tpg_param_DefaultTime2Retain.attr,
1326 &iscsi_tpg_param_MaxOutstandingR2T.attr,
1327 &iscsi_tpg_param_DataPDUInOrder.attr,
1328 &iscsi_tpg_param_DataSequenceInOrder.attr,
1329 &iscsi_tpg_param_ErrorRecoveryLevel.attr,
1330 &iscsi_tpg_param_IFMarker.attr,
1331 &iscsi_tpg_param_OFMarker.attr,
1332 &iscsi_tpg_param_IFMarkInt.attr,
1333 &iscsi_tpg_param_OFMarkInt.attr,
1337 /* End items for lio_target_tpg_param_cit */
1339 /* Start items for lio_target_tpg_cit */
1341 static ssize_t lio_target_tpg_show_enable(
1342 struct se_portal_group *se_tpg,
1345 struct iscsi_portal_group *tpg = container_of(se_tpg,
1346 struct iscsi_portal_group, tpg_se_tpg);
1349 spin_lock(&tpg->tpg_state_lock);
1350 len = sprintf(page, "%d\n",
1351 (tpg->tpg_state == TPG_STATE_ACTIVE) ? 1 : 0);
1352 spin_unlock(&tpg->tpg_state_lock);
1357 static ssize_t lio_target_tpg_store_enable(
1358 struct se_portal_group *se_tpg,
1362 struct iscsi_portal_group *tpg = container_of(se_tpg,
1363 struct iscsi_portal_group, tpg_se_tpg);
1367 ret = kstrtou32(page, 0, &op);
1370 if ((op != 1) && (op != 0)) {
1371 pr_err("Illegal value for tpg_enable: %u\n", op);
1375 ret = iscsit_get_tpg(tpg);
1380 ret = iscsit_tpg_enable_portal_group(tpg);
1385 * iscsit_tpg_disable_portal_group() assumes force=1
1387 ret = iscsit_tpg_disable_portal_group(tpg, 1);
1392 iscsit_put_tpg(tpg);
1395 iscsit_put_tpg(tpg);
1399 TF_TPG_BASE_ATTR(lio_target, enable, S_IRUGO | S_IWUSR);
1401 static struct configfs_attribute *lio_target_tpg_attrs[] = {
1402 &lio_target_tpg_enable.attr,
1406 /* End items for lio_target_tpg_cit */
1408 /* Start items for lio_target_tiqn_cit */
1410 static struct se_portal_group *lio_target_tiqn_addtpg(
1412 struct config_group *group,
1415 struct iscsi_portal_group *tpg;
1416 struct iscsi_tiqn *tiqn;
1421 tiqn = container_of(wwn, struct iscsi_tiqn, tiqn_wwn);
1423 * Only tpgt_# directory groups can be created below
1424 * target/iscsi/iqn.superturodiskarry/
1426 tpgt_str = strstr(name, "tpgt_");
1428 pr_err("Unable to locate \"tpgt_#\" directory"
1432 tpgt_str += 5; /* Skip ahead of "tpgt_" */
1433 ret = kstrtou16(tpgt_str, 0, &tpgt);
1437 tpg = iscsit_alloc_portal_group(tiqn, tpgt);
1441 ret = core_tpg_register(
1442 &lio_target_fabric_configfs->tf_ops,
1443 wwn, &tpg->tpg_se_tpg, tpg,
1444 TRANSPORT_TPG_TYPE_NORMAL);
1448 ret = iscsit_tpg_add_portal_group(tiqn, tpg);
1452 pr_debug("LIO_Target_ConfigFS: REGISTER -> %s\n", tiqn->tiqn);
1453 pr_debug("LIO_Target_ConfigFS: REGISTER -> Allocated TPG: %s\n",
1455 return &tpg->tpg_se_tpg;
1457 core_tpg_deregister(&tpg->tpg_se_tpg);
1462 static void lio_target_tiqn_deltpg(struct se_portal_group *se_tpg)
1464 struct iscsi_portal_group *tpg;
1465 struct iscsi_tiqn *tiqn;
1467 tpg = container_of(se_tpg, struct iscsi_portal_group, tpg_se_tpg);
1468 tiqn = tpg->tpg_tiqn;
1470 * iscsit_tpg_del_portal_group() assumes force=1
1472 pr_debug("LIO_Target_ConfigFS: DEREGISTER -> Releasing TPG\n");
1473 iscsit_tpg_del_portal_group(tiqn, tpg, 1);
1476 /* End items for lio_target_tiqn_cit */
1478 /* Start LIO-Target TIQN struct contig_item lio_target_cit */
1480 static ssize_t lio_target_wwn_show_attr_lio_version(
1481 struct target_fabric_configfs *tf,
1484 return sprintf(page, "RisingTide Systems Linux-iSCSI Target "ISCSIT_VERSION"\n");
1487 TF_WWN_ATTR_RO(lio_target, lio_version);
1489 static struct configfs_attribute *lio_target_wwn_attrs[] = {
1490 &lio_target_wwn_lio_version.attr,
1494 static struct se_wwn *lio_target_call_coreaddtiqn(
1495 struct target_fabric_configfs *tf,
1496 struct config_group *group,
1499 struct config_group *stats_cg;
1500 struct iscsi_tiqn *tiqn;
1502 tiqn = iscsit_add_tiqn((unsigned char *)name);
1504 return ERR_CAST(tiqn);
1506 * Setup struct iscsi_wwn_stat_grps for se_wwn->fabric_stat_group.
1508 stats_cg = &tiqn->tiqn_wwn.fabric_stat_group;
1510 stats_cg->default_groups = kmalloc(sizeof(struct config_group *) * 6,
1512 if (!stats_cg->default_groups) {
1513 pr_err("Unable to allocate memory for"
1514 " stats_cg->default_groups\n");
1515 iscsit_del_tiqn(tiqn);
1516 return ERR_PTR(-ENOMEM);
1519 stats_cg->default_groups[0] = &WWN_STAT_GRPS(tiqn)->iscsi_instance_group;
1520 stats_cg->default_groups[1] = &WWN_STAT_GRPS(tiqn)->iscsi_sess_err_group;
1521 stats_cg->default_groups[2] = &WWN_STAT_GRPS(tiqn)->iscsi_tgt_attr_group;
1522 stats_cg->default_groups[3] = &WWN_STAT_GRPS(tiqn)->iscsi_login_stats_group;
1523 stats_cg->default_groups[4] = &WWN_STAT_GRPS(tiqn)->iscsi_logout_stats_group;
1524 stats_cg->default_groups[5] = NULL;
1525 config_group_init_type_name(&WWN_STAT_GRPS(tiqn)->iscsi_instance_group,
1526 "iscsi_instance", &iscsi_stat_instance_cit);
1527 config_group_init_type_name(&WWN_STAT_GRPS(tiqn)->iscsi_sess_err_group,
1528 "iscsi_sess_err", &iscsi_stat_sess_err_cit);
1529 config_group_init_type_name(&WWN_STAT_GRPS(tiqn)->iscsi_tgt_attr_group,
1530 "iscsi_tgt_attr", &iscsi_stat_tgt_attr_cit);
1531 config_group_init_type_name(&WWN_STAT_GRPS(tiqn)->iscsi_login_stats_group,
1532 "iscsi_login_stats", &iscsi_stat_login_cit);
1533 config_group_init_type_name(&WWN_STAT_GRPS(tiqn)->iscsi_logout_stats_group,
1534 "iscsi_logout_stats", &iscsi_stat_logout_cit);
1536 pr_debug("LIO_Target_ConfigFS: REGISTER -> %s\n", tiqn->tiqn);
1537 pr_debug("LIO_Target_ConfigFS: REGISTER -> Allocated Node:"
1539 return &tiqn->tiqn_wwn;
1542 static void lio_target_call_coredeltiqn(
1545 struct iscsi_tiqn *tiqn = container_of(wwn, struct iscsi_tiqn, tiqn_wwn);
1546 struct config_item *df_item;
1547 struct config_group *stats_cg;
1550 stats_cg = &tiqn->tiqn_wwn.fabric_stat_group;
1551 for (i = 0; stats_cg->default_groups[i]; i++) {
1552 df_item = &stats_cg->default_groups[i]->cg_item;
1553 stats_cg->default_groups[i] = NULL;
1554 config_item_put(df_item);
1556 kfree(stats_cg->default_groups);
1558 pr_debug("LIO_Target_ConfigFS: DEREGISTER -> %s\n",
1560 iscsit_del_tiqn(tiqn);
1563 /* End LIO-Target TIQN struct contig_lio_target_cit */
1565 /* Start lio_target_discovery_auth_cit */
1567 #define DEF_DISC_AUTH_STR(name, flags) \
1568 __DEF_NACL_AUTH_STR(disc, name, flags) \
1569 static ssize_t iscsi_disc_show_##name( \
1570 struct target_fabric_configfs *tf, \
1573 return __iscsi_disc_show_##name(&iscsit_global->discovery_acl, \
1576 static ssize_t iscsi_disc_store_##name( \
1577 struct target_fabric_configfs *tf, \
1581 return __iscsi_disc_store_##name(&iscsit_global->discovery_acl, \
1585 #define DEF_DISC_AUTH_INT(name) \
1586 __DEF_NACL_AUTH_INT(disc, name) \
1587 static ssize_t iscsi_disc_show_##name( \
1588 struct target_fabric_configfs *tf, \
1591 return __iscsi_disc_show_##name(&iscsit_global->discovery_acl, \
1595 #define DISC_AUTH_ATTR(_name, _mode) TF_DISC_ATTR(iscsi, _name, _mode)
1596 #define DISC_AUTH_ATTR_RO(_name) TF_DISC_ATTR_RO(iscsi, _name)
1599 * One-way authentication userid
1601 DEF_DISC_AUTH_STR(userid, NAF_USERID_SET);
1602 DISC_AUTH_ATTR(userid, S_IRUGO | S_IWUSR);
1604 * One-way authentication password
1606 DEF_DISC_AUTH_STR(password, NAF_PASSWORD_SET);
1607 DISC_AUTH_ATTR(password, S_IRUGO | S_IWUSR);
1609 * Enforce mutual authentication
1611 DEF_DISC_AUTH_INT(authenticate_target);
1612 DISC_AUTH_ATTR_RO(authenticate_target);
1614 * Mutual authentication userid
1616 DEF_DISC_AUTH_STR(userid_mutual, NAF_USERID_IN_SET);
1617 DISC_AUTH_ATTR(userid_mutual, S_IRUGO | S_IWUSR);
1619 * Mutual authentication password
1621 DEF_DISC_AUTH_STR(password_mutual, NAF_PASSWORD_IN_SET);
1622 DISC_AUTH_ATTR(password_mutual, S_IRUGO | S_IWUSR);
1625 * enforce_discovery_auth
1627 static ssize_t iscsi_disc_show_enforce_discovery_auth(
1628 struct target_fabric_configfs *tf,
1631 struct iscsi_node_auth *discovery_auth = &iscsit_global->discovery_acl.node_auth;
1633 return sprintf(page, "%d\n", discovery_auth->enforce_discovery_auth);
1636 static ssize_t iscsi_disc_store_enforce_discovery_auth(
1637 struct target_fabric_configfs *tf,
1641 struct iscsi_param *param;
1642 struct iscsi_portal_group *discovery_tpg = iscsit_global->discovery_tpg;
1646 err = kstrtou32(page, 0, &op);
1649 if ((op != 1) && (op != 0)) {
1650 pr_err("Illegal value for enforce_discovery_auth:"
1655 if (!discovery_tpg) {
1656 pr_err("iscsit_global->discovery_tpg is NULL\n");
1660 param = iscsi_find_param_from_key(AUTHMETHOD,
1661 discovery_tpg->param_list);
1667 * Reset the AuthMethod key to CHAP.
1669 if (iscsi_update_param_value(param, CHAP) < 0)
1672 discovery_tpg->tpg_attrib.authentication = 1;
1673 iscsit_global->discovery_acl.node_auth.enforce_discovery_auth = 1;
1674 pr_debug("LIO-CORE[0] Successfully enabled"
1675 " authentication enforcement for iSCSI"
1676 " Discovery TPG\n");
1679 * Reset the AuthMethod key to CHAP,None
1681 if (iscsi_update_param_value(param, "CHAP,None") < 0)
1684 discovery_tpg->tpg_attrib.authentication = 0;
1685 iscsit_global->discovery_acl.node_auth.enforce_discovery_auth = 0;
1686 pr_debug("LIO-CORE[0] Successfully disabled"
1687 " authentication enforcement for iSCSI"
1688 " Discovery TPG\n");
1694 DISC_AUTH_ATTR(enforce_discovery_auth, S_IRUGO | S_IWUSR);
1696 static struct configfs_attribute *lio_target_discovery_auth_attrs[] = {
1697 &iscsi_disc_userid.attr,
1698 &iscsi_disc_password.attr,
1699 &iscsi_disc_authenticate_target.attr,
1700 &iscsi_disc_userid_mutual.attr,
1701 &iscsi_disc_password_mutual.attr,
1702 &iscsi_disc_enforce_discovery_auth.attr,
1706 /* End lio_target_discovery_auth_cit */
1708 /* Start functions for target_core_fabric_ops */
1710 static char *iscsi_get_fabric_name(void)
1715 static u32 iscsi_get_task_tag(struct se_cmd *se_cmd)
1717 struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
1719 /* only used for printks or comparism with ->ref_task_tag */
1720 return (__force u32)cmd->init_task_tag;
1723 static int iscsi_get_cmd_state(struct se_cmd *se_cmd)
1725 struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
1727 return cmd->i_state;
1730 static u32 lio_sess_get_index(struct se_session *se_sess)
1732 struct iscsi_session *sess = se_sess->fabric_sess_ptr;
1734 return sess->session_index;
1737 static u32 lio_sess_get_initiator_sid(
1738 struct se_session *se_sess,
1742 struct iscsi_session *sess = se_sess->fabric_sess_ptr;
1744 * iSCSI Initiator Session Identifier from RFC-3720.
1746 return snprintf(buf, size, "%02x%02x%02x%02x%02x%02x",
1747 sess->isid[0], sess->isid[1], sess->isid[2],
1748 sess->isid[3], sess->isid[4], sess->isid[5]);
1751 static int lio_queue_data_in(struct se_cmd *se_cmd)
1753 struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
1755 cmd->i_state = ISTATE_SEND_DATAIN;
1756 cmd->conn->conn_transport->iscsit_queue_data_in(cmd->conn, cmd);
1761 static int lio_write_pending(struct se_cmd *se_cmd)
1763 struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
1764 struct iscsi_conn *conn = cmd->conn;
1766 if (!cmd->immediate_data && !cmd->unsolicited_data)
1767 return conn->conn_transport->iscsit_get_dataout(conn, cmd, false);
1772 static int lio_write_pending_status(struct se_cmd *se_cmd)
1774 struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
1777 spin_lock_bh(&cmd->istate_lock);
1778 ret = !(cmd->cmd_flags & ICF_GOT_LAST_DATAOUT);
1779 spin_unlock_bh(&cmd->istate_lock);
1784 static int lio_queue_status(struct se_cmd *se_cmd)
1786 struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
1788 cmd->i_state = ISTATE_SEND_STATUS;
1789 cmd->conn->conn_transport->iscsit_queue_status(cmd->conn, cmd);
1794 static void lio_queue_tm_rsp(struct se_cmd *se_cmd)
1796 struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
1798 cmd->i_state = ISTATE_SEND_TASKMGTRSP;
1799 iscsit_add_cmd_to_response_queue(cmd, cmd->conn, cmd->i_state);
1802 static char *lio_tpg_get_endpoint_wwn(struct se_portal_group *se_tpg)
1804 struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
1806 return &tpg->tpg_tiqn->tiqn[0];
1809 static u16 lio_tpg_get_tag(struct se_portal_group *se_tpg)
1811 struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
1816 static u32 lio_tpg_get_default_depth(struct se_portal_group *se_tpg)
1818 struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
1820 return ISCSI_TPG_ATTRIB(tpg)->default_cmdsn_depth;
1823 static int lio_tpg_check_demo_mode(struct se_portal_group *se_tpg)
1825 struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
1827 return ISCSI_TPG_ATTRIB(tpg)->generate_node_acls;
1830 static int lio_tpg_check_demo_mode_cache(struct se_portal_group *se_tpg)
1832 struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
1834 return ISCSI_TPG_ATTRIB(tpg)->cache_dynamic_acls;
1837 static int lio_tpg_check_demo_mode_write_protect(
1838 struct se_portal_group *se_tpg)
1840 struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
1842 return ISCSI_TPG_ATTRIB(tpg)->demo_mode_write_protect;
1845 static int lio_tpg_check_prod_mode_write_protect(
1846 struct se_portal_group *se_tpg)
1848 struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
1850 return ISCSI_TPG_ATTRIB(tpg)->prod_mode_write_protect;
1853 static void lio_tpg_release_fabric_acl(
1854 struct se_portal_group *se_tpg,
1855 struct se_node_acl *se_acl)
1857 struct iscsi_node_acl *acl = container_of(se_acl,
1858 struct iscsi_node_acl, se_node_acl);
1863 * Called with spin_lock_bh(struct se_portal_group->session_lock) held..
1865 * Also, this function calls iscsit_inc_session_usage_count() on the
1866 * struct iscsi_session in question.
1868 static int lio_tpg_shutdown_session(struct se_session *se_sess)
1870 struct iscsi_session *sess = se_sess->fabric_sess_ptr;
1872 spin_lock(&sess->conn_lock);
1873 if (atomic_read(&sess->session_fall_back_to_erl0) ||
1874 atomic_read(&sess->session_logout) ||
1875 (sess->time2retain_timer_flags & ISCSI_TF_EXPIRED)) {
1876 spin_unlock(&sess->conn_lock);
1879 atomic_set(&sess->session_reinstatement, 1);
1880 spin_unlock(&sess->conn_lock);
1882 iscsit_stop_time2retain_timer(sess);
1883 iscsit_stop_session(sess, 1, 1);
1889 * Calls iscsit_dec_session_usage_count() as inverse of
1890 * lio_tpg_shutdown_session()
1892 static void lio_tpg_close_session(struct se_session *se_sess)
1894 struct iscsi_session *sess = se_sess->fabric_sess_ptr;
1896 * If the iSCSI Session for the iSCSI Initiator Node exists,
1897 * forcefully shutdown the iSCSI NEXUS.
1899 iscsit_close_session(sess);
1902 static u32 lio_tpg_get_inst_index(struct se_portal_group *se_tpg)
1904 struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
1906 return tpg->tpg_tiqn->tiqn_index;
1909 static void lio_set_default_node_attributes(struct se_node_acl *se_acl)
1911 struct iscsi_node_acl *acl = container_of(se_acl, struct iscsi_node_acl,
1914 ISCSI_NODE_ATTRIB(acl)->nacl = acl;
1915 iscsit_set_default_node_attribues(acl);
1918 static int lio_check_stop_free(struct se_cmd *se_cmd)
1920 return target_put_sess_cmd(se_cmd->se_sess, se_cmd);
1923 static void lio_release_cmd(struct se_cmd *se_cmd)
1925 struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
1927 pr_debug("Entering lio_release_cmd for se_cmd: %p\n", se_cmd);
1928 cmd->release_cmd(cmd);
1931 /* End functions for target_core_fabric_ops */
1933 int iscsi_target_register_configfs(void)
1935 struct target_fabric_configfs *fabric;
1938 lio_target_fabric_configfs = NULL;
1939 fabric = target_fabric_configfs_init(THIS_MODULE, "iscsi");
1940 if (IS_ERR(fabric)) {
1941 pr_err("target_fabric_configfs_init() for"
1942 " LIO-Target failed!\n");
1943 return PTR_ERR(fabric);
1946 * Setup the fabric API of function pointers used by target_core_mod..
1948 fabric->tf_ops.get_fabric_name = &iscsi_get_fabric_name;
1949 fabric->tf_ops.get_fabric_proto_ident = &iscsi_get_fabric_proto_ident;
1950 fabric->tf_ops.tpg_get_wwn = &lio_tpg_get_endpoint_wwn;
1951 fabric->tf_ops.tpg_get_tag = &lio_tpg_get_tag;
1952 fabric->tf_ops.tpg_get_default_depth = &lio_tpg_get_default_depth;
1953 fabric->tf_ops.tpg_get_pr_transport_id = &iscsi_get_pr_transport_id;
1954 fabric->tf_ops.tpg_get_pr_transport_id_len =
1955 &iscsi_get_pr_transport_id_len;
1956 fabric->tf_ops.tpg_parse_pr_out_transport_id =
1957 &iscsi_parse_pr_out_transport_id;
1958 fabric->tf_ops.tpg_check_demo_mode = &lio_tpg_check_demo_mode;
1959 fabric->tf_ops.tpg_check_demo_mode_cache =
1960 &lio_tpg_check_demo_mode_cache;
1961 fabric->tf_ops.tpg_check_demo_mode_write_protect =
1962 &lio_tpg_check_demo_mode_write_protect;
1963 fabric->tf_ops.tpg_check_prod_mode_write_protect =
1964 &lio_tpg_check_prod_mode_write_protect;
1965 fabric->tf_ops.tpg_alloc_fabric_acl = &lio_tpg_alloc_fabric_acl;
1966 fabric->tf_ops.tpg_release_fabric_acl = &lio_tpg_release_fabric_acl;
1967 fabric->tf_ops.tpg_get_inst_index = &lio_tpg_get_inst_index;
1968 fabric->tf_ops.check_stop_free = &lio_check_stop_free,
1969 fabric->tf_ops.release_cmd = &lio_release_cmd;
1970 fabric->tf_ops.shutdown_session = &lio_tpg_shutdown_session;
1971 fabric->tf_ops.close_session = &lio_tpg_close_session;
1972 fabric->tf_ops.sess_get_index = &lio_sess_get_index;
1973 fabric->tf_ops.sess_get_initiator_sid = &lio_sess_get_initiator_sid;
1974 fabric->tf_ops.write_pending = &lio_write_pending;
1975 fabric->tf_ops.write_pending_status = &lio_write_pending_status;
1976 fabric->tf_ops.set_default_node_attributes =
1977 &lio_set_default_node_attributes;
1978 fabric->tf_ops.get_task_tag = &iscsi_get_task_tag;
1979 fabric->tf_ops.get_cmd_state = &iscsi_get_cmd_state;
1980 fabric->tf_ops.queue_data_in = &lio_queue_data_in;
1981 fabric->tf_ops.queue_status = &lio_queue_status;
1982 fabric->tf_ops.queue_tm_rsp = &lio_queue_tm_rsp;
1984 * Setup function pointers for generic logic in target_core_fabric_configfs.c
1986 fabric->tf_ops.fabric_make_wwn = &lio_target_call_coreaddtiqn;
1987 fabric->tf_ops.fabric_drop_wwn = &lio_target_call_coredeltiqn;
1988 fabric->tf_ops.fabric_make_tpg = &lio_target_tiqn_addtpg;
1989 fabric->tf_ops.fabric_drop_tpg = &lio_target_tiqn_deltpg;
1990 fabric->tf_ops.fabric_post_link = NULL;
1991 fabric->tf_ops.fabric_pre_unlink = NULL;
1992 fabric->tf_ops.fabric_make_np = &lio_target_call_addnptotpg;
1993 fabric->tf_ops.fabric_drop_np = &lio_target_call_delnpfromtpg;
1994 fabric->tf_ops.fabric_make_nodeacl = &lio_target_make_nodeacl;
1995 fabric->tf_ops.fabric_drop_nodeacl = &lio_target_drop_nodeacl;
1997 * Setup default attribute lists for various fabric->tf_cit_tmpl
1998 * sturct config_item_type's
2000 TF_CIT_TMPL(fabric)->tfc_discovery_cit.ct_attrs = lio_target_discovery_auth_attrs;
2001 TF_CIT_TMPL(fabric)->tfc_wwn_cit.ct_attrs = lio_target_wwn_attrs;
2002 TF_CIT_TMPL(fabric)->tfc_tpg_base_cit.ct_attrs = lio_target_tpg_attrs;
2003 TF_CIT_TMPL(fabric)->tfc_tpg_attrib_cit.ct_attrs = lio_target_tpg_attrib_attrs;
2004 TF_CIT_TMPL(fabric)->tfc_tpg_auth_cit.ct_attrs = lio_target_tpg_auth_attrs;
2005 TF_CIT_TMPL(fabric)->tfc_tpg_param_cit.ct_attrs = lio_target_tpg_param_attrs;
2006 TF_CIT_TMPL(fabric)->tfc_tpg_np_base_cit.ct_attrs = lio_target_portal_attrs;
2007 TF_CIT_TMPL(fabric)->tfc_tpg_nacl_base_cit.ct_attrs = lio_target_initiator_attrs;
2008 TF_CIT_TMPL(fabric)->tfc_tpg_nacl_attrib_cit.ct_attrs = lio_target_nacl_attrib_attrs;
2009 TF_CIT_TMPL(fabric)->tfc_tpg_nacl_auth_cit.ct_attrs = lio_target_nacl_auth_attrs;
2010 TF_CIT_TMPL(fabric)->tfc_tpg_nacl_param_cit.ct_attrs = lio_target_nacl_param_attrs;
2012 ret = target_fabric_configfs_register(fabric);
2014 pr_err("target_fabric_configfs_register() for"
2015 " LIO-Target failed!\n");
2016 target_fabric_configfs_free(fabric);
2020 lio_target_fabric_configfs = fabric;
2021 pr_debug("LIO_TARGET[0] - Set fabric ->"
2022 " lio_target_fabric_configfs\n");
2027 void iscsi_target_deregister_configfs(void)
2029 if (!lio_target_fabric_configfs)
2032 * Shutdown discovery sessions and disable discovery TPG
2034 if (iscsit_global->discovery_tpg)
2035 iscsit_tpg_disable_portal_group(iscsit_global->discovery_tpg, 1);
2037 target_fabric_configfs_deregister(lio_target_fabric_configfs);
2038 lio_target_fabric_configfs = NULL;
2039 pr_debug("LIO_TARGET[0] - Cleared"
2040 " lio_target_fabric_configfs\n");