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:
Kip Macy 2008-11-23 00:20:51 +00:00
parent 098fb9b469
commit 3b14b38ba2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=185193

View File

@ -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