[stgt] [PATCH 1/3] Add init script, empty targets.conf, and sysconfig file

Tomasz Chmielewski mangoo at wpkg.org
Wed Sep 30 14:12:46 CEST 2009

Florian Haas wrote:
> Imported from Red Hat scsi-target-utils package.

> +	daemon tgtd $TGTD_OPTIONS
> +
> +	# read the config 
> +	tgt-admin -e -c "${TGTD_CONFIG}"

Some short note here.

Rebooting a target is always a tricky operation, but is needed sometimes 
(kernel upgrade, hardware upgrade, tgtd upgrade etc.).

Initiators which are disconnected will try to reconnect (in open-iscsi, 
up to 120 seconds, by default) - which is good.

However with lots of targets configured, and with many initiators 
connected to all these targets, there is a short "window" when the 
initiators will want to connect, but tgtd will reply: "no such target 
here". And the initiator will fail (filesystem remounted read only, 
device offlined) - bad.

This one will start tgtd with no targets - any (re)connecting initiator 
will receive a "target offline" reply - which is non-fatal, and the 
initiator will still try to reconnect:

     daemon tgtd $TGTD_OPTIONS

Now, as the first target is configured, tgtd will no longer reply 
"target offline":

     tgt-admin -e -c "${TGTD_CONFIG}"

As tgt-admin keeps adding the targets to tgtd, it is possible that an 
initiator will try to reconnect to a not-yet-existing target (because 
tgt-admin still runs) - this will fail the initiator for good.

Therefore, it is safer to start tgtd and configure the targets with 
these commands:

         daemon tgtd $TGTD_OPTIONS
         tgtadm --op update --mode sys --name State -v offline
         tgt-admin -e -c "${TGTD_CONFIG}"
         tgtadm --op update --mode sys --name State -v ready

With just a few targets and few initiators connected, it's not very 
likely to spot it.
But as you have ~50 or more targets, ~10 or more initiators connected to 
these targets (making ~500 connections), it is relatively easy to spot. 
Perhaps easy to spot with even less initiators/targets configured.

Similar is valid for "forcedstop".

Tomasz Chmielewski
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

More information about the stgt mailing list