Page MenuHomeFreeBSD

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

Authored by jhb on Jan 31 2025, 8:20 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 7, 12:16 PM
Unknown Object (File)
Mon, Mar 3, 5:09 PM
Unknown Object (File)
Sat, Feb 22, 10:25 PM
Unknown Object (File)
Thu, Feb 20, 3:41 PM
Unknown Object (File)
Thu, Feb 13, 8:56 AM
Unknown Object (File)
Mon, Feb 10, 8:27 AM
Unknown Object (File)
Sun, Feb 9, 11:00 PM
Unknown Object (File)
Sat, Feb 8, 6:54 PM
Subscribers

Details

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 Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Jan 31 2025, 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.Feb 2 2025, 10:10 PM