Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

targetcli sessions does not show dynamic sessions #120

Open
iammattcoleman opened this issue Jun 15, 2018 · 0 comments
Open

targetcli sessions does not show dynamic sessions #120

iammattcoleman opened this issue Jun 15, 2018 · 0 comments

Comments

@iammattcoleman
Copy link
Contributor

iammattcoleman commented Jun 15, 2018

In demo mode, sessions listed in the TPG's dynamic_sessions file in configfs are not shown in targetcli sessions list or targetcli sessions detail. This appears to be the same issue described in this RedHat Bugzilla ticket: https://bugzilla.redhat.com/show_bug.cgi?id=1161489

I'm running my tests on Ubuntu 18.04, which has kernel 4.15.0-23 and targetcli-fb 2.1.43-1 (aka 2.1fb43).

For example, if a target has an open session...

matt@lio-iscsi:/sys/kernel/config/target/iscsi/iqn.2018-06.com.example:testtarget$ cat fabric_statistics/iscsi_instance/sessions
1
matt@lio-iscsi:/sys/kernel/config/target/iscsi/iqn.2018-06.com.example:testtarget$ cat tpgt_1/dynamic_sessions
iqn.1993-08.org.debian:01:bb4224e84355
matt@lio-iscsi:/sys/kernel/config/target/iscsi/iqn.2018-06.com.example:testtarget$ sudo targetcli sessions list
(no open sessions)

If I create an ACL for the initiator, the session information becomes available.

matt@lio-iscsi:/sys/kernel/config/target/iscsi/iqn.2018-06.com.example:testtarget$ sudo targetcli /iscsi/iqn.2018-06.com.example:testtarget/tpg1/acls create iqn.1993-08.org.debian:01:bb4224e84355
Created Node ACL for iqn.1993-08.org.debian:01:bb4224e84355
Created mapped LUN 0.
matt@lio-iscsi:/sys/kernel/config/target/iscsi/iqn.2018-06.com.example:testtarget$ sudo targetcli sessions list
alias: lio-iscsi        sid: 2 type: Normal session-state: LOGGED_IN
matt@lio-iscsi:/sys/kernel/config/target/iscsi/iqn.2018-06.com.example:testtarget$ sudo targetcli sessions detail
alias: lio-iscsi        sid: 2 type: Normal session-state: LOGGED_IN
    name: iqn.1993-08.org.debian:01:bb4224e84355 (NOT AUTHENTICATED)
    mapped-lun: 0 backstore: fileio/matt_100m.img mode: rw
    address: 127.0.0.1 (TCP)  cid: 0 connection-state: LOGGED_IN

If I stat the dynamic_sessions file, the atime/ctime/mtime change with every execution of stat:

matt@lio-iscsi:/sys/kernel/config/target/iscsi/iqn.2018-06.com.example:testtarget$ stat tpgt_1/dynamic_sessions
  File: tpgt_1/dynamic_sessions
  Size: 4096            Blocks: 0          IO Block: 4096   regular file
Device: 13h/19d Inode: 118924      Links: 1
Access: (0444/-r--r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2018-06-15 19:58:43.133152697 +0000
Modify: 2018-06-15 19:58:43.133152697 +0000
Change: 2018-06-15 19:58:43.133152697 +0000
 Birth: -
matt@lio-iscsi:/sys/kernel/config/target/iscsi/iqn.2018-06.com.example:testtarget$ stat tpgt_1/dynamic_sessions
  File: tpgt_1/dynamic_sessions
  Size: 4096            Blocks: 0          IO Block: 4096   regular file
Device: 13h/19d Inode: 118930      Links: 1
Access: (0444/-r--r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2018-06-15 19:58:44.293113963 +0000
Modify: 2018-06-15 19:58:44.293113963 +0000
Change: 2018-06-15 19:58:44.293113963 +0000
 Birth: -

Additionally, inotify is not able to detect changes in the file: as a simple test, iwatch /sys/kernel/config/target/iscsi/iqn.2018-06.com.example:testtarget/tpgt_1/dynamic_sessions does not display any events when an initiator connects or disconnects. I was hoping to work around the issue by monitoring dynamic_sessions for changes and running a script that creates ACLs when new initiators connect, which will be much less efficient without reliable timestamps or inotify.

The target's fabric_statistics/iscsi_instance/sessions file misbehaves the the same way with stat and inotify. I suspect this is due to something along the lines of the dynamic_sessions and sessions being pseudo-files that directly access kernel data structures when read, so there never actually are any write events for inotify to detect.

  1. Should session information be available for dynamic sessions? Or, is this intended behavior?
  2. Is there an alternative way (via configfs/etc.) to get information about dynamic sessions?
  3. Is there any trick to getting dynamic_sessions to work properly with stat and inotify/iwatch?
@iammattcoleman iammattcoleman changed the title sessions are not listed for dynamic ACLs sessions are not listed for dynamic sessions Jun 22, 2018
@iammattcoleman iammattcoleman changed the title sessions are not listed for dynamic sessions targetcli sessions list does not show dynamic sessions Jun 22, 2018
@iammattcoleman iammattcoleman changed the title targetcli sessions list does not show dynamic sessions targetcli sessions does not show dynamic sessions Jun 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant