Skip to contentSkip to conversation

nvmet: fix uninitialized work for zero kato

PATCH Superseded zhenwei pi 3 participants 3 messages Oct 14, 2020

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

zhenwei pi

author
#0 lore raw

PATCH v2 1/1 nvmet: fix uninitialized work for zero kato

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.

---
 drivers/nvme/target/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/target/core.c +2 -1
index b7b63330b5ef..90e0c84df2af 100644
@@ -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)
Signature · 7 lines
2.11.0


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
maintainer
#1 lore raw
Quoted 2 lines · zhenwei pi

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.

maintainer
#2 lore raw
Quoted 6 lines
Quoted 3 lines

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")