diff options
Diffstat (limited to 'fs/hugetlbfs/inode.c')
-rw-r--r-- | fs/hugetlbfs/inode.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 8f96461236f6..7163fe014b57 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -695,14 +695,11 @@ static struct inode *hugetlbfs_get_root(struct super_block *sb, | |||
695 | 695 | ||
696 | inode = new_inode(sb); | 696 | inode = new_inode(sb); |
697 | if (inode) { | 697 | if (inode) { |
698 | struct hugetlbfs_inode_info *info; | ||
699 | inode->i_ino = get_next_ino(); | 698 | inode->i_ino = get_next_ino(); |
700 | inode->i_mode = S_IFDIR | config->mode; | 699 | inode->i_mode = S_IFDIR | config->mode; |
701 | inode->i_uid = config->uid; | 700 | inode->i_uid = config->uid; |
702 | inode->i_gid = config->gid; | 701 | inode->i_gid = config->gid; |
703 | inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); | 702 | inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); |
704 | info = HUGETLBFS_I(inode); | ||
705 | mpol_shared_policy_init(&info->policy, NULL); | ||
706 | inode->i_op = &hugetlbfs_dir_inode_operations; | 703 | inode->i_op = &hugetlbfs_dir_inode_operations; |
707 | inode->i_fop = &simple_dir_operations; | 704 | inode->i_fop = &simple_dir_operations; |
708 | /* directory inodes start off with i_nlink == 2 (for "." entry) */ | 705 | /* directory inodes start off with i_nlink == 2 (for "." entry) */ |
@@ -733,7 +730,6 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, | |||
733 | 730 | ||
734 | inode = new_inode(sb); | 731 | inode = new_inode(sb); |
735 | if (inode) { | 732 | if (inode) { |
736 | struct hugetlbfs_inode_info *info; | ||
737 | inode->i_ino = get_next_ino(); | 733 | inode->i_ino = get_next_ino(); |
738 | inode_init_owner(inode, dir, mode); | 734 | inode_init_owner(inode, dir, mode); |
739 | lockdep_set_class(&inode->i_mapping->i_mmap_rwsem, | 735 | lockdep_set_class(&inode->i_mapping->i_mmap_rwsem, |
@@ -741,15 +737,6 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, | |||
741 | inode->i_mapping->a_ops = &hugetlbfs_aops; | 737 | inode->i_mapping->a_ops = &hugetlbfs_aops; |
742 | inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); | 738 | inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); |
743 | inode->i_mapping->private_data = resv_map; | 739 | inode->i_mapping->private_data = resv_map; |
744 | info = HUGETLBFS_I(inode); | ||
745 | /* | ||
746 | * The policy is initialized here even if we are creating a | ||
747 | * private inode because initialization simply creates an | ||
748 | * an empty rb tree and calls rwlock_init(), later when we | ||
749 | * call mpol_free_shared_policy() it will just return because | ||
750 | * the rb tree will still be empty. | ||
751 | */ | ||
752 | mpol_shared_policy_init(&info->policy, NULL); | ||
753 | switch (mode & S_IFMT) { | 740 | switch (mode & S_IFMT) { |
754 | default: | 741 | default: |
755 | init_special_inode(inode, mode, dev); | 742 | init_special_inode(inode, mode, dev); |
@@ -937,6 +924,18 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) | |||
937 | hugetlbfs_inc_free_inodes(sbinfo); | 924 | hugetlbfs_inc_free_inodes(sbinfo); |
938 | return NULL; | 925 | return NULL; |
939 | } | 926 | } |
927 | |||
928 | /* | ||
929 | * Any time after allocation, hugetlbfs_destroy_inode can be called | ||
930 | * for the inode. mpol_free_shared_policy is unconditionally called | ||
931 | * as part of hugetlbfs_destroy_inode. So, initialize policy here | ||
932 | * in case of a quick call to destroy. | ||
933 | * | ||
934 | * Note that the policy is initialized even if we are creating a | ||
935 | * private inode. This simplifies hugetlbfs_destroy_inode. | ||
936 | */ | ||
937 | mpol_shared_policy_init(&p->policy, NULL); | ||
938 | |||
940 | return &p->vfs_inode; | 939 | return &p->vfs_inode; |
941 | } | 940 | } |
942 | 941 | ||