
From: Zach Brown <zach.brown@oracle.com>

Add smp_mb__after_clear_bit() to unlock_kiocb()

AIO's use of wait_on_bit_lock()/wake_up_bit() forgot to add a barrier
between clearing its lock bit and calling wake_up_bit() so wake_up_bit()'s
unlocked waitqueue_active() can race.  This puts AIO's use in line with the
others and the comment above wake_up_bit().

Signed-off-by: Zach Brown <zach.brown@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 fs/aio.c |    1 +
 1 files changed, 1 insertion(+)

diff -puN fs/aio.c~add-smp_mb__after_clear_bit-to-unlock_kiocb fs/aio.c
--- devel/fs/aio.c~add-smp_mb__after_clear_bit-to-unlock_kiocb	2005-09-12 23:43:40.000000000 -0700
+++ devel-akpm/fs/aio.c	2005-09-12 23:43:40.000000000 -0700
@@ -562,6 +562,7 @@ static inline void lock_kiocb(struct kio
 static inline void unlock_kiocb(struct kiocb *iocb)
 {
 	kiocbClearLocked(iocb);
+	smp_mb__after_clear_bit();
 	wake_up_bit(&iocb->ki_flags, KIF_LOCKED);
 }
 
_
