aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/aops.c
diff options
context:
space:
mode:
authorWengang Wang <wen.gang.wang@oracle.com>2014-04-03 17:46:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-03 19:20:53 -0400
commitc18ceab01240fd4c354b78d877571b729908e4a3 (patch)
treed9c0107c30019e3299fe1b712d2eebaf832e55ed /fs/ocfs2/aops.c
parent181a9a043b5424f2e6451297bbc27b196fe88475 (diff)
ocfs2: change ip_unaligned_aio to of type mutex from atomit_t
There is a problem that waitqueue_active() may check stale data thus miss a wakeup of threads waiting on ip_unaligned_aio. The valid value of ip_unaligned_aio is only 0 and 1 so we can change it to be of type mutex thus the above prolem is avoid. Another benifit is that mutex which works as FIFO is fairer than wake_up_all(). Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Joel Becker <jlbec@evilplan.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ocfs2/aops.c')
-rw-r--r--fs/ocfs2/aops.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index aeb44e879c51..ebe44f7dce0b 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -571,7 +571,6 @@ static void ocfs2_dio_end_io(struct kiocb *iocb,
571{ 571{
572 struct inode *inode = file_inode(iocb->ki_filp); 572 struct inode *inode = file_inode(iocb->ki_filp);
573 int level; 573 int level;
574 wait_queue_head_t *wq = ocfs2_ioend_wq(inode);
575 574
576 /* this io's submitter should not have unlocked this before we could */ 575 /* this io's submitter should not have unlocked this before we could */
577 BUG_ON(!ocfs2_iocb_is_rw_locked(iocb)); 576 BUG_ON(!ocfs2_iocb_is_rw_locked(iocb));
@@ -582,10 +581,7 @@ static void ocfs2_dio_end_io(struct kiocb *iocb,
582 if (ocfs2_iocb_is_unaligned_aio(iocb)) { 581 if (ocfs2_iocb_is_unaligned_aio(iocb)) {
583 ocfs2_iocb_clear_unaligned_aio(iocb); 582 ocfs2_iocb_clear_unaligned_aio(iocb);
584 583
585 if (atomic_dec_and_test(&OCFS2_I(inode)->ip_unaligned_aio) && 584 mutex_unlock(&OCFS2_I(inode)->ip_unaligned_aio);
586 waitqueue_active(wq)) {
587 wake_up_all(wq);
588 }
589 } 585 }
590 586
591 ocfs2_iocb_clear_rw_locked(iocb); 587 ocfs2_iocb_clear_rw_locked(iocb);