]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
JFS is missing a memory barrier
authorNick Piggin <npiggin@suse.de>
Mon, 26 Nov 2007 20:58:10 +0000 (14:58 -0600)
committerDave Kleikamp <shaggy@linux.vnet.ibm.com>
Thu, 3 Jan 2008 19:11:44 +0000 (13:11 -0600)
JFS is missing a memory barrier needed to close the critical section before
clearing the lock bit. Use lock bitops for this.

unlock_page() has a second barrier after clearing the lock, which is
required because it checks whether the waitqueue is active without locks.
Such a barrier is not required here because the waitqueue spinlock is
always taken (something to think about if performance is an issue).

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
fs/jfs/jfs_metapage.c

index b27fa117f229b86a636769b8de6d9f2ee3dfe080..1dfaae5adf1bae79c314f53c5f49979327ab680d 100644 (file)
@@ -39,11 +39,11 @@ static struct {
 #endif
 
 #define metapage_locked(mp) test_bit(META_locked, &(mp)->flag)
-#define trylock_metapage(mp) test_and_set_bit(META_locked, &(mp)->flag)
+#define trylock_metapage(mp) test_and_set_bit_lock(META_locked, &(mp)->flag)
 
 static inline void unlock_metapage(struct metapage *mp)
 {
-       clear_bit(META_locked, &mp->flag);
+       clear_bit_unlock(META_locked, &mp->flag);
        wake_up(&mp->wait);
 }