diff mbox series

[3/3] iscsi class: remove sessdestroylist

Message ID 1593632868-6808-4-git-send-email-michael.christie@oracle.com (mailing list archive)
State Mainlined
Commit 93bf02e5a2c2418bc290a778cd537837d789d9ee
Headers show
Series misc iscsi changes for 5.9 | expand

Commit Message

Mike Christie July 1, 2020, 7:47 p.m. UTC
Just delete the sess from the session list instead of adding it to some
list we never use.

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

Comments

Lee Duncan July 1, 2020, 8:56 p.m. UTC | #1
On 7/1/20 12:47 PM, Mike Christie wrote:
> Just delete the sess from the session list instead of adding it to some
> list we never use.
> 
> Signed-off-by: Mike Christie <michael.christie@oracle.com>
> ---
>  drivers/scsi/scsi_transport_iscsi.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
> index 80b442a2b4c8..60e6bde1e96c 100644
> --- a/drivers/scsi/scsi_transport_iscsi.c
> +++ b/drivers/scsi/scsi_transport_iscsi.c
> @@ -1623,7 +1623,6 @@ static DEFINE_MUTEX(rx_queue_mutex);
>  static DEFINE_MUTEX(conn_mutex);
>  
>  static LIST_HEAD(sesslist);
> -static LIST_HEAD(sessdestroylist);
>  static DEFINE_SPINLOCK(sesslock);
>  static LIST_HEAD(connlist);
>  static LIST_HEAD(connlist_err);
> @@ -2203,7 +2202,8 @@ void iscsi_remove_session(struct iscsi_cls_session *session)
>  	ISCSI_DBG_TRANS_SESSION(session, "Removing session\n");
>  
>  	spin_lock_irqsave(&sesslock, flags);
> -	list_del(&session->sess_list);
> +	if (!list_empty(&session->sess_list))
> +		list_del(&session->sess_list);
>  	spin_unlock_irqrestore(&sesslock, flags);
>  
>  	flush_work(&session->block_work);
> @@ -3678,7 +3678,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)
>  
>  			/* Prevent this session from being found again */
>  			spin_lock_irqsave(&sesslock, flags);
> -			list_move(&session->sess_list, &sessdestroylist);
> +			list_del_init(&session->sess_list);
>  			spin_unlock_irqrestore(&sesslock, flags);
>  
>  			queue_work(iscsi_destroy_workq, &session->destroy_work);
> 

So is sessdestroylist still needed?
Mike Christie July 2, 2020, 1:32 a.m. UTC | #2
On 7/1/20 3:56 PM, Lee Duncan wrote:
> On 7/1/20 12:47 PM, Mike Christie wrote:
>> Just delete the sess from the session list instead of adding it to some
>> list we never use.
>>
>> Signed-off-by: Mike Christie <michael.christie@oracle.com>
>> ---
>>  drivers/scsi/scsi_transport_iscsi.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
>> index 80b442a2b4c8..60e6bde1e96c 100644
>> --- a/drivers/scsi/scsi_transport_iscsi.c
>> +++ b/drivers/scsi/scsi_transport_iscsi.c
>> @@ -1623,7 +1623,6 @@ static DEFINE_MUTEX(rx_queue_mutex);
>>  static DEFINE_MUTEX(conn_mutex);
>>  
>>  static LIST_HEAD(sesslist);
>> -static LIST_HEAD(sessdestroylist);
>>  static DEFINE_SPINLOCK(sesslock);
>>  static LIST_HEAD(connlist);
>>  static LIST_HEAD(connlist_err);
>> @@ -2203,7 +2202,8 @@ void iscsi_remove_session(struct iscsi_cls_session *session)
>>  	ISCSI_DBG_TRANS_SESSION(session, "Removing session\n");
>>  
>>  	spin_lock_irqsave(&sesslock, flags);
>> -	list_del(&session->sess_list);
>> +	if (!list_empty(&session->sess_list))
>> +		list_del(&session->sess_list);
>>  	spin_unlock_irqrestore(&sesslock, flags);
>>  
>>  	flush_work(&session->block_work);
>> @@ -3678,7 +3678,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)
>>  
>>  			/* Prevent this session from being found again */
>>  			spin_lock_irqsave(&sesslock, flags);
>> -			list_move(&session->sess_list, &sessdestroylist);
>> +			list_del_init(&session->sess_list);
>>  			spin_unlock_irqrestore(&sesslock, flags);
>>  
>>  			queue_work(iscsi_destroy_workq, &session->destroy_work);
>>
> 
> So is sessdestroylist still needed?

Yes. I'm not sure what happened. It got added in a recent patch and that was the only use.
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 80b442a2b4c8..60e6bde1e96c 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -1623,7 +1623,6 @@  static DEFINE_MUTEX(rx_queue_mutex);
 static DEFINE_MUTEX(conn_mutex);
 
 static LIST_HEAD(sesslist);
-static LIST_HEAD(sessdestroylist);
 static DEFINE_SPINLOCK(sesslock);
 static LIST_HEAD(connlist);
 static LIST_HEAD(connlist_err);
@@ -2203,7 +2202,8 @@  void iscsi_remove_session(struct iscsi_cls_session *session)
 	ISCSI_DBG_TRANS_SESSION(session, "Removing session\n");
 
 	spin_lock_irqsave(&sesslock, flags);
-	list_del(&session->sess_list);
+	if (!list_empty(&session->sess_list))
+		list_del(&session->sess_list);
 	spin_unlock_irqrestore(&sesslock, flags);
 
 	flush_work(&session->block_work);
@@ -3678,7 +3678,7 @@  iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)
 
 			/* Prevent this session from being found again */
 			spin_lock_irqsave(&sesslock, flags);
-			list_move(&session->sess_list, &sessdestroylist);
+			list_del_init(&session->sess_list);
 			spin_unlock_irqrestore(&sesslock, flags);
 
 			queue_work(iscsi_destroy_workq, &session->destroy_work);