Skip to contentSkip to conversation

PATCH] iscsi:report unbind session event when the target has been removed

PATCH Wu Bo 2 participants 2 messages Mar 24, 2020 – Mar 28, 2020

Subsystems (2)
lore
Share & tools
lore

Wu Bo

author
#0 lore raw

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

---
 drivers/scsi/scsi_transport_iscsi.c | 4 +++-

 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/scsi_transport_iscsi.c +0 -0
index dfc726f..443ace0 100644
@@ -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

maintainer Reviewed-by
#1 lore raw
Quoted 49 lines · Wu Bo

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

---
 drivers/scsi/scsi_transport_iscsi.c | 4 +++-

 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/scsi_transport_iscsi.c +1 -1
index dfc726f..443ace0 100644
@@ -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;

drivers/scsi/scsi_transport_iscsi.c +2 -0
@@ -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");
Quoted 4 lines

 }

Signature · 1 line
1.8.3.1