patch-2.4.0-test9 linux/include/linux/locks.h

Next file: linux/include/linux/major.h
Previous file: linux/include/linux/kmod.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/locks.h linux/include/linux/locks.h
@@ -29,7 +29,9 @@
 extern inline void unlock_buffer(struct buffer_head *bh)
 {
 	clear_bit(BH_Lock, &bh->b_state);
-	wake_up(&bh->b_wait);
+	smp_mb__after_clear_bit();
+	if (waitqueue_active(&bh->b_wait))
+		wake_up(&bh->b_wait);
 }
 
 /*
@@ -55,7 +57,12 @@
 extern inline void unlock_super(struct super_block * sb)
 {
 	sb->s_lock = 0;
-	wake_up(&sb->s_wait);
+	/*
+	 * No need of any barrier, we're protected by
+	 * the big kernel lock here... unfortunately :)
+	 */
+	if (waitqueue_active(&sb->s_wait))
+		wake_up(&sb->s_wait);
 }
 
 #endif /* _LINUX_LOCKS_H */

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