Commit c2d22ecd authored by Al Viro's avatar Al Viro

fs/super.c: fix lru_list leak for real

Freeing ->s_{inode,dentry}_lru in deactivate_locked_super() is wrong;
the right place is destroy_super().  As it is, we leak them if sget()
decides that new superblock it has allocated (and never shown to
anybody) isn't needed and should be freed.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 13f35838
...@@ -264,6 +264,8 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags) ...@@ -264,6 +264,8 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
*/ */
static inline void destroy_super(struct super_block *s) static inline void destroy_super(struct super_block *s)
{ {
list_lru_destroy(&s->s_dentry_lru);
list_lru_destroy(&s->s_inode_lru);
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
free_percpu(s->s_files); free_percpu(s->s_files);
#endif #endif
...@@ -323,8 +325,6 @@ void deactivate_locked_super(struct super_block *s) ...@@ -323,8 +325,6 @@ void deactivate_locked_super(struct super_block *s)
/* caches are now gone, we can safely kill the shrinker now */ /* caches are now gone, we can safely kill the shrinker now */
unregister_shrinker(&s->s_shrink); unregister_shrinker(&s->s_shrink);
list_lru_destroy(&s->s_dentry_lru);
list_lru_destroy(&s->s_inode_lru);
put_filesystem(fs); put_filesystem(fs);
put_super(s); put_super(s);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment