kmemcg: account certain kmem allocations to memcg
[deliverable/linux.git] / fs / ecryptfs / main.c
index c095d32642599f90cf68a9437b9a10674d5cd3d9..e25b6b06bacf2cf8719d76d06e6efb8a60bd78b8 100644 (file)
@@ -546,11 +546,11 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
                goto out_free;
        }
 
-       if (check_ruid && !uid_eq(path.dentry->d_inode->i_uid, current_uid())) {
+       if (check_ruid && !uid_eq(d_inode(path.dentry)->i_uid, current_uid())) {
                rc = -EPERM;
                printk(KERN_ERR "Mount of device (uid: %d) not owned by "
                       "requested user (uid: %d)\n",
-                       i_uid_read(path.dentry->d_inode),
+                       i_uid_read(d_inode(path.dentry)),
                        from_kuid(&init_user_ns, current_uid()));
                goto out_free;
        }
@@ -584,7 +584,7 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
                goto out_free;
        }
 
-       inode = ecryptfs_get_inode(path.dentry->d_inode, s);
+       inode = ecryptfs_get_inode(d_inode(path.dentry), s);
        rc = PTR_ERR(inode);
        if (IS_ERR(inode))
                goto out_free;
@@ -663,6 +663,7 @@ static struct ecryptfs_cache_info {
        struct kmem_cache **cache;
        const char *name;
        size_t size;
+       unsigned long flags;
        void (*ctor)(void *obj);
 } ecryptfs_cache_infos[] = {
        {
@@ -684,6 +685,7 @@ static struct ecryptfs_cache_info {
                .cache = &ecryptfs_inode_info_cache,
                .name = "ecryptfs_inode_cache",
                .size = sizeof(struct ecryptfs_inode_info),
+               .flags = SLAB_ACCOUNT,
                .ctor = inode_info_init_once,
        },
        {
@@ -755,8 +757,8 @@ static int ecryptfs_init_kmem_caches(void)
                struct ecryptfs_cache_info *info;
 
                info = &ecryptfs_cache_infos[i];
-               *(info->cache) = kmem_cache_create(info->name, info->size,
-                               0, SLAB_HWCACHE_ALIGN, info->ctor);
+               *(info->cache) = kmem_cache_create(info->name, info->size, 0,
+                               SLAB_HWCACHE_ALIGN | info->flags, info->ctor);
                if (!*(info->cache)) {
                        ecryptfs_free_kmem_caches();
                        ecryptfs_printk(KERN_WARNING, "%s: "
This page took 0.154234 seconds and 5 git commands to generate.