diff options
| -rw-r--r-- | fs/btrfs/inode.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 0a43d42268f7..55dda871437f 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
| @@ -7270,8 +7270,16 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb, | |||
| 7270 | atomic_inc(&inode->i_dio_count); | 7270 | atomic_inc(&inode->i_dio_count); |
| 7271 | smp_mb__after_atomic_inc(); | 7271 | smp_mb__after_atomic_inc(); |
| 7272 | 7272 | ||
| 7273 | /* | ||
| 7274 | * The generic stuff only does filemap_write_and_wait_range, which isn't | ||
| 7275 | * enough if we've written compressed pages to this area, so we need to | ||
| 7276 | * call btrfs_wait_ordered_range to make absolutely sure that any | ||
| 7277 | * outstanding dirty pages are on disk. | ||
| 7278 | */ | ||
| 7279 | count = iov_length(iov, nr_segs); | ||
| 7280 | btrfs_wait_ordered_range(inode, offset, count); | ||
| 7281 | |||
| 7273 | if (rw & WRITE) { | 7282 | if (rw & WRITE) { |
| 7274 | count = iov_length(iov, nr_segs); | ||
| 7275 | /* | 7283 | /* |
| 7276 | * If the write DIO is beyond the EOF, we need update | 7284 | * If the write DIO is beyond the EOF, we need update |
| 7277 | * the isize, but it is protected by i_mutex. So we can | 7285 | * the isize, but it is protected by i_mutex. So we can |
