Unexpected behavior CTLD when config reload

Victor Kustov ktrace at yandex.ru
Thu Apr 11 13:39:32 UTC 2019


Hi!

# uname -a
FreeBSD PMX-Storage 12.0-STABLE FreeBSD 12.0-STABLE r345117 GENERIC  amd64

Here the config /etc/ctl.conf:

auth-group tst-pmx {
     auth-type none
     initiator-portal xxx.xxx.xxx.0/24
}
portal-group tst {
     discovery-auth-group no-authentication
     listen xxx.xxx.xxx.10:3260
}
target iqn.2019-04.org.acme.bsd:tsttank {
     auth-group tst-pmx

     lun 0 {
           path /dev/zvol/storage/vm-100-disk-0
     }

     lun 1 {
           path /dev/zvol/storage/vm-101-disk-0
     }

     lun 2 {
           path /dev/zvol/storage/vm-102-disk-0
     }

     lun 3 {
           path /dev/zvol/storage/vm-400-disk-0
     }
     portal-group tst
}
here zfs list:
NAME                    USED  AVAIL  REFER  MOUNTPOINT
storage                 299G  13.8T    23K  /storage
storage/vm-100-disk-0   106G  13.8T  13.8G  -
storage/vm-101-disk-0   106G  13.8T  11.8G  -
storage/vm-102-disk-0  85.0G  13.8T  22.5G  -
storage/vm-400-disk-0  1.06G  13.8T    12K  -

The above conditions will not change.

OK, here we go. 

Here ctladm devlist -v:

LUN Backend       Size (Blocks)   BS Serial Number    Device ID       
  0 block             209715200  512 MYSERIAL0000     MYDEVID0000     
      lun_type=0
      num_threads=14
      file=/dev/zvol/storage/vm-100-disk-0
      ctld_name=iqn.2019-04.org.acme.bsd:tsttank,lun,0
      scsiname=iqn.2019-04.org.acme.bsd:tsttank,lun,0
  1 block             209715200  512 MYSERIAL0001     MYDEVID0001     
      lun_type=0
      num_threads=14
      file=/dev/zvol/storage/vm-101-disk-0
      ctld_name=iqn.2019-04.org.acme.bsd:tsttank,lun,1
      scsiname=iqn.2019-04.org.acme.bsd:tsttank,lun,1
  2 block             167772160  512 MYSERIAL0002     MYDEVID0002     
      lun_type=0
      num_threads=14
      file=/dev/zvol/storage/vm-102-disk-0
      ctld_name=iqn.2019-04.org.acme.bsd:tsttank,lun,2
      scsiname=iqn.2019-04.org.acme.bsd:tsttank,lun,2
  3 block               2097152  512 MYSERIAL0003     MYDEVID0003     
      lun_type=0
      num_threads=14
      file=/dev/zvol/storage/vm-400-disk-0

ctladm portlist -v

Port Online Frontend Name     pp vp
0    NO     camsim   camsim   0  0  naa.50000006465f0b01
  Target: naa.50000006465f0b00
  All LUNs mapped
      port_type=8
1    YES    ioctl    ioctl    0  0  
  All LUNs mapped
      port_type=4
2    YES    tpc      tpc      0  0  
  All LUNs mapped
      port_type=8
3    YES    iscsi    iscsi    257 1  iqn.2019-04.org.acme.bsd:tsttank,t,0x0101
  Target: iqn.2019-04.org.acme.bsd:tsttank
  Initiator 0: iqn.1993-08.org.debian:01:8a1925107c9b,i,0x801bca930000
  Initiator 1: iqn.1993-08.org.debian:01:80fc8d95b8eb,i,0x80a99aad0000
  Initiator 3: iqn.1993-08.org.debian:01:dc1469872eeb,i,0x8011b5560000
  LUN 0: 0
  LUN 1: 1
  LUN 2: 2
      port_type=16
      cfiscsi_state=1
      cfiscsi_target=iqn.2019-04.org.acme.bsd:tsttank
      ctld_portal_group_name=tst
      cfiscsi_portal_group_tag=257

Note: lun 3 created, added to config, but not used by any initiator and not listed in port.

After service ctladm reload I expect 4 luns as specified in config.
But what I get when ctladm devlist -v:

LUN Backend       Size (Blocks)   BS Serial Number    Device ID       
  0 block             209715200  512 MYSERIAL0000     MYDEVID0000     
      lun_type=0
      num_threads=14
  1 block             209715200  512 MYSERIAL0001     MYDEVID0001     
      lun_type=0
      num_threads=14
  2 block             167772160  512 MYSERIAL0002     MYDEVID0002     
      lun_type=0
      num_threads=14
  3 block               2097152  512 MYSERIAL0003     MYDEVID0003     
      lun_type=0
      num_threads=14
      file=/dev/zvol/storage/vm-400-disk-0
  4 block               2097152  512 MYSERIAL0004     MYDEVID0004     
      lun_type=0
      num_threads=14
      file=/dev/zvol/storage/vm-400-disk-0
      ctld_name=iqn.2019-04.org.acme.bsd:tsttank,lun,3
      scsiname=iqn.2019-04.org.acme.bsd:tsttank,lun,3

Unexpected:
 - used by initiators luns 0..2 loose scsiname,ctld_name and even path(file).
 - lun 3 has file(path), but doubled by lun 4.

ctladm portlist -v:

Port Online Frontend Name     pp vp
0    NO     camsim   camsim   0  0  naa.50000006465f0b01
  Target: naa.50000006465f0b00
  All LUNs mapped
      port_type=8
1    YES    ioctl    ioctl    0  0  
  All LUNs mapped
      port_type=4
2    YES    tpc      tpc      0  0  
  All LUNs mapped
      port_type=8
3    YES    iscsi    iscsi    257 1  iqn.2019-04.org.acme.bsd:tsttank,t,0x0101
  Target: iqn.2019-04.org.acme.bsd:tsttank
  Initiator 0: iqn.1993-08.org.debian:01:8a1925107c9b,i,0x801bca930000
  Initiator 1: iqn.1993-08.org.debian:01:80fc8d95b8eb,i,0x80a99aad0000
  LUN 0: 0
  LUN 1: 1
  LUN 2: 2
  LUN 3: 4
      port_type=16
      cfiscsi_state=1
      cfiscsi_target=iqn.2019-04.org.acme.bsd:tsttank
      ctld_portal_group_name=tst
      cfiscsi_portal_group_tag=257

Note: 
- we loose initiator #2 (I'm really don't know what happen with
him, I pay attention to it just now)
- Map(?) LUN 3 -> 4

OK now restart ctld.

LUN Backend       Size (Blocks)   BS Serial Number    Device ID       
  3 block               2097152  512 MYSERIAL0003     MYDEVID0003     
      lun_type=0
      num_threads=14
      file=/dev/zvol/storage/vm-400-disk-0
  0 block             209715200  512 MYSERIAL0001     MYDEVID0001     
      lun_type=0
      num_threads=14
      file=/dev/zvol/storage/vm-100-disk-0
      ctld_name=iqn.2019-04.org.acme.bsd:tsttank,lun,0
      scsiname=iqn.2019-04.org.acme.bsd:tsttank,lun,0
  1 block             209715200  512 MYSERIAL0002     MYDEVID0002     
      lun_type=0
      num_threads=14
      file=/dev/zvol/storage/vm-101-disk-0
      ctld_name=iqn.2019-04.org.acme.bsd:tsttank,lun,1
      scsiname=iqn.2019-04.org.acme.bsd:tsttank,lun,1
  2 block             167772160  512 MYSERIAL0003     MYDEVID0003     
      lun_type=0
      num_threads=14scsiname
      file=/dev/zvol/storage/vm-102-disk-0
      ctld_name=iqn.2019-04.org.acme.bsd:tsttank,lun,2
      scsiname=iqn.2019-04.org.acme.bsd:tsttank,lun,2
  4 block               2097152  512 MYSERIAL0004     MYDEVID0004     
      lun_type=0
      num_threads=14
      file=/dev/zvol/storage/vm-400-disk-0
      ctld_name=iqn.2019-04.org.acme.bsd:tsttank,lun,3
      scsiname=iqn.2019-04.org.acme.bsd:tsttank,lun,3

Unlike reload all luns got 'file'('path') and all except 3 get ctld_name, scsiname.
in ctld_name, scsiname I got correct lun number (as config). lun 3 - unexpected phantom.

portlist -v

Port Online Frontend Name     pp vp
0    NO     camsim   camsim   0  0  naa.50000006465f0b01
  Target: naa.50000006465f0b00
  All LUNs mapped
      port_type=8
1    YES    ioctl    ioctl    0  0  
  All LUNs mapped
      port_type=4
2    YES    tpc      tpc      0  0  
  All LUNs mapped
      port_type=8
3    YES    iscsi    iscsi    257 1
iqn.2019-04.org.acme.bsd:tsttank,t,0x0101 Target:
iqn.2019-04.org.acme.bsd:tsttank Initiator 0:
iqn.1993-08.org.debian:01:dc1469872eeb,i,0x8035c3620000 Initiator 1:
iqn.1993-08.org.debian:01:80fc8d95b8eb,i,0x808922890000 Initiator 2:
iqn.1993-08.org.debian:01:8a1925107c9b,i,0x80b90ad70000 LUN 0: 0
  LUN 1: 1
  LUN 2: 2
  LUN 3: 4
      port_type=16
      cfiscsi_state=1
      cfiscsi_target=iqn.2019-04.org.acme.bsd:tsttank
      ctld_portal_group_name=tst
      cfiscsi_portal_group_tag=257

Look reasonable but incorrect map(?) 3->4 keeped.

I don't think it's a bug, but seems I miss something, maybe need additional lines in config, for example port?
I need keep status quo after reload. So this behavior is observed only when any luns unused. When all luns used
restart and reload keep luns (but restart still add ctld_name, scsiname and reload kill they and file/path).

-- 
  С уважением,            |  Best regards,
          Виктор Кустов   |          Victor Kustov
  XMPP: ktrace at jabber.ru
  I use FREE operation system: 4.19.29-calculate GNU/Linux
  up 2 days, 4 hours, 34 minutes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: ���������������� �������������� OpenPGP
URL: <http://lists.freebsd.org/pipermail/freebsd-scsi/attachments/20190411/895393ca/attachment.sig>


More information about the freebsd-scsi mailing list