[Pkg-iscsi-maintainers] Bug#809334: Bug#809334: Bug#809334: Bug#809320: open-iscsi: no session termination on stop

Ritesh Raj Sarraf rrs at debian.org
Sun Feb 7 10:38:04 UTC 2016


On Sun, 2016-02-07 at 15:11 +0530, Ritesh Raj Sarraf wrote:
> 
> root at debian-sanboot:~# systemctl stop open-iscsi
> 
> root at debian-sanboot:~# cat /run/open-iscsi/shutdown-keep-sessions 
> /sys/devices/platform/host2/session1
> /sys/devices/platform/host3/session2
> /sys/devices/platform/host4/session3
> /sys/devices/platform/host5/session4
> 
> 
> root at debian-sanboot:~# iscsiadm -m session
> iscsiadm: No active sessions.
> 
> From the workflow you've explained so far, the mention of certain
> sessions in /run/o-i/s-k-s should have been honored.

I think I have the bug now.


The code snippet in /lib/open-iscsi/logout-all.sh

# go through all iSCSI sessions, but exclude those where we don't want
# to logout from
RC=0
for host_dir in /sys/devices/platform/host* ; do
        [ -d "$host_dir"/iscsi_host* ] || continue
        for session_dir in "$host_dir"/session* ; do
                if in_set EXCLUDED_SESSIONS "$session_dir" ; then
                        continue
                fi
                $ISCSIADM -m session -r "$session_dir" --logout
                rc=$?
                if [ $rc -ne 0 ] ; then
                        RC=1
                fi
        done
done



This is suppsed to compare against EXCLUDED_SESSION, that is read
from /run/open-iscsi/shutdown-keep-sessions, which is populated by
/lib/open-iscsi/umountiscsi.sh

The bug is that even if it finds the session in the list, it doesn't
bypass it. Instead, it just proceeds with logout. See log below.


Feb 07 15:49:55 debian-sanboot logout-all.sh[967]: + rc=0
Feb 07 15:49:55 debian-sanboot logout-all.sh[967]: + [ 0 -ne 0 ]
Feb 07 15:49:55 debian-sanboot logout-all.sh[967]: + [ -d
/sys/devices/platform/host4/iscsi_host ]
Feb 07 15:49:55 debian-sanboot logout-all.sh[967]: + in_set
EXCLUDED_SESSIONS /sys/devices/platform/host4/session3
Feb 07 15:49:55 debian-sanboot logout-all.sh[967]: + eval
_set=$EXCLUDED_SESSIONS
Feb 07 15:49:55 debian-sanboot logout-all.sh[967]: +
_set=/sys/devices/platform/host2/session1
Feb 07 15:49:55 debian-sanboot logout-all.sh[967]:
/sys/devices/platform/host3/session2
Feb 07 15:49:55 debian-sanboot logout-all.sh[967]:
/sys/devices/platform/host4/session3
Feb 07 15:49:55 debian-sanboot logout-all.sh[967]:
/sys/devices/platform/host5/session4
Feb 07 15:49:55 debian-sanboot logout-all.sh[967]: + return 1
Feb 07 15:49:55 debian-sanboot logout-all.sh[967]: + /sbin/iscsiadm -m
session -r /sys/devices/platform/host4/session3 --logout


Changing the evaluation to 
if ! in_set EXCLUDED_SESSIONS "$session_dir" ; then

properly bypasses the matching sessions.

Feb 07 15:56:57 debian-sanboot logout-all.sh[1352]: + [ -d
/sys/devices/platform/host6/iscsi_host ]
Feb 07 15:56:57 debian-sanboot logout-all.sh[1352]: + in_set
EXCLUDED_SESSIONS /sys/devices/platform/host6/session5
Feb 07 15:56:57 debian-sanboot logout-all.sh[1352]: + eval
_set=$EXCLUDED_SESSIONS
Feb 07 15:56:57 debian-sanboot logout-all.sh[1352]: +
_set=/sys/devices/platform/host6/session5
Feb 07 15:56:57 debian-sanboot logout-all.sh[1352]:
/sys/devices/platform/host7/session6
Feb 07 15:56:57 debian-sanboot logout-all.sh[1352]:
/sys/devices/platform/host8/session7
Feb 07 15:56:57 debian-sanboot logout-all.sh[1352]:
/sys/devices/platform/host9/session8
Feb 07 15:56:57 debian-sanboot logout-all.sh[1352]: + return 1
Feb 07 15:56:57 debian-sanboot logout-all.sh[1352]: + continue




I just tested it with my sanboot setup and now it works fine. THe
shutdowns don't hang anymore.


-- 
Ritesh Raj Sarraf | http://people.debian.org/~rrs
Debian - The Universal Operating System
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <http://lists.alioth.debian.org/pipermail/pkg-iscsi-maintainers/attachments/20160207/44717f94/attachment-0001.sig>


More information about the Pkg-iscsi-maintainers mailing list