br_read_lock SMP race fix

From: Andrea Arcangeli (andrea@suse.de)
Date: Mon Jul 24 2000 - 21:40:02 EST


This fixes a SMP race condition in the non atomic version of the
br_read_lock (at least with the alpha semantics of rmb()) and removes a
rmb() not necessary in the slow path. If we want to flush the write queue
as soon as possible after the (*ctr)-- then we'd better use wmb() instead
of rmb() ;-). I didn't replaced the second rmb() with an wmb() because
that's code that never runs and I'd rather prefer to save icache.

--- 2.4.0-test5-pre3/include/linux/brlock.h.~1~ Fri Jul 14 18:47:05 2000
+++ 2.4.0-test5-pre3/include/linux/brlock.h Tue Jul 25 04:08:36 2000
@@ -114,10 +114,9 @@
         lock = &__br_write_locks[idx].lock;
 again:
         (*ctr)++;
- rmb();
+ mb();
         if (spin_is_locked(lock)) {
                 (*ctr)--;
- rmb();
                 while (spin_is_locked(lock))
                         barrier();
                 goto again;

Andrea

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jul 31 2000 - 21:00:19 EST