diff options
-rw-r--r-- | fs/hugetlbfs/inode.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 70fbb29fb202..8f8e13385e96 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -322,21 +322,15 @@ hugetlb_vmtruncate_list(struct prio_tree_root *root, pgoff_t pgoff) | |||
322 | } | 322 | } |
323 | } | 323 | } |
324 | 324 | ||
325 | /* | ||
326 | * Expanding truncates are not allowed. | ||
327 | */ | ||
328 | static int hugetlb_vmtruncate(struct inode *inode, loff_t offset) | 325 | static int hugetlb_vmtruncate(struct inode *inode, loff_t offset) |
329 | { | 326 | { |
330 | pgoff_t pgoff; | 327 | pgoff_t pgoff; |
331 | struct address_space *mapping = inode->i_mapping; | 328 | struct address_space *mapping = inode->i_mapping; |
332 | 329 | ||
333 | if (offset > inode->i_size) | ||
334 | return -EINVAL; | ||
335 | |||
336 | BUG_ON(offset & ~HPAGE_MASK); | 330 | BUG_ON(offset & ~HPAGE_MASK); |
337 | pgoff = offset >> PAGE_SHIFT; | 331 | pgoff = offset >> PAGE_SHIFT; |
338 | 332 | ||
339 | inode->i_size = offset; | 333 | i_size_write(inode, offset); |
340 | spin_lock(&mapping->i_mmap_lock); | 334 | spin_lock(&mapping->i_mmap_lock); |
341 | if (!prio_tree_empty(&mapping->i_mmap)) | 335 | if (!prio_tree_empty(&mapping->i_mmap)) |
342 | hugetlb_vmtruncate_list(&mapping->i_mmap, pgoff); | 336 | hugetlb_vmtruncate_list(&mapping->i_mmap, pgoff); |