Merge tag 'for_linus-3.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jwesse...
[firefly-linux-kernel-4.4.55.git] / mm / shmem.c
index 7cc80833b74aee81d61a2dac355de17dbbecb56f..f99ff3e50bd6af061b30722528d002bab68e6e40 100644 (file)
@@ -127,7 +127,7 @@ static inline struct shmem_sb_info *SHMEM_SB(struct super_block *sb)
 static inline int shmem_acct_size(unsigned long flags, loff_t size)
 {
        return (flags & VM_NORESERVE) ?
-               0 : security_vm_enough_memory_kern(VM_ACCT(size));
+               0 : security_vm_enough_memory_mm(current->mm, VM_ACCT(size));
 }
 
 static inline void shmem_unacct_size(unsigned long flags, loff_t size)
@@ -145,7 +145,7 @@ static inline void shmem_unacct_size(unsigned long flags, loff_t size)
 static inline int shmem_acct_block(unsigned long flags)
 {
        return (flags & VM_NORESERVE) ?
-               security_vm_enough_memory_kern(VM_ACCT(PAGE_CACHE_SIZE)) : 0;
+               security_vm_enough_memory_mm(current->mm, VM_ACCT(PAGE_CACHE_SIZE)) : 0;
 }
 
 static inline void shmem_unacct_blocks(unsigned long flags, long pages)
@@ -2231,7 +2231,6 @@ static void shmem_put_super(struct super_block *sb)
 int shmem_fill_super(struct super_block *sb, void *data, int silent)
 {
        struct inode *inode;
-       struct dentry *root;
        struct shmem_sb_info *sbinfo;
        int err = -ENOMEM;
 
@@ -2288,14 +2287,11 @@ int shmem_fill_super(struct super_block *sb, void *data, int silent)
                goto failed;
        inode->i_uid = sbinfo->uid;
        inode->i_gid = sbinfo->gid;
-       root = d_alloc_root(inode);
-       if (!root)
-               goto failed_iput;
-       sb->s_root = root;
+       sb->s_root = d_make_root(inode);
+       if (!sb->s_root)
+               goto failed;
        return 0;
 
-failed_iput:
-       iput(inode);
 failed:
        shmem_put_super(sb);
        return err;