ConfigFS

The Linux SCSI Target Wiki

Jump to: navigation, search

ConfigFS is a RAM-based virtual file system provided with the 2.6 Linux kernel.[1]

Contents

Summary

ConfigFS was originally based on sysfs, and developed as a hybrid control mechanism for OCFS2.

ConfigFS appears similar to sysfs but they are in fact different and complementary. ConfigFS is for creating, managing and destroying kernel objects from user-space, and sysfs for viewing and manipulating objects from user-space which are created and destroyed by kernel space.[2] It is typically mounted at /config.

The Linux-IO Target uses configFS for all fabric module configuration. Objects are associated with symbolic links, both within and across modules.

Support

The following LIO components support configFS-based configuration:

Layout

LIO v4.0 and higher contains logic in target_core_fabric_configfs.c to the layout of config_groups (e.g., configFS directories), and allows fabric modules to optionally enable an extended set of TPG config_groups and add fabric dependent attributes.

The basic layout of a newly created fabric module configFS skeleton looks like (see the mapping into targetcli):

# tree /sys/kernel/config/target/nab5000/
/sys/kernel/config/target/nab5000/
|-- discovery_auth
|-- iqn.foo
|   `-- tpgt_1
|       |-- acls
|       |-- attrib
|       |-- lun
|       |   `-- lun_0
|       |       |-- alua_tg_pt_gp
|       |       |-- alua_tg_pt_offline
|       |       |-- alua_tg_pt_status
|       |       |-- alua_tg_pt_write_md
|       |       `-- nab5000_port -> ../../../../../../target/core/iblock_0/lvm_test0
|       |-- np
|       `-- param
`-- version

By default, a fabric module is provided with the following groups.

/sys/kernel/config/target/$FABRIC_MOD/

This is the top level fabric module group created via an initial mkdir(2), which may also involve loading the module automatically.

/sys/kernel/config/target/$FABRIC_MOD/discovery_auth/

tfc_discovery_cit is created empty by default, and may be used by fabric modules for fabric dependent discovery authentication. It is used by iSCSI for discovery authentication attributes.

/sys/kernel/config/target/$FABRIC_MOD/$FABRIC_WWN/

tfc_wwn_cit is created via mkdir(2) and defines a fabric dependent WWN for which the fabric module will enforce the naming:

/sys/kernel/config/target/$FABRIC_MOD/$FABRIC_WWN/tpgt_$TPGT/

tfc_tpg_cit is created via mkdir(2) and defines a fabric independent target portal group TPG tag. tfc_tpg_cit will create the ACLs, attrib, LUN, np and param groups by default for all fabric modules. It may contain fabric module dependent attributes (such as /enable for iSCSI).

/sys/kernel/config/target/$FABRIC_MOD/$FABRIC_WWN/tpgt_$TPGT/acls/[$INITIATOR_WWN]/[lun_$LUN_ID]

tfc_tpg_nacl_cit is created empty by default by tfc_tpg_cit. A subsequent mkdir(2) creates a fabric dependent $INITIATOR_WWN. This follows the same naming conventions as $FABRIC_WWN. Also below the tfc_tpg_nacl_cit, the MappedLUN layout is fabric independent along with the same default acls/$INITIATOR_WWN/[attrib,auth,param] groups as iSCSI, but appear as empty by default and may contain fabric dependent attributes. For all intenstive purposes will be the same (aside from the different $INITIATOR_WWN) as in existing RTSlib code.

/sys/kernel/config/target/$FABRIC_MOD/$FABRIC_WWN/tpgt_$TPGT/attrib/

tfc_tpg_attrib_cit is created empty by default by tfc_tpg_cit, and may optionally contain fabric dependent attributes.

/sys/kernel/config/target/$FABRIC_MOD/$FABRIC_WWN/tpgt_$TPGT/lun/[lun_$ID]/[$PORT_LINK]

tfc_tpg_lun_cit is created empty by default by tfc_tpg_cit. A subsequent mkdir(2) for lun_$id creates the alua_tg_pt_* attributes, and a symlink to an $HBA/$DEV backend creates a fabric module port. The fabric module is currently not allowed to create fabric dependent attributes here. For all intenstive purposes will be the same as in existing rtslib code.

/sys/kernel/config/target/$FABRIC_MOD/$FABRIC_WWN/tpgt_$TPGT/np/$IP_ADDRESS/

tfc_tpg_np_cit is created empty by default by tfc_tpg_cit, and may optionally contain IPv4 or IPv6 addresses. It is only intended for iSCSI specific usage, and may contain fabric dependent attributes. Currently modules aside from iSCSI not using this logic will return an -ENOSYS here during mkdir(2) $IP_ADDRESS.

/sys/kernel/config/target/$FABRIC_MOD/$FABRIC_WWN/tpgt_$TPGT/param/

tfc_tpg_param_cit is created empty by default by tfc_tpg_cit, and may optionally contain fabric dependent parameter attributes.

So the main fabric depends parts are currently:

Beyond these cases, everything defined by target_core_fabric_configfs.c in the /sys/kernel/config/target/$FABRIC_MOD layout is generic to all fabrics.

See also

Notes

  1. Joel Becker (3/31/2005). "configfs - userspace-driven kernel object configuration". mjmwired.net. 
  2. Jonathan Corbet (8/24/2005). "ConfigFS - An Introduction". lwn.net. 

External links

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox
Google AdSense