mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
scsi: iscsi: Delay freeing target_id
If we are doing async removal of the session, we could be doing a scsi_remove_target from the removal workqueue, and for the offload case we could be doing a new session addition and scan to the same host. The add/scan might then end up trying to use the target_id of the target we are removing. This patch just has a delay the freeing of the target_id until after the scsi_remove_target has completed, so we know it's no longer in use. Link: https://lore.kernel.org/r/1593632868-6808-2-git-send-email-michael.christie@oracle.com Reviewed-by: Lee Duncan <lduncan@suse.com> Signed-off-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
6292130093
commit
e463f96bdc
1 changed files with 2 additions and 2 deletions
|
@ -2036,11 +2036,11 @@ static void __iscsi_unbind_session(struct work_struct *work)
|
||||||
spin_unlock_irqrestore(&session->lock, flags);
|
spin_unlock_irqrestore(&session->lock, flags);
|
||||||
mutex_unlock(&ihost->mutex);
|
mutex_unlock(&ihost->mutex);
|
||||||
|
|
||||||
|
scsi_remove_target(&session->dev);
|
||||||
|
|
||||||
if (session->ida_used)
|
if (session->ida_used)
|
||||||
ida_simple_remove(&iscsi_sess_ida, target_id);
|
ida_simple_remove(&iscsi_sess_ida, target_id);
|
||||||
|
|
||||||
scsi_remove_target(&session->dev);
|
|
||||||
|
|
||||||
unbind_session_exit:
|
unbind_session_exit:
|
||||||
iscsi_session_event(session, ISCSI_KEVENT_UNBIND_SESSION);
|
iscsi_session_event(session, ISCSI_KEVENT_UNBIND_SESSION);
|
||||||
ISCSI_DBG_TRANS_SESSION(session, "Completed target removal\n");
|
ISCSI_DBG_TRANS_SESSION(session, "Completed target removal\n");
|
||||||
|
|
Loading…
Reference in a new issue