Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvmet-tcp: remove a redundant line in nvmet_tcp_release_queue_work
@ 2025-10-06 17:59 Tomas Henzl
  2025-10-07  6:26 ` Maurizio Lombardi
  0 siblings, 1 reply; 4+ messages in thread
From: Tomas Henzl @ 2025-10-06 17:59 UTC (permalink / raw)
  To: linux-nvme, sagi; +Cc: kbusch

cancel_work_sync(&queue->io_work) is called twice, remove the
second instance.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
---
 drivers/nvme/target/tcp.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index 470bf37e5a63..a1d0f6b18b2c 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -1577,7 +1577,6 @@ static void nvmet_tcp_release_queue_work(struct work_struct *w)
 	nvmet_tcp_uninit_data_in_cmds(queue);
 	nvmet_sq_destroy(&queue->nvme_sq);
 	nvmet_cq_put(&queue->nvme_cq);
-	cancel_work_sync(&queue->io_work);
 	nvmet_tcp_free_cmd_data_in_buffers(queue);
 	/* ->sock will be released by fput() */
 	fput(queue->sock->file);
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvmet-tcp: remove a redundant line in nvmet_tcp_release_queue_work
  2025-10-06 17:59 [PATCH] nvmet-tcp: remove a redundant line in nvmet_tcp_release_queue_work Tomas Henzl
@ 2025-10-07  6:26 ` Maurizio Lombardi
  2025-10-07  6:46   ` Maurizio Lombardi
  0 siblings, 1 reply; 4+ messages in thread
From: Maurizio Lombardi @ 2025-10-07  6:26 UTC (permalink / raw)
  To: Tomas Henzl, linux-nvme, sagi; +Cc: kbusch

On Mon Oct 6, 2025 at 7:59 PM CEST, Tomas Henzl wrote:
> cancel_work_sync(&queue->io_work) is called twice, remove the
> second instance.
>
> Signed-off-by: Tomas Henzl <thenzl@redhat.com>
> ---
>  drivers/nvme/target/tcp.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
> index 470bf37e5a63..a1d0f6b18b2c 100644
> --- a/drivers/nvme/target/tcp.c
> +++ b/drivers/nvme/target/tcp.c
> @@ -1577,7 +1577,6 @@ static void nvmet_tcp_release_queue_work(struct work_struct *w)
>  	nvmet_tcp_uninit_data_in_cmds(queue);
>  	nvmet_sq_destroy(&queue->nvme_sq);
>  	nvmet_cq_put(&queue->nvme_cq);
> -	cancel_work_sync(&queue->io_work);
>  	nvmet_tcp_free_cmd_data_in_buffers(queue);
>  	/* ->sock will be released by fput() */
>  	fput(queue->sock->file);

I am not sure it's safe to remove it because io_work can potentially
re-enqueue itself.

The second call to cancel_work_sync(), after rcv_state is set to
NVMET_TCP_RECV_ERR, should ensure that no more "io_work"s are pending
on the workqueue.

Maurizio


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvmet-tcp: remove a redundant line in nvmet_tcp_release_queue_work
  2025-10-07  6:26 ` Maurizio Lombardi
@ 2025-10-07  6:46   ` Maurizio Lombardi
  2025-10-13 15:46     ` Tomas Henzl
  0 siblings, 1 reply; 4+ messages in thread
From: Maurizio Lombardi @ 2025-10-07  6:46 UTC (permalink / raw)
  To: Maurizio Lombardi, Tomas Henzl, linux-nvme, sagi; +Cc: kbusch

On Tue Oct 7, 2025 at 8:26 AM CEST, Maurizio Lombardi wrote:
> On Mon Oct 6, 2025 at 7:59 PM CEST, Tomas Henzl wrote:
>> cancel_work_sync(&queue->io_work) is called twice, remove the
>> second instance.
>>
>> Signed-off-by: Tomas Henzl <thenzl@redhat.com>
>> ---
>>  drivers/nvme/target/tcp.c | 1 -
>>  1 file changed, 1 deletion(-)
>>
>> diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
>> index 470bf37e5a63..a1d0f6b18b2c 100644
>> --- a/drivers/nvme/target/tcp.c
>> +++ b/drivers/nvme/target/tcp.c
>> @@ -1577,7 +1577,6 @@ static void nvmet_tcp_release_queue_work(struct work_struct *w)
>>  	nvmet_tcp_uninit_data_in_cmds(queue);
>>  	nvmet_sq_destroy(&queue->nvme_sq);
>>  	nvmet_cq_put(&queue->nvme_cq);
>> -	cancel_work_sync(&queue->io_work);
>>  	nvmet_tcp_free_cmd_data_in_buffers(queue);
>>  	/* ->sock will be released by fput() */
>>  	fput(queue->sock->file);
>
> I am not sure it's safe to remove it because io_work can potentially
> re-enqueue itself.
>

Small correction, the problem isn't io_work re-enqueing itself
(the first cancel_work_sync() prevents that); I think the real problem
is that nvmet_sq_destroy() could end up calling
nvmet_tcp_queue_response() which enqueues io_work again.

Maurizio



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvmet-tcp: remove a redundant line in nvmet_tcp_release_queue_work
  2025-10-07  6:46   ` Maurizio Lombardi
@ 2025-10-13 15:46     ` Tomas Henzl
  0 siblings, 0 replies; 4+ messages in thread
From: Tomas Henzl @ 2025-10-13 15:46 UTC (permalink / raw)
  To: Maurizio Lombardi, linux-nvme, sagi; +Cc: kbusch

On 10/7/25 8:46 AM, Maurizio Lombardi wrote:
> On Tue Oct 7, 2025 at 8:26 AM CEST, Maurizio Lombardi wrote:
>> On Mon Oct 6, 2025 at 7:59 PM CEST, Tomas Henzl wrote:
>>> cancel_work_sync(&queue->io_work) is called twice, remove the
>>> second instance.
>>>
>>> Signed-off-by: Tomas Henzl <thenzl@redhat.com>
>>> ---
>>>  drivers/nvme/target/tcp.c | 1 -
>>>  1 file changed, 1 deletion(-)
>>>
>>> diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
>>> index 470bf37e5a63..a1d0f6b18b2c 100644
>>> --- a/drivers/nvme/target/tcp.c
>>> +++ b/drivers/nvme/target/tcp.c
>>> @@ -1577,7 +1577,6 @@ static void nvmet_tcp_release_queue_work(struct work_struct *w)
>>>  	nvmet_tcp_uninit_data_in_cmds(queue);
>>>  	nvmet_sq_destroy(&queue->nvme_sq);
>>>  	nvmet_cq_put(&queue->nvme_cq);
>>> -	cancel_work_sync(&queue->io_work);
>>>  	nvmet_tcp_free_cmd_data_in_buffers(queue);
>>>  	/* ->sock will be released by fput() */
>>>  	fput(queue->sock->file);
>>
>> I am not sure it's safe to remove it because io_work can potentially
>> re-enqueue itself.
>>
> 
> Small correction, the problem isn't io_work re-enqueing itself
> (the first cancel_work_sync() prevents that); I think the real problem
> is that nvmet_sq_destroy() could end up calling
> nvmet_tcp_queue_response() which enqueues io_work again.

The NVMET_TCP_RECV_ERR sate would make the workqueue finish quickly but
sure we don't want a running workqueue.

Let's drop this patch.

tomash

> 
> Maurizio
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-10-13 15:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-06 17:59 [PATCH] nvmet-tcp: remove a redundant line in nvmet_tcp_release_queue_work Tomas Henzl
2025-10-07  6:26 ` Maurizio Lombardi
2025-10-07  6:46   ` Maurizio Lombardi
2025-10-13 15:46     ` Tomas Henzl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox