diff options
-rw-r--r-- | fs/btrfs/file.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index abcb91867b56..ce0cd29efa9e 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1189,8 +1189,15 @@ static const struct vm_operations_struct btrfs_file_vm_ops = { | |||
1189 | 1189 | ||
1190 | static int btrfs_file_mmap(struct file *filp, struct vm_area_struct *vma) | 1190 | static int btrfs_file_mmap(struct file *filp, struct vm_area_struct *vma) |
1191 | { | 1191 | { |
1192 | vma->vm_ops = &btrfs_file_vm_ops; | 1192 | struct address_space *mapping = filp->f_mapping; |
1193 | |||
1194 | if (!mapping->a_ops->readpage) | ||
1195 | return -ENOEXEC; | ||
1196 | |||
1193 | file_accessed(filp); | 1197 | file_accessed(filp); |
1198 | vma->vm_ops = &btrfs_file_vm_ops; | ||
1199 | vma->vm_flags |= VM_CAN_NONLINEAR; | ||
1200 | |||
1194 | return 0; | 1201 | return 0; |
1195 | } | 1202 | } |
1196 | 1203 | ||