diff options
author | Michal Marek <mmarek@suse.cz> | 2010-12-15 00:01:55 +0300 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2010-12-15 00:01:55 +0300 |
commit | 8990c1bc4be46473ad19bf2fa612ca57286f3df4 (patch) | |
tree | 3cea60576903a1d26c67e6ec62891b524d390e95 /fs/affs/file.c | |
parent | 2979076fbf17a0947d6eba367b0cac19c907c160 (diff) | |
parent | c8ddb2713c624f432fa5fe3c7ecffcdda46ea0d4 (diff) | |
download | linux-8990c1bc4be46473ad19bf2fa612ca57286f3df4.tar.xz |
Merge commit 'v2.6.37-rc1' into kbuild/kbuild
Diffstat (limited to 'fs/affs/file.c')
-rw-r--r-- | fs/affs/file.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/fs/affs/file.c b/fs/affs/file.c index 322710c3eedf..0a90dcd46de2 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) @@ -885,9 +894,9 @@ affs_truncate(struct inode *inode) if (AFFS_SB(sb)->s_flags & SF_OFS) { struct buffer_head *bh = affs_bread_ino(inode, last_blk, 0); u32 tmp; - if (IS_ERR(ext_bh)) { + if (IS_ERR(bh)) { affs_warning(sb, "truncate", "unexpected read error for last block %u (%d)", - ext, PTR_ERR(ext_bh)); + ext, PTR_ERR(bh)); return; } tmp = be32_to_cpu(AFFS_DATA_HEAD(bh)->next); |