[Stgt-devel] [Scst-devel] Integration of SCST in the mainstream Linux kernel

FUJITA Tomonori tomof
Sun Feb 10 05:37:47 CET 2008

From: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>
Subject: Re: [Stgt-devel] [Scst-devel] Integration of SCST in the mainstream	Linux kernel
Date: Wed, 06 Feb 2008 09:12:47 +0900

> On Tue, 05 Feb 2008 18:04:52 +0100
> Tomasz Chmielewski <mangoo at wpkg.org> wrote:
> > FUJITA Tomonori schrieb:
> > 
> > (...)
> > 
> > >> The problem with tgtd is that you can't start it (configured) in an
> > >> "atomic" way.
> > >> Usually, one will start tgtd and it's configuration in a script (I 
> > >> replaced some parameters with "..." to make it shorter and more readable):
> > > 
> > > Thanks for the details. So the way to stop the daemon is not related
> > > with your problem.
> > > 
> > > It's easily fixable. Can you start a new thread about this on
> > > stgt-devel mailing list? When we agree on the interface to start the
> > > daemon, I'll implement it.
> > 
> > Sure.
> > 
> > 1. tgtd should not immediately background, but only when it's fully started?
> > 
> > 2. tgtd should only start to listen if told so? tgtdadm --listen/--nolisten?
> I was thinking about something like:
> tgtadm --op update --mode sys --name state -v running

I've just realized that tgt already has something like that, which
might work for you.

tgt has the state of a target device. See 'Status: offline':

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
        Status: offline
    I_T nexus information:
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: deadbeaf1:0
            SCSI SN: beaf10
            Size: 0 MB
            Online: Yes
            Poweron/Reset: 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
            Poweron/Reset: Yes
            Removable media: No
            Backing store: /var/tmp/image0
    Account information:
    ACL information:

If the state is 'offline', the daemon tells the initiator that there
is an error on the target side. Then open-iscsi tries to reconnect to
the target, I think.

By default, the sate of a target device 'running'. So there is a race
between the first and second operations (that is, you need to peform
the second right after the first, before the initiator tries to
connect). I'm fine with changing the default state to 'offline'.

tgtadm --op new --mode target --tid 1 -T iqn.2001-04.com.example:storage.disk2.iris.sys1.xyz
tgtadm --op update --mode target --tid 1 -n state -v offline
tgtadm --op new --mode logicalunit --tid 1 --lun 1 -b /var/tmp/image0
tgtadm --op bind --mode target --tid 1 -I ALL
tgtadm --op update --mode target --tid 1 -n state -v running

More information about the stgt mailing list