diff options
author | Chao Yu <yuchao0@huawei.com> | 2017-08-21 22:53:45 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2017-08-29 10:02:55 -0700 |
commit | 6f890df0a7efe3181aceb5d8bcd4af7deb2abce5 (patch) | |
tree | ce48d5d913e9f4c9712224f299a07e29dcffcef8 /fs | |
parent | 5f656541ff6e4f58b4ab5b4ae59badb97a9ff749 (diff) | |
download | linux-6f890df0a7efe3181aceb5d8bcd4af7deb2abce5.tar.gz linux-6f890df0a7efe3181aceb5d8bcd4af7deb2abce5.tar.bz2 linux-6f890df0a7efe3181aceb5d8bcd4af7deb2abce5.zip |
f2fs: fix out-of-order execution in f2fs_issue_flush
In f2fs_issue_flush, due to out-of-order execution of CPU, wake_up can
be called before we insert issue_list, result in long latency of
wait_for_completion. Fix this by adding smp_mb() to force the order of
related codes.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/f2fs/segment.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index e3922f902c8c..be1c49b9402b 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -549,7 +549,10 @@ int f2fs_issue_flush(struct f2fs_sb_info *sbi) atomic_inc(&fcc->issing_flush); llist_add(&cmd.llnode, &fcc->issue_list); - if (!fcc->dispatch_list) + /* update issue_list before we wake up issue_flush thread */ + smp_mb(); + + if (waitqueue_active(&fcc->flush_wait_queue)) wake_up(&fcc->flush_wait_queue); if (fcc->f2fs_issue_flush) { |