diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2009-09-10 00:02:02 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2009-09-10 00:02:02 +0200 |
commit | bf992fa2bc1ad1bb2aeb0bdfadb43f236b9297fd (patch) | |
tree | d67f525c76b66956ba7ca0d40bc0fcda0e414700 /fs/hugetlbfs/inode.c | |
parent | 9d7302299ee96ca954fe4ab8ca640333b6e19ad0 (diff) | |
parent | 7135a71b19be1faf48b7148d77844d03bc0717d6 (diff) | |
download | blackbird-op-linux-bf992fa2bc1ad1bb2aeb0bdfadb43f236b9297fd.tar.gz blackbird-op-linux-bf992fa2bc1ad1bb2aeb0bdfadb43f236b9297fd.zip |
Merge branch 'master' into for-linus
Diffstat (limited to 'fs/hugetlbfs/inode.c')
-rw-r--r-- | fs/hugetlbfs/inode.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 941c8425c10b..cb88dac8ccaa 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -935,26 +935,28 @@ static int can_do_hugetlb_shm(void) return capable(CAP_IPC_LOCK) || in_group_p(sysctl_hugetlb_shm_group); } -struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag) +struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag, + struct user_struct **user) { int error = -ENOMEM; - int unlock_shm = 0; struct file *file; struct inode *inode; struct dentry *dentry, *root; struct qstr quick_string; - struct user_struct *user = current_user(); + *user = NULL; if (!hugetlbfs_vfsmount) return ERR_PTR(-ENOENT); if (!can_do_hugetlb_shm()) { - if (user_shm_lock(size, user)) { - unlock_shm = 1; + *user = current_user(); + if (user_shm_lock(size, *user)) { WARN_ONCE(1, "Using mlock ulimits for SHM_HUGETLB deprecated\n"); - } else + } else { + *user = NULL; return ERR_PTR(-EPERM); + } } root = hugetlbfs_vfsmount->mnt_root; @@ -996,8 +998,10 @@ out_inode: out_dentry: dput(dentry); out_shm_unlock: - if (unlock_shm) - user_shm_unlock(size, user); + if (*user) { + user_shm_unlock(size, *user); + *user = NULL; + } return ERR_PTR(error); } |