[03/15] target: fix __transport_register_session locking
diff mbox

Message ID 1531696591-8558-4-git-send-email-mchristi@redhat.com
State New, archived
Headers show

Commit Message

Mike Christie July 15, 2018, 11:16 p.m. UTC
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: Mike Christie <mchristi@redhat.com>
---
 drivers/target/target_core_transport.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Bart Van Assche July 18, 2018, 10:11 p.m. UTC | #1
On Sun, 2018-07-15 at 18:16 -0500, Mike Christie wrote:
> 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.

Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>


--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christoph Hellwig July 19, 2018, 8:38 p.m. UTC | #2
On Sun, Jul 15, 2018 at 06:16:19PM -0500, Mike Christie wrote:
> 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.

if you use up your line length this could be:

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.

Can be condensed as well.

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 6324743..75ddbbb 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -347,6 +347,7 @@  void __transport_register_session(
 {
 	const struct target_core_fabric_ops *tfo = se_tpg->se_tpg_tfo;
 	unsigned char buf[PR_REG_ISID_LEN];
+	unsigned long flags;
 
 	se_sess->se_tpg = se_tpg;
 	se_sess->fabric_sess_ptr = fabric_sess_ptr;
@@ -384,7 +385,7 @@  void __transport_register_session(
 			WARN_ON(hex2bin((u8 *)&se_sess->sess_bin_isid, buf, 6));
 		}
 
-		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
 		 * last active I_T Nexus for each struct se_node_acl.
@@ -393,7 +394,7 @@  void __transport_register_session(
 
 		list_add_tail(&se_sess->sess_acl_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);