Commit 8b4ead0f authored by Mike Christie's avatar Mike Christie Committed by Kleber Sacilotto de Souza

scsi: target: fix __transport_register_session locking

BugLink: https://bugs.launchpad.net/bugs/1798539

[ Upstream commit 6a64f6e1 ]

When __transport_register_session is called from transport_register_session
irqs will already have been disabled, so we do not want the unlock irq call
to enable them until the higher level has done the final
spin_unlock_irqrestore/ spin_unlock_irq.

This has __transport_register_session use the save/restore call.
Signed-off-by: default avatarMike Christie <mchristi@redhat.com>
Reviewed-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 2dfede95
...@@ -317,6 +317,7 @@ void __transport_register_session( ...@@ -317,6 +317,7 @@ void __transport_register_session(
{ {
const struct target_core_fabric_ops *tfo = se_tpg->se_tpg_tfo; const struct target_core_fabric_ops *tfo = se_tpg->se_tpg_tfo;
unsigned char buf[PR_REG_ISID_LEN]; unsigned char buf[PR_REG_ISID_LEN];
unsigned long flags;
se_sess->se_tpg = se_tpg; se_sess->se_tpg = se_tpg;
se_sess->fabric_sess_ptr = fabric_sess_ptr; se_sess->fabric_sess_ptr = fabric_sess_ptr;
...@@ -353,7 +354,7 @@ void __transport_register_session( ...@@ -353,7 +354,7 @@ void __transport_register_session(
se_sess->sess_bin_isid = get_unaligned_be64(&buf[0]); se_sess->sess_bin_isid = get_unaligned_be64(&buf[0]);
} }
spin_lock_irq(&se_nacl->nacl_sess_lock); spin_lock_irqsave(&se_nacl->nacl_sess_lock, flags);
/* /*
* The se_nacl->nacl_sess pointer will be set to the * The se_nacl->nacl_sess pointer will be set to the
* last active I_T Nexus for each struct se_node_acl. * last active I_T Nexus for each struct se_node_acl.
...@@ -362,7 +363,7 @@ void __transport_register_session( ...@@ -362,7 +363,7 @@ void __transport_register_session(
list_add_tail(&se_sess->sess_acl_list, list_add_tail(&se_sess->sess_acl_list,
&se_nacl->acl_sess_list); &se_nacl->acl_sess_list);
spin_unlock_irq(&se_nacl->nacl_sess_lock); spin_unlock_irqrestore(&se_nacl->nacl_sess_lock, flags);
} }
list_add_tail(&se_sess->sess_list, &se_tpg->tpg_sess_list); list_add_tail(&se_sess->sess_list, &se_tpg->tpg_sess_list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment