diff options
| -rw-r--r-- | fs/fuse/file.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index a200a2d80377..d9f467907791 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
| @@ -2492,11 +2492,20 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset, | |||
| 2492 | } | 2492 | } |
| 2493 | fuse_put_request(fc, req); | 2493 | fuse_put_request(fc, req); |
| 2494 | 2494 | ||
| 2495 | if (err) | ||
| 2496 | goto out; | ||
| 2497 | |||
| 2498 | /* we could have extended the file */ | ||
| 2499 | if (!(mode & FALLOC_FL_KEEP_SIZE)) | ||
| 2500 | fuse_write_update_size(inode, offset + length); | ||
| 2501 | |||
| 2502 | if (mode & FALLOC_FL_PUNCH_HOLE) | ||
| 2503 | truncate_pagecache_range(inode, offset, offset + length - 1); | ||
| 2504 | |||
| 2505 | fuse_invalidate_attr(inode); | ||
| 2506 | |||
| 2495 | out: | 2507 | out: |
| 2496 | if (mode & FALLOC_FL_PUNCH_HOLE) { | 2508 | if (mode & FALLOC_FL_PUNCH_HOLE) { |
| 2497 | if (!err) | ||
| 2498 | truncate_pagecache_range(inode, offset, | ||
| 2499 | offset + length - 1); | ||
| 2500 | fuse_release_nowrite(inode); | 2509 | fuse_release_nowrite(inode); |
| 2501 | mutex_unlock(&inode->i_mutex); | 2510 | mutex_unlock(&inode->i_mutex); |
| 2502 | } | 2511 | } |
