diff --git a/fs/block_dev.c b/fs/block_dev.c index 29f020c4b2d0ddaf758c21ddb339f43cb046a11f..6a1295815bd2445c95398450ec01a7614404584a 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -2057,13 +2057,11 @@ static long blkdev_fallocate(struct file *file, int mode, loff_t start, return error; /* - * Invalidate again; if someone wandered in and dirtied a page, - * the caller will be given -EBUSY. The third argument is - * inclusive, so the rounding here is safe. + * Invalidate the page cache again; if someone wandered in and dirtied + * a page, we just discard it - userspace has no way of knowing whether + * the write happened before or after discard completing... */ - return invalidate_inode_pages2_range(bdev->bd_inode->i_mapping, - start >> PAGE_SHIFT, - end >> PAGE_SHIFT); + return truncate_bdev_range(bdev, file->f_mode, start, end); } const struct file_operations def_blk_fops = {