diff options
Diffstat (limited to 'fs/reiserfs/inode.c')
-rw-r--r-- | fs/reiserfs/inode.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 6edac85c2b93..4c1fb548ab64 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -3057,10 +3057,25 @@ static ssize_t reiserfs_direct_IO(int rw, struct kiocb *iocb, | |||
3057 | { | 3057 | { |
3058 | struct file *file = iocb->ki_filp; | 3058 | struct file *file = iocb->ki_filp; |
3059 | struct inode *inode = file->f_mapping->host; | 3059 | struct inode *inode = file->f_mapping->host; |
3060 | ssize_t ret; | ||
3060 | 3061 | ||
3061 | return blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, | 3062 | ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, |
3062 | offset, nr_segs, | 3063 | offset, nr_segs, |
3063 | reiserfs_get_blocks_direct_io, NULL); | 3064 | reiserfs_get_blocks_direct_io, NULL); |
3065 | |||
3066 | /* | ||
3067 | * In case of error extending write may have instantiated a few | ||
3068 | * blocks outside i_size. Trim these off again. | ||
3069 | */ | ||
3070 | if (unlikely((rw & WRITE) && ret < 0)) { | ||
3071 | loff_t isize = i_size_read(inode); | ||
3072 | loff_t end = offset + iov_length(iov, nr_segs); | ||
3073 | |||
3074 | if (end > isize) | ||
3075 | vmtruncate(inode, isize); | ||
3076 | } | ||
3077 | |||
3078 | return ret; | ||
3064 | } | 3079 | } |
3065 | 3080 | ||
3066 | int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) | 3081 | int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) |