tgt : handling of missing session logout from initiator

Gilles BULOZ <[email protected]> Wed, 11 Jun 2025 19:29:40 +0200
Newsgroups org.kernel.vger.stgt
Organization Kontron Modular Computers SA
Message-ID <[email protected]>
Sorry for overhead, but I'm unable to find any answer to this question.

I use a diskless board that is booted from a PXE server and is mounting its
rootfs from an iSCSI target on this server running tgtd. OS is Fedora 41.

The problem is that on diskless shutdown/reboot, the rootfs is cleanly unmounted
but no session logout is sent to the server. So at next diskles boot, another
session is created but the old one is still there. As a workaround I can manually
delete these old sessions by running something like this on the server :
tgtadm --op delete --mode conn --tid x --sid y --cid z
I've found another workaround for that that is to run a logout from a script that
is run by the diskless board near the end of its shutdown.

But the issue is still there is the diskless is brutally reset or power-cycled
(occurs very often in the embedded world) because of no session logout.

I'm wondering why a session from the same initiator to the same target could not
automatically delete older sessions.

Also I'm wondering if there's some sort of timeout to enable to have old
sessions automatically deleted if the connection to the initiator is broken.

Should I really care about these old sessions or do with them ? The problem is
see with them is that stopping tgtd from a command or shutting down the server
hangs for ~40s seconds because of these old sessions.

Thanks for your answers

Gilles Buloz
Kontron Modular Computers