From 8a6a354e22521e7d2d14b8b4c2d1b7a65a0c8d5e Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sun, 23 Oct 2022 01:59:25 +0000 Subject: sdnvme: fix missing unlock() in submit queue full case when we have more processors than submit queues, the submit queues are shared between some processors and hence we have to acquire its lock. in the case of the submit queue being full, we have to unlock it again before retrying otherwise we have a deadlock. sorry :( --- sys/src/9/port/sdnvme.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/src/9/port/sdnvme.c b/sys/src/9/port/sdnvme.c index 4f7b9ee91..9f244d9e0 100644 --- a/sys/src/9/port/sdnvme.c +++ b/sys/src/9/port/sdnvme.c @@ -113,11 +113,14 @@ qcmd(WS *ws, Ctlr *ctlr, int adm, u32int opc, u32int nsid, void *mptr, void *dat ws->queue = sq; ws->link = &sq->wait[sq->tail & sq->mask]; while(*ws->link != nil){ - sched(); + /* should be very rare */ if(!adm){ - /* should be very rare */ + if(conf.nmach > ctlr->nsq) + unlock(sq); + sched(); goto Retry; } + sched(); } *ws->link = ws; -- cgit v1.2.3