diff options
Diffstat (limited to 'fs/ext3/inode.c')
-rw-r--r-- | fs/ext3/inode.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 735f0190ec2a..a66f3fe33672 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -1785,6 +1785,17 @@ retry: | |||
1785 | ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, | 1785 | ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, |
1786 | offset, nr_segs, | 1786 | offset, nr_segs, |
1787 | ext3_get_block, NULL); | 1787 | ext3_get_block, NULL); |
1788 | /* | ||
1789 | * In case of error extending write may have instantiated a few | ||
1790 | * blocks outside i_size. Trim these off again. | ||
1791 | */ | ||
1792 | if (unlikely((rw & WRITE) && ret < 0)) { | ||
1793 | loff_t isize = i_size_read(inode); | ||
1794 | loff_t end = offset + iov_length(iov, nr_segs); | ||
1795 | |||
1796 | if (end > isize) | ||
1797 | vmtruncate(inode, isize); | ||
1798 | } | ||
1788 | if (ret == -ENOSPC && ext3_should_retry_alloc(inode->i_sb, &retries)) | 1799 | if (ret == -ENOSPC && ext3_should_retry_alloc(inode->i_sb, &retries)) |
1789 | goto retry; | 1800 | goto retry; |
1790 | 1801 | ||