[PATCH 4/4] JFS is missing a memory barrier

[email protected] Thu, 20 Dec 2007 14:03:17 -0600 (CST)
Newsgroups gmane.comp.file-systems.jfs.patches
Message-ID <[email protected]>
JFS is missing a memory barrier

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 <[email protected]>
Signed-off-by: Dave Kleikamp <[email protected]>

---
commit 79b604bc3a0af7ed0459e2e523ac137b2aaf5cc8
tree 1719b81b671e33fa181aa8ea1f6c7bbb2f4c3462
parent 5bee3591ef512246826f1d872c22128cecd66171
author Nick Piggin <[email protected]> Mon, 26 Nov 2007 14:58:10 -0600
committer Dave Kleikamp <[email protected]> Mon, 26 Nov 2007 14:58:10 -0600

 fs/jfs/jfs_metapage.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
index 62e96be..f7669d2 100644
--- a/fs/jfs/jfs_metapage.c
+++ b/fs/jfs/jfs_metapage.c
@@ -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);
 }
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/