summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2022-10-23 01:59:25 +0000
committercinap_lenrek <cinap_lenrek@felloff.net>2022-10-23 01:59:25 +0000
commit8a6a354e22521e7d2d14b8b4c2d1b7a65a0c8d5e (patch)
tree7137dc51718b7f027f55be8387b6e892007b75ae
parent9a69a14279be575bb2b7891a9d6f5da28ac2927c (diff)
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 :(
-rw-r--r--sys/src/9/port/sdnvme.c7
1 files 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;