diff mbox series

[04/15] iscsi class: drop session lock in iscsi_session_chkready

Message ID 1606858196-5421-5-git-send-email-michael.christie@oracle.com
State Superseded
Headers show
Series libiscsi: lock clean ups | expand

Commit Message

Mike Christie Dec. 1, 2020, 9:29 p.m. UTC
The session lock in iscsi_session_chkready is not needed because when we
transition from logged into to another state we will blocked and/or
remove the devices under the session, so no new IO will be sent the
drivers after the block/remove. IO that races with the block/removal is
cleaned up by the drivers when it handles all outstanding IO, so this
just added an extra lock in the main IO path. This patch removes the
lock like other transport classes.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/scsi/scsi_transport_iscsi.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Lee Duncan Dec. 3, 2020, 9:08 p.m. UTC | #1
On 12/1/20 1:29 PM, Mike Christie wrote:
> The session lock in iscsi_session_chkready is not needed because when we

> transition from logged into to another state we will blocked and/or

> remove the devices under the session, so no new IO will be sent the

> drivers after the block/remove. IO that races with the block/removal is

> cleaned up by the drivers when it handles all outstanding IO, so this

> just added an extra lock in the main IO path. This patch removes the

> lock like other transport classes.

> 

> Signed-off-by: Mike Christie <michael.christie@oracle.com>

> ---

>  drivers/scsi/scsi_transport_iscsi.c | 3 ---

>  1 file changed, 3 deletions(-)

> 

> diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c

> index 2eb3e4f..e9ad04a 100644

> --- a/drivers/scsi/scsi_transport_iscsi.c

> +++ b/drivers/scsi/scsi_transport_iscsi.c

> @@ -1701,10 +1701,8 @@ static const char *iscsi_session_state_name(int state)

>  

>  int iscsi_session_chkready(struct iscsi_cls_session *session)

>  {

> -	unsigned long flags;

>  	int err;

>  

> -	spin_lock_irqsave(&session->lock, flags);

>  	switch (session->state) {

>  	case ISCSI_SESSION_LOGGED_IN:

>  		err = 0;

> @@ -1719,7 +1717,6 @@ int iscsi_session_chkready(struct iscsi_cls_session *session)

>  		err = DID_NO_CONNECT << 16;

>  		break;

>  	}

> -	spin_unlock_irqrestore(&session->lock, flags);

>  	return err;

>  }

>  EXPORT_SYMBOL_GPL(iscsi_session_chkready);

> 


Reviewed-by: Lee Duncan <lduncan@suse.com>
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 2eb3e4f..e9ad04a 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -1701,10 +1701,8 @@  static const char *iscsi_session_state_name(int state)
 
 int iscsi_session_chkready(struct iscsi_cls_session *session)
 {
-	unsigned long flags;
 	int err;
 
-	spin_lock_irqsave(&session->lock, flags);
 	switch (session->state) {
 	case ISCSI_SESSION_LOGGED_IN:
 		err = 0;
@@ -1719,7 +1717,6 @@  int iscsi_session_chkready(struct iscsi_cls_session *session)
 		err = DID_NO_CONNECT << 16;
 		break;
 	}
-	spin_unlock_irqrestore(&session->lock, flags);
 	return err;
 }
 EXPORT_SYMBOL_GPL(iscsi_session_chkready);