summaryrefslogtreecommitdiffstats
path: root/fs/ext4/indirect.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/indirect.c')
-rw-r--r--fs/ext4/indirect.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
index 8d849dae8428..792e388e7b44 100644
--- a/fs/ext4/indirect.c
+++ b/fs/ext4/indirect.c
@@ -807,9 +807,11 @@ ssize_t ext4_ind_direct_IO(int rw, struct kiocb *iocb,
retry:
if (rw == READ && ext4_should_dioread_nolock(inode)) {
- if (unlikely(!list_empty(&ei->i_completed_io_list)))
- ext4_flush_completed_IO(inode);
-
+ if (unlikely(atomic_read(&EXT4_I(inode)->i_unwritten))) {
+ mutex_lock(&inode->i_mutex);
+ ext4_flush_unwritten_io(inode);
+ mutex_unlock(&inode->i_mutex);
+ }
/*
* Nolock dioread optimization may be dynamically disabled
* via ext4_inode_block_unlocked_dio(). Check inode's state