patch-2.4.6 linux/lib/brlock.c

Next file: linux/mm/bootmem.c
Previous file: linux/kernel/timer.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.5/linux/lib/brlock.c linux/lib/brlock.c
@@ -25,7 +25,7 @@
 	int i;
 
 	for (i = 0; i < smp_num_cpus; i++)
-		write_lock(__brlock_array[idx] + cpu_logical_map(i));
+		write_lock(&__brlock_array[cpu_logical_map(i)][idx]);
 }
 
 void __br_write_unlock (enum brlock_indices idx)
@@ -33,7 +33,7 @@
 	int i;
 
 	for (i = 0; i < smp_num_cpus; i++)
-		write_unlock(__brlock_array[idx] + cpu_logical_map(i));
+		write_unlock(&__brlock_array[cpu_logical_map(i)][idx]);
 }
 
 #else /* ! __BRLOCK_USE_ATOMICS */
@@ -48,11 +48,14 @@
 {
 	int i;
 
-	spin_lock(&__br_write_locks[idx].lock);
 again:
+	spin_lock(&__br_write_locks[idx].lock);
 	for (i = 0; i < smp_num_cpus; i++)
-		if (__brlock_array[cpu_logical_map(i)][idx] != 0)
+		if (__brlock_array[cpu_logical_map(i)][idx] != 0) {
+			spin_unlock(&__br_write_locks[idx].lock);
+			barrier();
 			goto again;
+		}
 }
 
 void __br_write_unlock (enum brlock_indices idx)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)