nvmet-tcp: remove a redundant line in nvmet_tcp_release_queue_work
Subsystems (2)
PATCH 1/1 nvmet-tcp: remove a redundant line in nvmet_tcp_release_queue_work
cancel_work_sync(&queue->io_work) is called twice, remove the second instance.
--- drivers/nvme/target/tcp.c | 1 - 1 file changed, 1 deletion(-)
drivers/nvme/target/tcp.c +0 -1
@@ -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);
Signature · 1 line
2.51.0
Quoted 13 lines · Tomas Henzl
cancel_work_sync(&queue->io_work)is called twice, remove the second instance.Signed-off-by Tomas Henzl <[email protected]>--- drivers/nvme/target/tcp.c | 1 - 1 file changed, 1 deletion(-)drivers/nvme/target/tcp.c +0
-0
drivers/nvme/target/tcp.c static void nvmet_tcp_release_queue_work(struct work_struct *w) · line 1582
Quoted 7 lines
drivers/nvme/target/tcp.c +0
-1@@ -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
Quoted 9 lines · Maurizio Lombardi
Quoted 8 lines · Tomas Henzl
cancel_work_sync(&queue->io_work)is called twice, remove the second instance.Signed-off-by Tomas Henzl <[email protected]>--- drivers/nvme/target/tcp.c | 1 - 1 file changed, 1 deletion(-)
Quoted 16 lines
drivers/nvme/target/tcp.c static void nvmet_tcp_release_queue_work(struct work_struct *w) · line 1582
Quoted 12 lines
drivers/nvme/target/tcp.c +0
-1@@ -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_workcan 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
Quoted 27 lines · Maurizio Lombardi
Quoted 9 lines · Maurizio Lombardi
Quoted 8 lines · Tomas Henzl
cancel_work_sync(&queue->io_work)is called twice, remove the second instance.Signed-off-by Tomas Henzl <[email protected]>--- drivers/nvme/target/tcp.c | 1 - 1 file changed, 1 deletion(-)Quoted 16 lines
drivers/nvme/target/tcp.c static void nvmet_tcp_release_queue_work(struct work_struct *w) · line 1582
Quoted 12 lines
drivers/nvme/target/tcp.c +0
-1@@ -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_workcan potentially re-enqueue itself.
Quoted 4 lines
Small correction, the problem isn't
io_workre-enqueing itself (the firstcancel_work_sync()prevents that); I think the real problem is thatnvmet_sq_destroy()could end up callingnvmet_tcp_queue_response()which enqueuesio_workagain.
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
Quoted 3 lines
Maurizio