summaryrefslogtreecommitdiffstats
path: root/fs/affs/file.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-08-18 15:17:52 +0200
committerTakashi Iwai <tiwai@suse.de>2010-08-18 15:17:52 +0200
commite7cfbea9cb7a02ea29fdae5d39c9e3d09102c4d5 (patch)
tree37c20ec03e70dc7b5df1d02f16b6ac38d8ed1364 /fs/affs/file.c
parent7ac03db84baa204d7d280401ed65842541ed1078 (diff)
parent56385a12d9bb9e173751f74b6c430742018cafc0 (diff)
downloadlinux-stable-e7cfbea9cb7a02ea29fdae5d39c9e3d09102c4d5.tar.gz
linux-stable-e7cfbea9cb7a02ea29fdae5d39c9e3d09102c4d5.tar.bz2
linux-stable-e7cfbea9cb7a02ea29fdae5d39c9e3d09102c4d5.zip
Merge branch 'fix/misc' into topic/misc
Diffstat (limited to 'fs/affs/file.c')
-rw-r--r--fs/affs/file.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/affs/file.c b/fs/affs/file.c
index 322710c3eedf..c4a9875bd1a6 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -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)