diff options
author | Wengang Wang <wen.gang.wang@oracle.com> | 2014-04-03 17:46:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-03 19:20:53 -0400 |
commit | c18ceab01240fd4c354b78d877571b729908e4a3 (patch) | |
tree | d9c0107c30019e3299fe1b712d2eebaf832e55ed /fs/ocfs2/super.c | |
parent | 181a9a043b5424f2e6451297bbc27b196fe88475 (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/super.c')
-rw-r--r-- | fs/ocfs2/super.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 49d84f80f36c..d17145552097 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -1612,14 +1612,9 @@ static int ocfs2_show_options(struct seq_file *s, struct dentry *root) | |||
1612 | return 0; | 1612 | return 0; |
1613 | } | 1613 | } |
1614 | 1614 | ||
1615 | wait_queue_head_t ocfs2__ioend_wq[OCFS2_IOEND_WQ_HASH_SZ]; | ||
1616 | |||
1617 | static int __init ocfs2_init(void) | 1615 | static int __init ocfs2_init(void) |
1618 | { | 1616 | { |
1619 | int status, i; | 1617 | int status; |
1620 | |||
1621 | for (i = 0; i < OCFS2_IOEND_WQ_HASH_SZ; i++) | ||
1622 | init_waitqueue_head(&ocfs2__ioend_wq[i]); | ||
1623 | 1618 | ||
1624 | status = init_ocfs2_uptodate_cache(); | 1619 | status = init_ocfs2_uptodate_cache(); |
1625 | if (status < 0) | 1620 | if (status < 0) |
@@ -1761,7 +1756,7 @@ static void ocfs2_inode_init_once(void *data) | |||
1761 | ocfs2_extent_map_init(&oi->vfs_inode); | 1756 | ocfs2_extent_map_init(&oi->vfs_inode); |
1762 | INIT_LIST_HEAD(&oi->ip_io_markers); | 1757 | INIT_LIST_HEAD(&oi->ip_io_markers); |
1763 | oi->ip_dir_start_lookup = 0; | 1758 | oi->ip_dir_start_lookup = 0; |
1764 | atomic_set(&oi->ip_unaligned_aio, 0); | 1759 | mutex_init(&oi->ip_unaligned_aio); |
1765 | init_rwsem(&oi->ip_alloc_sem); | 1760 | init_rwsem(&oi->ip_alloc_sem); |
1766 | init_rwsem(&oi->ip_xattr_sem); | 1761 | init_rwsem(&oi->ip_xattr_sem); |
1767 | mutex_init(&oi->ip_io_mutex); | 1762 | mutex_init(&oi->ip_io_mutex); |