aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2017-08-21 22:53:45 +0800
committerMister Oyster <oysterized@gmail.com>2017-10-04 15:35:21 +0200
commitf19d913de6d5f4a1b97c3b8a6459207439fb9396 (patch)
treeb250470f20fa6c42c5fb1af940cdd7eb37795dfd
parentf34bdace069ba7781ea86993ffb3c3a71404c48d (diff)
downloadandroid_kernel_m2note-f19d913de6d5f4a1b97c3b8a6459207439fb9396.tar.gz
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>
-rw-r--r--fs/f2fs/segment.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 9e749214d..fe9232920 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -587,7 +587,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) {