aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hugetlbfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hugetlbfs/inode.c')
-rw-r--r--fs/hugetlbfs/inode.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 8c1cef3bb677..f568102da1e8 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -18,6 +18,7 @@
18#include <linux/highmem.h> 18#include <linux/highmem.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/string.h> 20#include <linux/string.h>
21#include <linux/capability.h>
21#include <linux/backing-dev.h> 22#include <linux/backing-dev.h>
22#include <linux/hugetlb.h> 23#include <linux/hugetlb.h>
23#include <linux/pagevec.h> 24#include <linux/pagevec.h>
@@ -100,9 +101,6 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
100 loff_t len, vma_len; 101 loff_t len, vma_len;
101 int ret; 102 int ret;
102 103
103 if ((vma->vm_flags & (VM_MAYSHARE | VM_WRITE)) == VM_WRITE)
104 return -EINVAL;
105
106 if (vma->vm_pgoff & (HPAGE_SIZE / PAGE_SIZE - 1)) 104 if (vma->vm_pgoff & (HPAGE_SIZE / PAGE_SIZE - 1))
107 return -EINVAL; 105 return -EINVAL;
108 106
@@ -121,7 +119,7 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
121 119
122 vma_len = (loff_t)(vma->vm_end - vma->vm_start); 120 vma_len = (loff_t)(vma->vm_end - vma->vm_start);
123 121
124 down(&inode->i_sem); 122 mutex_lock(&inode->i_mutex);
125 file_accessed(file); 123 file_accessed(file);
126 vma->vm_flags |= VM_HUGETLB | VM_RESERVED; 124 vma->vm_flags |= VM_HUGETLB | VM_RESERVED;
127 vma->vm_ops = &hugetlb_vm_ops; 125 vma->vm_ops = &hugetlb_vm_ops;
@@ -136,7 +134,7 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
136 if (inode->i_size < len) 134 if (inode->i_size < len)
137 inode->i_size = len; 135 inode->i_size = len;
138out: 136out:
139 up(&inode->i_sem); 137 mutex_unlock(&inode->i_mutex);
140 138
141 return ret; 139 return ret;
142} 140}
@@ -404,7 +402,7 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid,
404 inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info; 402 inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info;
405 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 403 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
406 info = HUGETLBFS_I(inode); 404 info = HUGETLBFS_I(inode);
407 mpol_shared_policy_init(&info->policy); 405 mpol_shared_policy_init(&info->policy, MPOL_DEFAULT, NULL);
408 switch (mode & S_IFMT) { 406 switch (mode & S_IFMT) {
409 default: 407 default:
410 init_special_inode(inode, mode, dev); 408 init_special_inode(inode, mode, dev);