aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/fuse/file.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index d409deafc67b..f9f07c4fa517 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2484,8 +2484,15 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
2484 2484
2485 if (lock_inode) { 2485 if (lock_inode) {
2486 mutex_lock(&inode->i_mutex); 2486 mutex_lock(&inode->i_mutex);
2487 if (mode & FALLOC_FL_PUNCH_HOLE) 2487 if (mode & FALLOC_FL_PUNCH_HOLE) {
2488 fuse_set_nowrite(inode); 2488 loff_t endbyte = offset + length - 1;
2489 err = filemap_write_and_wait_range(inode->i_mapping,
2490 offset, endbyte);
2491 if (err)
2492 goto out;
2493
2494 fuse_sync_writes(inode);
2495 }
2489 } 2496 }
2490 2497
2491 req = fuse_get_req_nopages(fc); 2498 req = fuse_get_req_nopages(fc);
@@ -2520,11 +2527,8 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
2520 fuse_invalidate_attr(inode); 2527 fuse_invalidate_attr(inode);
2521 2528
2522out: 2529out:
2523 if (lock_inode) { 2530 if (lock_inode)
2524 if (mode & FALLOC_FL_PUNCH_HOLE)
2525 fuse_release_nowrite(inode);
2526 mutex_unlock(&inode->i_mutex); 2531 mutex_unlock(&inode->i_mutex);
2527 }
2528 2532
2529 return err; 2533 return err;
2530} 2534}