diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c index 89d2a5803ae3..5ecfffe25334 100644 --- a/fs/hpfs/file.c +++ b/fs/hpfs/file.c @@ -116,9 +116,12 @@ static int hpfs_write_begin(struct file *file, struct address_space *mapping, hpfs_get_block, &hpfs_i(mapping->host)->mmu_private); if (unlikely(ret)) { - loff_t isize = mapping->host->i_size; + loff_t isize; + hpfs_lock(mapping->host->i_sb); + isize = mapping->host->i_size; if (pos + len > isize) vmtruncate(mapping->host, isize); + hpfs_unlock(mapping->host->i_sb); } return ret;