[Pkg-iscsi-maintainers] Bug#838540: open-iscsi logout-all.sh script fails to log out iscsi target

Christian Seiler christian at iwakd.de
Thu Sep 22 09:31:41 UTC 2016


Hi,

On 09/22/2016 03:06 AM, Colby Ross wrote:
> So, it appears the command being issued is /bin/iscsiadm -m node
> --logoutall=all. When I try that command, I get the same error as
> when I try to run the script. The logout-all.sh script contains this
> function that invokes that command:> # trivial case
> if [ -z "$EXCLUDED_SESSIONS" ] ; then
>         $ISCSIADM -m node --logoutall=all
>         exit $?
> fi
> 
> I don't know scripting language very well at all, but it is
> apparently not finding the session to terminate correctly. When I
> manually log out of the session, it reboots and shuts down normally
> with no issues. Maybe this part of the script is being called in
> error, I'm not sure. When I replace the command with $ISCSIADM -m
> node -u, it reboots and shuts down fine, but I consider this more of
> a hack than a true fix.

This is weird, I cannot reproduce this here. I logged into a
new iSCSI session, and after the login I immediately called

iscsiadm -m node --logoutall=all

In that case, the logout worked for me.

(Note that we don't consider return code 21 an error in the
shutdown logic, because if you just install open-iscsi and
there are no sessions configured, iscsiadm will also return
that error code - which is perfectly fine there, as there
really are no sessions in that case. See the systemd service
file's SuccessExitStatus line. Doesn't help here though,
because you clearly have an active session.)

On a running system with the iSCSI session logged in, could
you post the contents of

iscsiadm -m node -p $PORTAL -T $TARGET -P1

to this bug report?

The command is harmless and will leave the session intact. You
can run it on a production system. Replace $PORTAL with your
portal IP and $TARGET with the target, you can find them out by
using iscsiadm -m node -P1, which is also harmless.

(I don't care about IP addresses or target names, they shouldn't
be relevant to this, so feel free to censor them.)

> I previously tried to determine the cause of the hang on
> reboot/shutdown. What happens is the system tries to ping the iscsi
> target, but fails because the network interface has already been
> brought down, and the system hangs indefinitely. I get the error
> connection1:0: ping timeout of 5 secs expired, recv timeout 5, last
> rx 4294927718, last ping 4294928970, now 4294930224. However, I think
> the error is just an indication the target was not logged out
> properly and the system thinks its still connected.

This is a kind of known issue: if a session is still open and the
network interface is deconfigured, the system hangs for a long
time. If a logout wasn't possible, the only proper thing to do
would actually be to not deconfigure the network interface.

ifupdown already contains such logic when iSCSI is used for the
root filesystem, because it checks if /etc/iscsi/iscsi.initramfs
is present and refuses to deconfigure on shutdown if it is. We
should really make this a lot more dynamical: if there are still
iSCSI sessions left over after shutdown (for whatever reason),
we should simply keep the network interface up and running - and
not just if iSCSI is used in the initramfs. Feel free to open a
separate bug report for this.

That makes the problem that logout doesn't work in your case so
much worse, but it isn't the root cause of your problem. The
output of the iscsiadm command would be helpful for debugging
this.

Regards,
Christian



More information about the Pkg-iscsi-maintainers mailing list