aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nilfs2/inode.c')
-rw-r--r--fs/nilfs2/inode.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index 39e038ac8fcb..1dd9e6a7d787 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -237,6 +237,19 @@ nilfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
237 /* Needs synchronization with the cleaner */ 237 /* Needs synchronization with the cleaner */
238 size = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, 238 size = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
239 offset, nr_segs, nilfs_get_block, NULL); 239 offset, nr_segs, nilfs_get_block, NULL);
240
241 /*
242 * In case of error extending write may have instantiated a few
243 * blocks outside i_size. Trim these off again.
244 */
245 if (unlikely((rw & WRITE) && size < 0)) {
246 loff_t isize = i_size_read(inode);
247 loff_t end = offset + iov_length(iov, nr_segs);
248
249 if (end > isize)
250 vmtruncate(inode, isize);
251 }
252
240 return size; 253 return size;
241} 254}
242 255