The daemon is restarted or crashed while logging out of a session.
The unbind session event sent by the kernel is not be processed or be lost.
When the daemon runs again, the session will never be able to logout.

After executing the logout again, the daemon is waiting for the unbind event message.
The kernel status has been logged out and the event will not be sent again.

#iscsiadm -m node iqn.xxx -p xx.xx.xx.xx -u &
#service iscsid restart

when iscsid restart done. logout session again report error:
#iscsiadm -m node iqn.xxxxx -p xx.xx.xx.xx -u
Logging out of session [sid: 6, target: iqn.xxxxx, portal: xx.xx.xx.xx,3260] iscsiadm: Could not logout of [sid: 6, target: iscsiadm -m node iqn.xxxxx, portal: xx.xx.xx.xx,3260].
iscsiadm: initiator reported error (9 - internal error)
iscsiadm: Could not logout of all requested sessions

Signed-off-by: Wu Bo <wub...@huawei.com>
---
 drivers/scsi/scsi_transport_iscsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index dfc726f..443ace0 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -2012,7 +2012,7 @@ static void __iscsi_unbind_session(struct work_struct *work)
        if (session->target_id == ISCSI_MAX_TARGET) {
                spin_unlock_irqrestore(&session->lock, flags);
                mutex_unlock(&ihost->mutex);
-               return;
+               goto unbind_session_exit;
        }

        target_id = session->target_id;
@@ -2024,6 +2024,8 @@ static void __iscsi_unbind_session(struct work_struct *work)
                ida_simple_remove(&iscsi_sess_ida, target_id);

        scsi_remove_target(&session->dev);
+
+unbind_session_exit:
        iscsi_session_event(session, ISCSI_KEVENT_UNBIND_SESSION);
        ISCSI_DBG_TRANS_SESSION(session, "Completed target removal\n");
 }
--
1.8.3.1

--
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/open-iscsi/7cce97f2-4dab-5105-a477-8869d5a4f150%40huawei.com.

Reply via email to