]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - fs/affs/file.c
Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux...
[mv-sheeva.git] / fs / affs / file.c
index 322710c3eedf25c35ca4ca5888e4c2ab96bed728..c4a9875bd1a60520c682bed74f7a27bc3d2e1da0 100644 (file)
@@ -406,10 +406,19 @@ static int affs_write_begin(struct file *file, struct address_space *mapping,
                        loff_t pos, unsigned len, unsigned flags,
                        struct page **pagep, void **fsdata)
 {
+       int ret;
+
        *pagep = NULL;
-       return cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
+       ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
                                affs_get_block,
                                &AFFS_I(mapping->host)->mmu_private);
+       if (unlikely(ret)) {
+               loff_t isize = mapping->host->i_size;
+               if (pos + len > isize)
+                       vmtruncate(mapping->host, isize);
+       }
+
+       return ret;
 }
 
 static sector_t _affs_bmap(struct address_space *mapping, sector_t block)