On 07/22/2009 09:09 AM, Erez Zilber wrote:
> Mike,
>
> I'm seeing from time to time the following scenario (although
> currently I'm not able to reproduce it):
>

No need to replicate it. I know what you are referring to.

> 1. A logout from a node is initiated by the user.
> 2. Before the logout completes, the user runs /etc/init.d/iscsi stop.
> The 'stop' method logs out from all nodes. When it tries to logout
> from the node that is already logging out (step #1), it fails because
> it is already logging out (see initiator.c::session_logout_task when
> conn->logout_qtask != NULL). Then, the 'stop' method kills iscsid.
> 3. The logout command form step #1 returns and notifies the (dead) daemon.
>
> I was thinking about something like this to solve that:
>
> diff --git a/etc/initd/initd.redhat b/etc/initd/initd.redhat
> index d68f135..55d35ec 100644
> --- a/etc/initd/initd.redhat
> +++ b/etc/initd/initd.redhat
> @@ -39,6 +39,11 @@ stop()
>          echo -n $"Stopping iSCSI initiator service: "
>          sync
>          iscsiadm -m node --logoutall=all
> +       RETVAL=$?
> +       if [ $RETVAL -ne 0 ]; then
> +               echo "Could not logout from all nodes, try again later"
> +               return $RETVAL
> +       fi
>          killproc iscsid
>          rm -f /var/run/iscsid.pid
>          [ $RETVAL -eq 0 ]&&  rm -f /var/lock/subsys/open-iscsi
> @@ -76,6 +81,10 @@ case "$1" in
>                          ;;
>          restart)
>                          stop
> +                       if [ $RETVAL -ne 0 ]; then
> +                               echo "Stopping iSCSI initiator service
> failed, not starting"
> +                               exit $RETVAL
> +                       fi
>                          start
>                          ;;
>          status)
>
> I'm not sure if there are other logout failure scenarios in which we
> want to shutdown the open-iscsi service anyway. If not, I guess that
> this fix (and a similar fix for SuSE&  Debian) should do the work.
>

This looks ok to me. We could make iscsid more complex and send 
notifications to multiple iscsiadm requests, but I am thinking this does 
not come up very much in normal use, so I am ok with the simple fix in 
the patch.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~----------~----~----~----~------~----~------~--~---

Reply via email to