>From a5dd84bbe3c55b2717150ac26f8b9011d8f9181f Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Thu, 11 Aug 2011 15:57:51 +0200 Subject: [PATCH] ext4: Fix missed wakeups Signed-off-by: Jan Kara --- fs/ext4/page-io.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index 430c401..34d01d4 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c @@ -79,9 +79,11 @@ void ext4_free_io_end(ext4_io_end_t *io) put_io_page(io->pages[i]); io->num_io_pages = 0; wq = ext4_ioend_wq(io->inode); - if (atomic_dec_and_test(&EXT4_I(io->inode)->i_ioend_count) && - waitqueue_active(wq)) - wake_up_all(wq); + if (atomic_dec_and_test(&EXT4_I(io->inode)->i_ioend_count)) { + smp_mb__after_atomic_dec(); + if (waitqueue_active(wq)) + wake_up_all(wq); + } kmem_cache_free(io_end_cachep, io); } @@ -122,9 +124,10 @@ int ext4_end_io_nolock(ext4_io_end_t *io) io->flag &= ~EXT4_IO_END_UNWRITTEN; /* Wake up anyone waiting on unwritten extent conversion */ wq = ext4_ioend_wq(io->inode); - if (atomic_dec_and_test(&EXT4_I(inode)->i_aiodio_unwritten) && - waitqueue_active(wq)) { - wake_up_all(wq); + if (atomic_dec_and_test(&EXT4_I(inode)->i_aiodio_unwritten)) { + smp_mb__after_atomic_dec(); + if (waitqueue_active(wq)) + wake_up_all(wq); } } -- 1.7.1