[Patch] Add smp_mb__after_clear_bit() to unlock_kiocb()

From: Zach Brown
Date: Mon Sep 12 2005 - 18:45:36 EST


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 <zach.brown@xxxxxxxxxx>

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 <zach.brown@xxxxxxxxxx>

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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/