Skip to content

Commit 54af623

Browse files
Nick PigginDave Kleikamp
authored andcommitted
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]>
1 parent 67e6682 commit 54af623

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/jfs/jfs_metapage.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ static struct {
3939
#endif
4040

4141
#define metapage_locked(mp) test_bit(META_locked, &(mp)->flag)
42-
#define trylock_metapage(mp) test_and_set_bit(META_locked, &(mp)->flag)
42+
#define trylock_metapage(mp) test_and_set_bit_lock(META_locked, &(mp)->flag)
4343

4444
static inline void unlock_metapage(struct metapage *mp)
4545
{
46-
clear_bit(META_locked, &mp->flag);
46+
clear_bit_unlock(META_locked, &mp->flag);
4747
wake_up(&mp->wait);
4848
}
4949

0 commit comments

Comments
 (0)