diff options
Diffstat (limited to 'fs/adfs/inode.c')
-rw-r--r-- | fs/adfs/inode.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/adfs/inode.c b/fs/adfs/inode.c index e9bad5093a3f..5f95d1ed9c6d 100644 --- a/fs/adfs/inode.c +++ b/fs/adfs/inode.c | |||
@@ -45,6 +45,14 @@ static int adfs_readpage(struct file *file, struct page *page) | |||
45 | return block_read_full_page(page, adfs_get_block); | 45 | return block_read_full_page(page, adfs_get_block); |
46 | } | 46 | } |
47 | 47 | ||
48 | static void adfs_write_failed(struct address_space *mapping, loff_t to) | ||
49 | { | ||
50 | struct inode *inode = mapping->host; | ||
51 | |||
52 | if (to > inode->i_size) | ||
53 | truncate_pagecache(inode, to, inode->i_size); | ||
54 | } | ||
55 | |||
48 | static int adfs_write_begin(struct file *file, struct address_space *mapping, | 56 | static int adfs_write_begin(struct file *file, struct address_space *mapping, |
49 | loff_t pos, unsigned len, unsigned flags, | 57 | loff_t pos, unsigned len, unsigned flags, |
50 | struct page **pagep, void **fsdata) | 58 | struct page **pagep, void **fsdata) |
@@ -55,11 +63,8 @@ static int adfs_write_begin(struct file *file, struct address_space *mapping, | |||
55 | ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, | 63 | ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, |
56 | adfs_get_block, | 64 | adfs_get_block, |
57 | &ADFS_I(mapping->host)->mmu_private); | 65 | &ADFS_I(mapping->host)->mmu_private); |
58 | if (unlikely(ret)) { | 66 | if (unlikely(ret)) |
59 | loff_t isize = mapping->host->i_size; | 67 | adfs_write_failed(mapping, pos + len); |
60 | if (pos + len > isize) | ||
61 | vmtruncate(mapping->host, isize); | ||
62 | } | ||
63 | 68 | ||
64 | return ret; | 69 | return ret; |
65 | } | 70 | } |