buf_ring_peek should return NULL if the ring is empty rather than
whatever happened to be at cons_tail last time it was in use
This commit is contained in:
parent
098fb9b469
commit
3b14b38ba2
@ -216,7 +216,10 @@ buf_ring_peek(struct buf_ring *br)
|
||||
panic("lock not held on single consumer dequeue");
|
||||
#endif
|
||||
mb();
|
||||
return (br->br_ring[br->br_cons_tail]);
|
||||
if (br->br_cons_head == br->br_prod_tail)
|
||||
return (NULL);
|
||||
|
||||
return (br->br_ring[br->br_cons_head]);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
|
Loading…
Reference in New Issue
Block a user