diff options
-rw-r--r-- | Documentation/feature-removal-schedule.txt | 12 | ||||
-rw-r--r-- | fs/hugetlbfs/inode.c | 13 |
2 files changed, 23 insertions, 2 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 5e02b83ac12b..ea7d1bdad34d 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -311,6 +311,18 @@ Who: Vlad Yasevich <vladislav.yasevich@hp.com> | |||
311 | 311 | ||
312 | --------------------------- | 312 | --------------------------- |
313 | 313 | ||
314 | What: Ability for non root users to shm_get hugetlb pages based on mlock | ||
315 | resource limits | ||
316 | When: 2.6.31 | ||
317 | Why: Non root users need to be part of /proc/sys/vm/hugetlb_shm_group or | ||
318 | have CAP_IPC_LOCK to be able to allocate shm segments backed by | ||
319 | huge pages. The mlock based rlimit check to allow shm hugetlb is | ||
320 | inconsistent with mmap based allocations. Hence it is being | ||
321 | deprecated. | ||
322 | Who: Ravikiran Thirumalai <kiran@scalex86.org> | ||
323 | |||
324 | --------------------------- | ||
325 | |||
314 | What: CONFIG_THERMAL_HWMON | 326 | What: CONFIG_THERMAL_HWMON |
315 | When: January 2009 | 327 | When: January 2009 |
316 | Why: This option was introduced just to allow older lm-sensors userspace | 328 | Why: This option was introduced just to allow older lm-sensors userspace |
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index bc56df8ce001..23a3c76711e0 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -949,6 +949,7 @@ static int can_do_hugetlb_shm(void) | |||
949 | struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag) | 949 | struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag) |
950 | { | 950 | { |
951 | int error = -ENOMEM; | 951 | int error = -ENOMEM; |
952 | int unlock_shm = 0; | ||
952 | struct file *file; | 953 | struct file *file; |
953 | struct inode *inode; | 954 | struct inode *inode; |
954 | struct dentry *dentry, *root; | 955 | struct dentry *dentry, *root; |
@@ -958,8 +959,14 @@ struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag) | |||
958 | if (!hugetlbfs_vfsmount) | 959 | if (!hugetlbfs_vfsmount) |
959 | return ERR_PTR(-ENOENT); | 960 | return ERR_PTR(-ENOENT); |
960 | 961 | ||
961 | if (!can_do_hugetlb_shm()) | 962 | if (!can_do_hugetlb_shm()) { |
962 | return ERR_PTR(-EPERM); | 963 | if (user_shm_lock(size, user)) { |
964 | unlock_shm = 1; | ||
965 | WARN_ONCE(1, | ||
966 | "Using mlock ulimits for SHM_HUGETLB deprecated\n"); | ||
967 | } else | ||
968 | return ERR_PTR(-EPERM); | ||
969 | } | ||
963 | 970 | ||
964 | root = hugetlbfs_vfsmount->mnt_root; | 971 | root = hugetlbfs_vfsmount->mnt_root; |
965 | quick_string.name = name; | 972 | quick_string.name = name; |
@@ -999,6 +1006,8 @@ out_inode: | |||
999 | out_dentry: | 1006 | out_dentry: |
1000 | dput(dentry); | 1007 | dput(dentry); |
1001 | out_shm_unlock: | 1008 | out_shm_unlock: |
1009 | if (unlock_shm) | ||
1010 | user_shm_unlock(size, user); | ||
1002 | return ERR_PTR(error); | 1011 | return ERR_PTR(error); |
1003 | } | 1012 | } |
1004 | 1013 | ||