diff options
-rw-r--r-- | fs/btrfs/file.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 15a09cb156ce..7af1abda68d0 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -2682,9 +2682,12 @@ static long btrfs_fallocate(struct file *file, int mode, | |||
2682 | return ret; | 2682 | return ret; |
2683 | 2683 | ||
2684 | inode_lock(inode); | 2684 | inode_lock(inode); |
2685 | ret = inode_newsize_ok(inode, alloc_end); | 2685 | |
2686 | if (ret) | 2686 | if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + len > inode->i_size) { |
2687 | goto out; | 2687 | ret = inode_newsize_ok(inode, offset + len); |
2688 | if (ret) | ||
2689 | goto out; | ||
2690 | } | ||
2688 | 2691 | ||
2689 | /* | 2692 | /* |
2690 | * TODO: Move these two operations after we have checked | 2693 | * TODO: Move these two operations after we have checked |