Page MenuHomeFreeBSD

nvmft: Export more info for a ctl port for use by ctladm
AcceptedPublic

Authored by jhb on Fri, Jan 31, 8:20 PM.

Details

Reviewers
asomers
mav
trasz
Summary

In particular, export a "port" entry as well as an array of "host"
entries for each active connection.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 62181
Build 59065: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Fri, Jan 31, 8:20 PM

Exporting the "port" attribute adds a new column in the output of ctladm portlist:

# ctladm portlist
Port Online Frontend Name     pp vp
0    NO     camsim   camsim   0  0  naa.50000001dc007b01
1    YES    ioctl    ioctl    0  0  
2    YES    tpc      tpc      0  0  
3    YES    iscsi    iscsi    257 1  iqn.2001-03.com.chelsio:frodo0,t,0x0101
4    YES    nvmf     nvmf     1  0  nqn.2001-03.com.chelsio:frodo0,p,1

Note though that this does uncover an issue in ctl I need to fix which is a LOR:

lock order reversal: (sleepable after non-sleepable)
 1st 0xfffff8013ff93000 CTL mutex (CTL mutex, sleep mutex) @ /mnt/jhb/work/git/freebsd/sys/cam/ctl/ctl.c:3346
 2nd 0xfffffe08ce3dc3e0 nvmft port (nvmft port, sx) @ /mnt/jhb/work/git/freebsd/sys/dev/nvmf/controller/ctl_frontend_nvmf.c:105
lock order CTL mutex -> nvmft port attempted at:
#0 0xffffffff80af22eb at witness_checkorder+0x8cb
#1 0xffffffff80a90efa at _sx_slock_int+0x6a
#2 0xffffffff80a91779 at _sx_slock+0x9
#3 0xffffffff831c93f1 at nvmft_info+0x31
#4 0xffffffff83186c8f at ctl_ioctl+0x9ff
#5 0xffffffff80926f55 at devfs_ioctl+0xd5
#6 0xffffffff81017a0e at VOP_IOCTL_APV+0x2e
#7 0xffffffff80b86ea4 at VOP_IOCTL+0x34
#8 0xffffffff80b818c4 at vn_ioctl+0xf4
#9 0xffffffff8092744e at devfs_ioctl_f+0x1e
#10 0xffffffff80af7ceb at fo_ioctl+0xb
#11 0xffffffff80af7c13 at kern_ioctl+0x243
#12 0xffffffff80af796f at sys_ioctl+0x12f
#13 0xffffffff80f63625 at syscallenter+0x115
#14 0xffffffff80f6332d at amd64_syscall+0x2d
#15 0xffffffff80f39dbb at fast_syscall_common+0xf8

I will need to probably fix this by converting the relevant lock in ctl to an sx lock (which I believe will fix some other races in ctl(4)).

This revision is now accepted and ready to land.Sun, Feb 2, 10:10 PM