diff options
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r-- | fs/btrfs/file.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 787b50a16a14..e354c33df082 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1140,7 +1140,7 @@ int btrfs_sync_file(struct file *file, int datasync) | |||
1140 | /* | 1140 | /* |
1141 | * ok we haven't committed the transaction yet, lets do a commit | 1141 | * ok we haven't committed the transaction yet, lets do a commit |
1142 | */ | 1142 | */ |
1143 | if (file && file->private_data) | 1143 | if (file->private_data) |
1144 | btrfs_ioctl_trans_end(file); | 1144 | btrfs_ioctl_trans_end(file); |
1145 | 1145 | ||
1146 | trans = btrfs_start_transaction(root, 0); | 1146 | trans = btrfs_start_transaction(root, 0); |
@@ -1190,14 +1190,22 @@ static const struct vm_operations_struct btrfs_file_vm_ops = { | |||
1190 | 1190 | ||
1191 | static int btrfs_file_mmap(struct file *filp, struct vm_area_struct *vma) | 1191 | static int btrfs_file_mmap(struct file *filp, struct vm_area_struct *vma) |
1192 | { | 1192 | { |
1193 | vma->vm_ops = &btrfs_file_vm_ops; | 1193 | struct address_space *mapping = filp->f_mapping; |
1194 | |||
1195 | if (!mapping->a_ops->readpage) | ||
1196 | return -ENOEXEC; | ||
1197 | |||
1194 | file_accessed(filp); | 1198 | file_accessed(filp); |
1199 | vma->vm_ops = &btrfs_file_vm_ops; | ||
1200 | vma->vm_flags |= VM_CAN_NONLINEAR; | ||
1201 | |||
1195 | return 0; | 1202 | return 0; |
1196 | } | 1203 | } |
1197 | 1204 | ||
1198 | const struct file_operations btrfs_file_operations = { | 1205 | const struct file_operations btrfs_file_operations = { |
1199 | .llseek = generic_file_llseek, | 1206 | .llseek = generic_file_llseek, |
1200 | .read = do_sync_read, | 1207 | .read = do_sync_read, |
1208 | .write = do_sync_write, | ||
1201 | .aio_read = generic_file_aio_read, | 1209 | .aio_read = generic_file_aio_read, |
1202 | .splice_read = generic_file_splice_read, | 1210 | .splice_read = generic_file_splice_read, |
1203 | .aio_write = btrfs_file_aio_write, | 1211 | .aio_write = btrfs_file_aio_write, |