diff options
Diffstat (limited to 'fs/hugetlbfs')
-rw-r--r-- | fs/hugetlbfs/inode.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 0f5df73dbb73..12aca8ed605f 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -933,16 +933,11 @@ struct file *hugetlb_file_setup(const char *name, size_t size) | |||
933 | if (!dentry) | 933 | if (!dentry) |
934 | goto out_shm_unlock; | 934 | goto out_shm_unlock; |
935 | 935 | ||
936 | error = -ENFILE; | ||
937 | file = get_empty_filp(); | ||
938 | if (!file) | ||
939 | goto out_dentry; | ||
940 | |||
941 | error = -ENOSPC; | 936 | error = -ENOSPC; |
942 | inode = hugetlbfs_get_inode(root->d_sb, current->fsuid, | 937 | inode = hugetlbfs_get_inode(root->d_sb, current->fsuid, |
943 | current->fsgid, S_IFREG | S_IRWXUGO, 0); | 938 | current->fsgid, S_IFREG | S_IRWXUGO, 0); |
944 | if (!inode) | 939 | if (!inode) |
945 | goto out_file; | 940 | goto out_dentry; |
946 | 941 | ||
947 | error = -ENOMEM; | 942 | error = -ENOMEM; |
948 | if (hugetlb_reserve_pages(inode, 0, size >> HPAGE_SHIFT)) | 943 | if (hugetlb_reserve_pages(inode, 0, size >> HPAGE_SHIFT)) |
@@ -951,17 +946,18 @@ struct file *hugetlb_file_setup(const char *name, size_t size) | |||
951 | d_instantiate(dentry, inode); | 946 | d_instantiate(dentry, inode); |
952 | inode->i_size = size; | 947 | inode->i_size = size; |
953 | inode->i_nlink = 0; | 948 | inode->i_nlink = 0; |
954 | file->f_path.mnt = mntget(hugetlbfs_vfsmount); | 949 | |
955 | file->f_path.dentry = dentry; | 950 | error = -ENFILE; |
956 | file->f_mapping = inode->i_mapping; | 951 | file = alloc_file(hugetlbfs_vfsmount, dentry, |
957 | file->f_op = &hugetlbfs_file_operations; | 952 | FMODE_WRITE | FMODE_READ, |
958 | file->f_mode = FMODE_WRITE | FMODE_READ; | 953 | &hugetlbfs_file_operations); |
954 | if (!file) | ||
955 | goto out_inode; | ||
956 | |||
959 | return file; | 957 | return file; |
960 | 958 | ||
961 | out_inode: | 959 | out_inode: |
962 | iput(inode); | 960 | iput(inode); |
963 | out_file: | ||
964 | put_filp(file); | ||
965 | out_dentry: | 961 | out_dentry: |
966 | dput(dentry); | 962 | dput(dentry); |
967 | out_shm_unlock: | 963 | out_shm_unlock: |