* [PATCH v2] nvmet: fix uninitialized work for zero kato
@ 2020-10-14 3:36 zhenwei pi
2020-10-14 16:10 ` Keith Busch
0 siblings, 1 reply; 3+ messages in thread
From: zhenwei pi @ 2020-10-14 3:36 UTC (permalink / raw)
To: hch, sagi, chaitanya.kulkarni; +Cc: linux-nvme, linux-kernel, pizhenwei
Hit a warning:
WARNING: CPU: 1 PID: 241 at kernel/workqueue.c:1627 __queue_delayed_work+0x6d/0x90
with trace:
mod_delayed_work_on+0x59/0x90
nvmet_update_cc+0xee/0x100 [nvmet]
nvmet_execute_prop_set+0x72/0x80 [nvmet]
nvmet_tcp_try_recv_pdu+0x2f7/0x770 [nvmet_tcp]
nvmet_tcp_io_work+0x63f/0xb2d [nvmet_tcp]
...
This could be reproduced easily with a keep alive time 0:
nvme connect -t tcp -n NQN -a ADDR -s PORT --keep-alive-tmo=0
Starting an uninitialized work when initiator connects with zero
kato. Althrough keep-alive timer is disabled during allocating a ctrl
(fix in 0d3b6a8d213a), ka_work still has a chance to run
(called by nvmet_start_ctrl).
Fixes:
Don't run keep alive work with zero kato.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
---
drivers/nvme/target/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index b7b63330b5ef..90e0c84df2af 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -1126,7 +1126,8 @@ static void nvmet_start_ctrl(struct nvmet_ctrl *ctrl)
* in case a host died before it enabled the controller. Hence, simply
* reset the keep alive timer when the controller is enabled.
*/
- mod_delayed_work(system_wq, &ctrl->ka_work, ctrl->kato * HZ);
+ if (ctrl->kato)
+ mod_delayed_work(system_wq, &ctrl->ka_work, ctrl->kato * HZ);
}
static void nvmet_clear_ctrl(struct nvmet_ctrl *ctrl)
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] nvmet: fix uninitialized work for zero kato
2020-10-14 3:36 [PATCH v2] nvmet: fix uninitialized work for zero kato zhenwei pi
@ 2020-10-14 16:10 ` Keith Busch
2020-10-14 19:00 ` Sagi Grimberg
0 siblings, 1 reply; 3+ messages in thread
From: Keith Busch @ 2020-10-14 16:10 UTC (permalink / raw)
To: zhenwei pi; +Cc: hch, sagi, chaitanya.kulkarni, linux-kernel, linux-nvme
On Wed, Oct 14, 2020 at 11:36:50AM +0800, zhenwei pi wrote:
> Fixes:
> Don't run keep alive work with zero kato.
"Fixes" tags need to have a git commit id followed by the commit
subject. I can't find any commit with that subject, though.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] nvmet: fix uninitialized work for zero kato
2020-10-14 16:10 ` Keith Busch
@ 2020-10-14 19:00 ` Sagi Grimberg
0 siblings, 0 replies; 3+ messages in thread
From: Sagi Grimberg @ 2020-10-14 19:00 UTC (permalink / raw)
To: Keith Busch, zhenwei pi; +Cc: linux-kernel, linux-nvme, hch, chaitanya.kulkarni
>> Fixes:
>> Don't run keep alive work with zero kato.
>
> "Fixes" tags need to have a git commit id followed by the commit
> subject. I can't find any commit with that subject, though.
Fixes: 0d3b6a8d213a ("nvmet: Disable keep-alive timer when kato is
cleared to 0h")
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-14 19:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14 3:36 [PATCH v2] nvmet: fix uninitialized work for zero kato zhenwei pi
2020-10-14 16:10 ` Keith Busch
2020-10-14 19:00 ` Sagi Grimberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).