Skip to content

Commit b5bd856

Browse files
Vladimir Davydovtorvalds
authored andcommitted
fs/super.c: fix WARN on alloc_super() fail path
On fail path alloc_super() calls destroy_super(), which issues a warning if the sb's s_mounts list is not empty, in particular if it has not been initialized. That said s_mounts must be initialized in alloc_super() before any possible failure, but currently it is initialized close to the end of the function leading to a useless warning dumped to log if either percpu_counter_init() or list_lru_init() fails. Let's fix this. Signed-off-by: Vladimir Davydov <vdavydov@parallels.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 4e4f9e6 commit b5bd856

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎fs/super.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
166166
if (!s)
167167
return NULL;
168168

169+
INIT_LIST_HEAD(&s->s_mounts);
170+
169171
if (security_sb_alloc(s))
170172
goto fail;
171173

@@ -188,7 +190,6 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
188190
if (list_lru_init(&s->s_inode_lru))
189191
goto fail;
190192

191-
INIT_LIST_HEAD(&s->s_mounts);
192193
init_rwsem(&s->s_umount);
193194
lockdep_set_class(&s->s_umount, &type->s_umount_key);
194195
/*

0 commit comments

Comments
 (0)