Skip to content

Commit 13e60d3

Browse files
Wu Bomartinkpetersen
authored andcommitted
scsi: iscsi: Report unbind session event when the target has been removed
If the daemon is restarted or crashes while logging out of a session, the unbind session event sent by the kernel is not processed and is lost. When the daemon starts again, the session can't be unbound because the daemon is waiting for the event message. However, the kernel has already logged out and the event will not be resent. When iscsid restart is complete, logout session reports error: 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 Make sure the unbind event is emitted. [mkp: commit desc and applied by hand since patch was mangled] Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Lee Duncan <[email protected]> Signed-off-by: Wu Bo <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 763a18c commit 13e60d3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/scsi/scsi_transport_iscsi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2022,7 +2022,7 @@ static void __iscsi_unbind_session(struct work_struct *work)
20222022
if (session->target_id == ISCSI_MAX_TARGET) {
20232023
spin_unlock_irqrestore(&session->lock, flags);
20242024
mutex_unlock(&ihost->mutex);
2025-
return;
2025+
goto unbind_session_exit;
20262026
}
20272027

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

20362036
scsi_remove_target(&session->dev);
2037+
2038+
unbind_session_exit:
20372039
iscsi_session_event(session, ISCSI_KEVENT_UNBIND_SESSION);
20382040
ISCSI_DBG_TRANS_SESSION(session, "Completed target removal\n");
20392041
}

0 commit comments

Comments
 (0)