[Patch] Add smp_mb__after_clear_bit() to unlock_kiocb()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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().

Please apply.

Signed-off-by: Zach Brown <[email protected]>

Index: 2.6.13-git12-mb-lock-kiocb/fs/aio.c
===================================================================
--- 2.6.13-git12-mb-lock-kiocb.orig/fs/aio.c
+++ 2.6.13-git12-mb-lock-kiocb/fs/aio.c
@@ -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);
 }
 
  Signed-off-by: Zach Brown <[email protected]>

 aio.c |    1 +
 1 files changed, 1 insertion(+)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux