diff mbox series

[for-next] RDMA/core: Flush workqueue before destroy it

Message ID 1617698091-47439-1-git-send-email-liweihang@huawei.com (mailing list archive)
State Rejected
Delegated to: Leon Romanovsky
Headers show
Series [for-next] RDMA/core: Flush workqueue before destroy it | expand

Commit Message

Weihang Li April 6, 2021, 8:34 a.m. UTC
From: Yixian Liu <liuyixian@huawei.com>

It is safer to flush the workqueue before destroying it.

Signed-off-by: Yixian Liu <liuyixian@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
---
 drivers/infiniband/core/addr.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Leon Romanovsky April 6, 2021, 8:45 a.m. UTC | #1
On Tue, Apr 06, 2021 at 04:34:51PM +0800, Weihang Li wrote:
> From: Yixian Liu <liuyixian@huawei.com>
> 
> It is safer to flush the workqueue before destroying it.

Sorry, safer for what?

destroy_workqueue() flushes workqueue internally. There is no need to do
it twice.

Thanks

> 
> Signed-off-by: Yixian Liu <liuyixian@huawei.com>
> Signed-off-by: Weihang Li <liweihang@huawei.com>
> ---
>  drivers/infiniband/core/addr.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
> index 0abce00..e58a06b 100644
> --- a/drivers/infiniband/core/addr.c
> +++ b/drivers/infiniband/core/addr.c
> @@ -883,6 +883,7 @@ int addr_init(void)
>  void addr_cleanup(void)
>  {
>  	unregister_netevent_notifier(&nb);
> +	flush_workqueue(addr_wq);
>  	destroy_workqueue(addr_wq);
>  	WARN_ON(!list_empty(&req_list));
>  }
> -- 
> 2.8.1
>
Weihang Li April 6, 2021, 1:29 p.m. UTC | #2
On 2021/4/6 16:45, Leon Romanovsky wrote:
> On Tue, Apr 06, 2021 at 04:34:51PM +0800, Weihang Li wrote:
>> From: Yixian Liu <liuyixian@huawei.com>
>>
>> It is safer to flush the workqueue before destroying it.
> Sorry, safer for what?
> 
> destroy_workqueue() flushes workqueue internally. There is no need to do
> it twice.
> 
> Thanks
> 

My bad, thank you for reminding :)

Weihang
diff mbox series

Patch

diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index 0abce00..e58a06b 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -883,6 +883,7 @@  int addr_init(void)
 void addr_cleanup(void)
 {
 	unregister_netevent_notifier(&nb);
+	flush_workqueue(addr_wq);
 	destroy_workqueue(addr_wq);
 	WARN_ON(!list_empty(&req_list));
 }