jnielsendotnet / isboot

FreeBSD kernel module to support booting from iSCSI via IBFT
4 stars 7 forks source link

Fix early free of ITT when seperate status #13

Closed jwmullally closed 1 year ago

jwmullally commented 1 year ago

If the Mode Sense request fails for this particular LUN, the error status can arrive in a seperate PDU after the initial data response, expecting the same ITT.

Conforms to RFC3720 10.7.3. Tested on tgtd v1.0.81, where the default lun0 responds with such an error.

jnielsendotnet commented 1 year ago

Thanks!

jnielsendotnet commented 1 year ago

FYI i'll be updating the FreeBSD port as soon as I finish the IfAPI changes, hopefully this week.

jwmullally commented 1 year ago

Great. with those recent changes in now, tgt fully works as a target with iPXE sanboot and isboot.

tgt target:

# grep OpenWrt /etc/banner
 OpenWrt 22.03.5, r20134-5f15225c1e
# uname -a
Linux iscsi-target-ramdisk 5.10.176 #0 SMP Thu Apr 27 20:28:15 2023 x86_64 GNU/Linux
# tgtd --version
1.0.81

# tgtadm --mode target --op show
Target 1: iqn.2018-04.org.example:target-host
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
        I_T nexus: 3
            Initiator: iqn.2018-04.org.example:initiator-host alias: none
            Connection: 1
                IP Address: 192.168.200.8
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: IET     00010000
            SCSI SN: beaf10
            Size: 0 MB, Block size: 1
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            SWP: No
            Thin-provisioning: No
            Backing store type: null
            Backing store path: None
            Backing store flags: 
        LUN: 1
            Type: disk
            SCSI ID: IET     00010001
            SCSI SN: beaf11
            Size: 17180 MB, Block size: 512
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            SWP: No
            Thin-provisioning: No
            Backing store type: aio
            Backing store path: /dev/vda
            Backing store flags: 
        LUN: 2
            Type: disk
            SCSI ID: IET     00010002
            SCSI SN: beaf12
            Size: 1074 MB, Block size: 512
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            SWP: No
            Thin-provisioning: No
            Backing store type: aio
            Backing store path: /dev/vdb
            Backing store flags: 
    Account information:
        iscsiuser_in
        iscsiuser_out (outgoing)
    ACL information:
        ALL
        iqn.2018-04.org.example:initiator-host

isboot initiator:

# uname -a
FreeBSD freebsd 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC amd64

# git remote -v
origin  https://github.com/jnielsendotnet/isboot.git (fetch)
origin  https://github.com/jnielsendotnet/isboot.git (push)

# git rev-parse master
feac1fa3cdc0ce10e531c9fd3dd0421e730a9aa4

# sysctl net.isboot
net.isboot.device: 
net.isboot.nic: vtnet0
net.isboot.version: 0.2.15

# sysctl hw.ibft
hw.ibft.verbose: 0
hw.ibft.acpi_table: 1
hw.ibft.nic_gateway: 0000:0000:0000:0000:0000:0000:0000:0000
hw.ibft.nic_prefix: 24
hw.ibft.target_lun: 256
hw.ibft.target_port: 3260
hw.ibft.target_address: 192.168.200.1
hw.ibft.target_name: iqn.2018-04.org.example:target-host
hw.ibft.initiator_address: 192.168.200.8
hw.ibft.initiator_name: iqn.2018-04.org.example:initiator-host

# camcontrol devlist 
<IET Controller 0001>              at scbus6 target 0 lun 0 (pass0)
<IET VIRTUAL-DISK 0001>            at scbus6 target 0 lun 1 (pass1,da0)
<IET VIRTUAL-DISK 0001>            at scbus6 target 0 lun 2 (pass2,da1)

# camcontrol inquiry da0
pass1: <IET VIRTUAL-DISK 0001> Fixed Direct Access SPC-3 SCSI device
pass1: Serial Number                               beaf11
pass1: 300.000MB/s transfers

# camcontrol inquiry da1
pass2: <IET VIRTUAL-DISK 0001> Fixed Direct Access SPC-3 SCSI device
pass2: Serial Number                               beaf12
pass2: 300.000MB/s transfers
jnielsendotnet commented 1 year ago

Glad to hear it, thanks for letting me know! Which FreeBSD version is the initiator running on?On Aug 30, 2023, at 3:55 AM, Joe Mullally @.***> wrote: Great. with those recent changes in now, tgt fully works as a target with iPXE sanboot and isboot. tgt target:

tgtd --version

1.0.81

tgtadm --mode target --op show

Target 1: iqn.2018-04.org.example:target-host System information: Driver: iscsi State: ready I_T nexus information: I_T nexus: 3 Initiator: iqn.2018-04.org.example:initiator-host alias: none Connection: 1 IP Address: 192.168.200.8 LUN information: LUN: 0 Type: controller SCSI ID: IET 00010000 SCSI SN: beaf10 Size: 0 MB, Block size: 1 Online: Yes Removable media: No Prevent removal: No Readonly: No SWP: No Thin-provisioning: No Backing store type: null Backing store path: None Backing store flags: LUN: 1 Type: disk SCSI ID: IET 00010001 SCSI SN: beaf11 Size: 17180 MB, Block size: 512 Online: Yes Removable media: No Prevent removal: No Readonly: No SWP: No Thin-provisioning: No Backing store type: aio Backing store path: /dev/vda Backing store flags: LUN: 2 Type: disk SCSI ID: IET 00010002 SCSI SN: beaf12 Size: 1074 MB, Block size: 512 Online: Yes Removable media: No Prevent removal: No Readonly: No SWP: No Thin-provisioning: No Backing store type: aio Backing store path: /dev/vdb Backing store flags: Account information: iscsiuser_in iscsiuser_out (outgoing) ACL information: ALL iqn.2018-04.org.example:initiator-host

isboot initiator:

sysctl net.isboot

net.isboot.device: net.isboot.nic: vtnet0 net.isboot.version: 0.2.15

sysctl hw.ibft

hw.ibft.verbose: 0 hw.ibft.acpi_table: 1 hw.ibft.nic_gateway: 0000:0000:0000:0000:0000:0000:0000:0000 hw.ibft.nic_prefix: 24 hw.ibft.target_lun: 256 hw.ibft.target_port: 3260 hw.ibft.target_address: 192.168.200.1 hw.ibft.target_name: iqn.2018-04.org.example:target-host hw.ibft.initiator_address: 192.168.200.8 hw.ibft.initiator_name: iqn.2018-04.org.example:initiator-host

camcontrol devlist

<IET Controller 0001> at scbus6 target 0 lun 0 (pass0) <IET VIRTUAL-DISK 0001> at scbus6 target 0 lun 1 (pass1,da0) <IET VIRTUAL-DISK 0001> at scbus6 target 0 lun 2 (pass2,da1)

camcontrol inquiry da0

pass1: <IET VIRTUAL-DISK 0001> Fixed Direct Access SPC-3 SCSI device pass1: Serial Number beaf11 pass1: 300.000MB/s transfers

camcontrol inquiry da1

pass2: <IET VIRTUAL-DISK 0001> Fixed Direct Access SPC-3 SCSI device pass2: Serial Number beaf12 pass2: 300.000MB/s transfers

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you modified the open/close state.Message ID: @.***>

jwmullally commented 1 year ago

Updated the previous comment with FreeBSD 13.1 version information.

I also briefly tested the latest code on FreeBSD 14.0-ALPHA3 and it seems to work correctly. It just needs 2 unused variables to be fixed before the new stricter kmod build will work.

# uname -a
FreeBSD freebsd14 14.0-ALPHA3 FreeBSD 14.0-ALPHA3 amd64 1400097 #0 stable/14-n265022-2af9390e54ed: Fri Aug 25 05:45:56 UTC 2023     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64

# git remote -v
origin  https://github.com/jnielsendotnet/isboot.git (fetch)
origin  https://github.com/jnielsendotnet/isboot.git (push)

# git rev-parse master
feac1fa3cdc0ce10e531c9fd3dd0421e730a9aa4

# cd src
# make
iscsi.c:1878:9: error: variable 'n' set but not used [-Werror,-Wunused-but-set-variable]
        int i, n;
               ^
iscsi.c:2739:32: error: variable 'ExpDataSN' set but not used [-Werror,-Wunused-but-set-variable]
        uint32_t DataSN __trace_used, ExpDataSN;
                                      ^

After removing those unused variables, the module builds and functions fine as before. n is clearly unused, but either ExpDataSN or DataSN might be needed to be fixed up for the TRACE output.