diff mbox series

[4/7] libiscsi: fix iscsi host workq destruction

Message ID 20210118203430.4921-5-michael.christie@oracle.com
State Superseded
Headers show
Series iscsi fixes/cleanups | expand

Commit Message

Mike Christie Jan. 18, 2021, 8:34 p.m. UTC
We allocate the iscsi host workq in iscsi_host_alloc so iscsi_host_free
should do the destruction. Drivers can then do their error/goto handling
and call iscsi_host_free to clean up what has been allocated in
iscsi_host_alloc.

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

Comments

Lee Duncan Jan. 27, 2021, 6:09 p.m. UTC | #1
On 1/18/21 12:34 PM, Mike Christie wrote:
> We allocate the iscsi host workq in iscsi_host_alloc so iscsi_host_free

> should do the destruction. Drivers can then do their error/goto handling

> and call iscsi_host_free to clean up what has been allocated in

> iscsi_host_alloc.

> 

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

> ---

>  drivers/scsi/libiscsi.c | 5 +++--

>  1 file changed, 3 insertions(+), 2 deletions(-)

> 

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

> index ec159bcb7460..b271d3accd2a 100644

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

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

> @@ -2738,8 +2738,6 @@ void iscsi_host_remove(struct Scsi_Host *shost)

>  		flush_signals(current);

>  

>  	scsi_remove_host(shost);

> -	if (ihost->workq)

> -		destroy_workqueue(ihost->workq);

>  }

>  EXPORT_SYMBOL_GPL(iscsi_host_remove);

>  

> @@ -2747,6 +2745,9 @@ void iscsi_host_free(struct Scsi_Host *shost)

>  {

>  	struct iscsi_host *ihost = shost_priv(shost);

>  

> +	if (ihost->workq)

> +		destroy_workqueue(ihost->workq);

> +

>  	kfree(ihost->netdev);

>  	kfree(ihost->hwaddress);

>  	kfree(ihost->initiatorname);

> 


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

Patch

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index ec159bcb7460..b271d3accd2a 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -2738,8 +2738,6 @@  void iscsi_host_remove(struct Scsi_Host *shost)
 		flush_signals(current);
 
 	scsi_remove_host(shost);
-	if (ihost->workq)
-		destroy_workqueue(ihost->workq);
 }
 EXPORT_SYMBOL_GPL(iscsi_host_remove);
 
@@ -2747,6 +2745,9 @@  void iscsi_host_free(struct Scsi_Host *shost)
 {
 	struct iscsi_host *ihost = shost_priv(shost);
 
+	if (ihost->workq)
+		destroy_workqueue(ihost->workq);
+
 	kfree(ihost->netdev);
 	kfree(ihost->hwaddress);
 	kfree(ihost->initiatorname);