[Stgt-devel] support to close a connection by force and to shut down tgtd

FUJITA Tomonori fujita.tomonori
Sat Jul 12 15:05:18 CEST 2008


I added features:

- to drop an active connection by force (iSCSI)
- to shut down tgtd via tgtadm

The patchset against the lastest git is available at:

http://www.kernel.org/pub/linux/kernel/people/tomo/tgt/testing/

It includes the segfault fix so they are all you need.

A snapshot is also available:

http://www.kernel.org/pub/linux/kernel/people/tomo/tgt/testing/tgt-20080712-testing.tar.bz2


The features work like this:

root at iris:~/git# ./tgt/usr/tgtadm --op show --mode target
Target 1: iqn.2001-04.com.example:storage.disk2.iris.sys1.xyz
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
        I_T nexus: 1
            Initiator: iqn.2005-03.org.open-iscsi:9c9265148b3
            Connection: 0
                IP Address: 192.168.11.8
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: deadbeaf1:0
            SCSI SN: beaf10
            Size: 0 MB
            Online: Yes
            Removable media: No
            Backing store: No backing store
        LUN: 1
            Type: disk
            SCSI ID: deadbeaf1:1
            SCSI SN: beaf11
            Size: 2147 MB
            Online: Yes
            Removable media: No
            Backing store: /var/tmp/image0
    Account information:
    ACL information:
        192.168.11.8

You can remove the connection. An open-iscsi tries to reconnect after
that so you need to remove the ACL permission in advance.

root at iris:~/git# ./tgt/usr/tgtadm --op unbind --mode target --tid 1 -I 192.168.11.8

root at iris:~/git# ./tgt/usr/tgtadm --op show --mode target
Target 1: iqn.2001-04.com.example:storage.disk2.iris.sys1.xyz
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
        I_T nexus: 1
            Initiator: iqn.2005-03.org.open-iscsi:9c9265148b3
            Connection: 0
                IP Address: 192.168.11.8
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: deadbeaf1:0
            SCSI SN: beaf10
            Size: 0 MB
            Online: Yes
            Removable media: No
            Backing store: No backing store
        LUN: 1
            Type: disk
            SCSI ID: deadbeaf1:1
            SCSI SN: beaf11
            Size: 2147 MB
            Online: Yes
            Removable media: No
            Backing store: /var/tmp/image0
    Account information:
    ACL information:

The initiator still works but can't reconnect anymore. It's ready to
drop the connection.

root at iris:~/git# ./tgt/usr/tgtadm --op delete --mode conn --tid 1 --sid 1 --cid 0

root at iris:~/git# ./tgt/usr/tgtadm --op show --mode target
Target 1: iqn.2001-04.com.example:storage.disk2.iris.sys1.xyz
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: deadbeaf1:0
            SCSI SN: beaf10
            Size: 0 MB
            Online: Yes
            Removable media: No
            Backing store: No backing store
        LUN: 1
            Type: disk
            SCSI ID: deadbeaf1:1
            SCSI SN: beaf11
            Size: 2147 MB
            Online: Yes
            Removable media: No
            Backing store: /var/tmp/image0
    Account information:
    ACL information:

Next, let's shut down tgtd via tgtadm. You need to remove all the
targets in advance.

root at iris:~/git# ./tgt/usr/tgtadm --op delete --mode logicalunit --tid 1 --lun 1
root at iris:~/git# ./tgt/usr/tgtadm --op delete --mode target --tid 1

Then, you have no targets.

root at iris:~/git# ps ax|grep tgtd
 4672 ?        Ss     0:00 ./tgt/usr/tgtd
 4673 ?        S      0:00 ./tgt/usr/tgtd
 4714 pts/10   S+     0:00 grep tgtd

root at iris:~/git# ./tgt/usr/tgtadm --op delete --mode system
root at iris:~/git# ps ax|grep tgtd
 4719 pts/10   S+     0:00 grep tgtd





More information about the stgt mailing list