OK, it appears that we are even. I forgot to attach the promised analysis of the callers to __kfifo_put() and __kfifo_get(), and the open-iscsi@googlegroups.com email address listed as maintainer in drivers/scsi/libiscsi.c bounces complaining that, as a non-member, I am not allowed to send it email. ;-) Anyway, this time the analysis really is attached, sorry for my confusion! Could someone please let the guys on open-iscsi@googlegroups.com know that they should take a look at this? Thanx, Paul On Wed, Aug 09, 2006 at 05:18:23PM -0700, Paul E. McKenney wrote: > Hello! > > Both __kfifo_put() and __kfifo_get() have header comments stating > that if there is but one concurrent reader and one concurrent writer, > locking is not necessary. This is almost the case, but a couple of > memory barriers are needed. Another option would be to change the > header comments to remove the bit about locking not being needed, and > to change the those callers who currently don't use locking to add > the required locking. The attachment analyzes this approach, but the > patch below seems simpler. > > Signed-off-by: Paul E. McKenney > --- > > kfifo.c | 4 ++++ > 1 files changed, 4 insertions(+) > > diff -urpNa -X dontdiff linux-2.6.18-rc2/kernel/kfifo.c linux-2.6.18-rc2-kfifo/kernel/kfifo.c > --- linux-2.6.18-rc2/kernel/kfifo.c 2006-07-15 14:53:08.000000000 -0700 > +++ linux-2.6.18-rc2-kfifo/kernel/kfifo.c 2006-08-09 14:01:53.000000000 -0700 > @@ -129,6 +129,8 @@ unsigned int __kfifo_put(struct kfifo *f > /* then put the rest (if any) at the beginning of the buffer */ > memcpy(fifo->buffer, buffer + l, len - l); > > + smp_wmb(); > + > fifo->in += len; > > return len; > @@ -161,6 +163,8 @@ unsigned int __kfifo_get(struct kfifo *f > /* then get the rest (if any) from the beginning of the buffer */ > memcpy(buffer + l, fifo->buffer, len - l); > > + smp_mb(); > + > fifo->out += len; > > return len;