diff options
Diffstat (limited to 'fs/hfs/inode.c')
-rw-r--r-- | fs/hfs/inode.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index 07b2464b5716..8df18e63eb6b 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c | |||
@@ -39,10 +39,19 @@ static int hfs_write_begin(struct file *file, struct address_space *mapping, | |||
39 | loff_t pos, unsigned len, unsigned flags, | 39 | loff_t pos, unsigned len, unsigned flags, |
40 | struct page **pagep, void **fsdata) | 40 | struct page **pagep, void **fsdata) |
41 | { | 41 | { |
42 | int ret; | ||
43 | |||
42 | *pagep = NULL; | 44 | *pagep = NULL; |
43 | return cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, | 45 | ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, |
44 | hfs_get_block, | 46 | hfs_get_block, |
45 | &HFS_I(mapping->host)->phys_size); | 47 | &HFS_I(mapping->host)->phys_size); |
48 | if (unlikely(ret)) { | ||
49 | loff_t isize = mapping->host->i_size; | ||
50 | if (pos + len > isize) | ||
51 | vmtruncate(mapping->host, isize); | ||
52 | } | ||
53 | |||
54 | return ret; | ||
46 | } | 55 | } |
47 | 56 | ||
48 | static sector_t hfs_bmap(struct address_space *mapping, sector_t block) | 57 | static sector_t hfs_bmap(struct address_space *mapping, sector_t block) |