diff options
Diffstat (limited to 'fs/direct-io.c')
| -rw-r--r-- | fs/direct-io.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/direct-io.c b/fs/direct-io.c index 30dbbd1df511..848044af7e16 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
| @@ -857,6 +857,7 @@ do_holes: | |||
| 857 | /* Handle holes */ | 857 | /* Handle holes */ |
| 858 | if (!buffer_mapped(map_bh)) { | 858 | if (!buffer_mapped(map_bh)) { |
| 859 | char *kaddr; | 859 | char *kaddr; |
| 860 | loff_t i_size_aligned; | ||
| 860 | 861 | ||
| 861 | /* AKPM: eargh, -ENOTBLK is a hack */ | 862 | /* AKPM: eargh, -ENOTBLK is a hack */ |
| 862 | if (dio->rw == WRITE) { | 863 | if (dio->rw == WRITE) { |
| @@ -864,8 +865,14 @@ do_holes: | |||
| 864 | return -ENOTBLK; | 865 | return -ENOTBLK; |
| 865 | } | 866 | } |
| 866 | 867 | ||
| 868 | /* | ||
| 869 | * Be sure to account for a partial block as the | ||
| 870 | * last block in the file | ||
| 871 | */ | ||
| 872 | i_size_aligned = ALIGN(i_size_read(dio->inode), | ||
| 873 | 1 << blkbits); | ||
| 867 | if (dio->block_in_file >= | 874 | if (dio->block_in_file >= |
| 868 | i_size_read(dio->inode)>>blkbits) { | 875 | i_size_aligned >> blkbits) { |
| 869 | /* We hit eof */ | 876 | /* We hit eof */ |
| 870 | page_cache_release(page); | 877 | page_cache_release(page); |
| 871 | goto out; | 878 | goto out; |
