summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2016-02-04 18:42:55 -0900
committerKent Overstreet <kent.overstreet@gmail.com>2017-01-18 21:37:38 -0900
commitc8dae06aa45152da71383998bb9fdf0370cc25e9 (patch)
tree40af37882b1b6779feb32d4bfeb06f996610add8
parent3ae36b2b8294a034d1b0656ea2835ccdd4e6a797 (diff)
bcachefs: fix fpunch() above i_size
-rw-r--r--drivers/md/bcache/fs-io.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/md/bcache/fs-io.c b/drivers/md/bcache/fs-io.c
index 36837376524a..ea72b4f11b00 100644
--- a/drivers/md/bcache/fs-io.c
+++ b/drivers/md/bcache/fs-io.c
@@ -1367,6 +1367,10 @@ static int __bch_truncate_page(struct address_space *mapping,
(index == end >> PAGE_SHIFT && end_offset != PAGE_SIZE)))
return 0;
+ /* Above i_size? */
+ if (index << PAGE_SHIFT >= inode->i_size)
+ return 0;
+
page = find_lock_page(mapping, index);
if (!page) {
struct inode *inode = mapping->host;