]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - mm/shmem.c
[PATCH] mm: copy_pte_range progress fix
[karo-tx-linux.git] / mm / shmem.c
index db2c9e8d99095ace5bae8324f2387b9ebdbaf7c6..55e04a0734c19869d12fd07e5df398c207de121b 100644 (file)
@@ -85,7 +85,7 @@ enum sgp_type {
 static int shmem_getpage(struct inode *inode, unsigned long idx,
                         struct page **pagep, enum sgp_type sgp, int *type);
 
-static inline struct page *shmem_dir_alloc(unsigned int gfp_mask)
+static inline struct page *shmem_dir_alloc(gfp_t gfp_mask)
 {
        /*
         * The above definition of ENTRIES_PER_PAGE, and the use of
@@ -666,6 +666,7 @@ static void shmem_delete_inode(struct inode *inode)
        struct shmem_inode_info *info = SHMEM_I(inode);
 
        if (inode->i_op->truncate == shmem_truncate) {
+               truncate_inode_pages(inode->i_mapping, 0);
                shmem_unacct_size(info->flags, inode->i_size);
                inode->i_size = 0;
                shmem_truncate(inode);
@@ -897,7 +898,7 @@ struct page *shmem_swapin(struct shmem_inode_info *info, swp_entry_t entry,
 }
 
 static struct page *
-shmem_alloc_page(unsigned long gfp, struct shmem_inode_info *info,
+shmem_alloc_page(gfp_t gfp, struct shmem_inode_info *info,
                 unsigned long idx)
 {
        struct vm_area_struct pvma;
@@ -920,8 +921,7 @@ shmem_swapin(struct shmem_inode_info *info,swp_entry_t entry,unsigned long idx)
 }
 
 static inline struct page *
-shmem_alloc_page(unsigned int __nocast gfp,struct shmem_inode_info *info,
-                                unsigned long idx)
+shmem_alloc_page(gfp_t gfp,struct shmem_inode_info *info, unsigned long idx)
 {
        return alloc_page(gfp | __GFP_ZERO);
 }
@@ -1607,6 +1607,15 @@ shmem_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
        int error = -ENOSPC;
 
        if (inode) {
+               error = security_inode_init_security(inode, dir, NULL, NULL,
+                                                    NULL);
+               if (error) {
+                       if (error != -EOPNOTSUPP) {
+                               iput(inode);
+                               return error;
+                       }
+                       error = 0;
+               }
                if (dir->i_mode & S_ISGID) {
                        inode->i_gid = dir->i_gid;
                        if (S_ISDIR(mode))
@@ -1616,7 +1625,6 @@ shmem_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
                dir->i_ctime = dir->i_mtime = CURRENT_TIME;
                d_instantiate(dentry, inode);
                dget(dentry); /* Extra count - pin the dentry in core */
-               error = 0;
        }
        return error;
 }
@@ -1746,6 +1754,16 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s
        if (!inode)
                return -ENOSPC;
 
+       error = security_inode_init_security(inode, dir, NULL, NULL,
+                                            NULL);
+       if (error) {
+               if (error != -EOPNOTSUPP) {
+                       iput(inode);
+                       return error;
+               }
+               error = 0;
+       }
+
        info = SHMEM_I(inode);
        inode->i_size = len-1;
        if (len <= (char *)inode - (char *)info) {