mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 09:19:51 +00:00
Btrfs: fix remap_file_pages error
when we use remap_file_pages() to remap a file, remap_file_pages always return error. It is because btrfs didn't set VM_CAN_NONLINEAR for vma. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
parent
0e4dcbef1c
commit
058a457ef0
1 changed files with 8 additions and 1 deletions
|
@ -1189,8 +1189,15 @@ static const struct vm_operations_struct btrfs_file_vm_ops = {
|
||||||
|
|
||||||
static int btrfs_file_mmap(struct file *filp, struct vm_area_struct *vma)
|
static int btrfs_file_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||||
{
|
{
|
||||||
vma->vm_ops = &btrfs_file_vm_ops;
|
struct address_space *mapping = filp->f_mapping;
|
||||||
|
|
||||||
|
if (!mapping->a_ops->readpage)
|
||||||
|
return -ENOEXEC;
|
||||||
|
|
||||||
file_accessed(filp);
|
file_accessed(filp);
|
||||||
|
vma->vm_ops = &btrfs_file_vm_ops;
|
||||||
|
vma->vm_flags |= VM_CAN_NONLINEAR;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue