Skip to content

RFC target: add sysfs support

Mike Christie linux-scsi target-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest5 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5target: add sysfs supportdrivers/target/target_core_configfs.c drivers/target/target_core_fabric_configfs.c drivers/target/target_core_internal.h +1 more+58 -02 replies
2/5target: add sysfs session helper functionsdrivers/target/Makefile drivers/target/target_core_fabric_configfs.c drivers/target/target_core_internal.h +4 more+168 -25 replies
3/5target: add target_setup_session sysfs supportdrivers/infiniband/ulp/srpt/ib_srpt.c drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c drivers/scsi/qla2xxx/tcm_qla2xxx.c +10 more+73 -283 replies
4/5iscsi target: use session sysfs helpersdrivers/target/iscsi/iscsi_target.c drivers/target/iscsi/iscsi_target_configfs.c drivers/target/iscsi/iscsi_target_login.c +3 more+22 -270 replies
5/5target: drop sess_get_indexdrivers/infiniband/ulp/srpt/ib_srpt.c drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c drivers/scsi/qla2xxx/tcm_qla2xxx.c +11 more+1 -810 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/5] target: add sysfs support

The following patches made over Linus's current tree allow lio to export info about structs that the kernel initiates creation of via events like initiator login where there is no user interaction like a mkdir. These patches specificially focus on the I_T_nexus/session but could be used for other objects if we want.

Why sysfs when we have configfs?

I started with configfs and hit bugs like:

commit cc57c07343bd071cdf1915a91a24ab7d40c9b590

Author: Mike Christie <[email protected]>
Date:   Sun Jul 15 18:16:17 2018 -0500

configfs: fix registered group removal

but it turns out that bug was not really a bug and was just how configfs was meant to work. It seems it was not meant to be used where the kernel initiates creation of dirs/files as a result of some internal action. It's more geared to the user initiating the creation, and my patch just lead to other bugs and was reverted:

commit f19e4ed1e1edbfa3c9ccb9fed17759b7d6db24c6

Author: Al Viro <[email protected]>
Date:   Thu Aug 29 23:13:30 2019 -0400

configfs_register_group() shouldn't be (and isn't) called in
rmdirable parts

So to export the session info we have debugfs, sysfs, ioctl, netlink, etc. sysfs just seemed like a decent fit since one of the primary users is rtslib and it already has lots of file/dir handling code.