Browse Source

sget(): handle failures of register_shrinker()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Al Viro 7 years ago
parent
commit
9ee332d99e
1 changed files with 5 additions and 1 deletions
  1. 5 1
      fs/super.c

+ 5 - 1
fs/super.c

@@ -517,7 +517,11 @@ retry:
 	hlist_add_head(&s->s_instances, &type->fs_supers);
 	spin_unlock(&sb_lock);
 	get_filesystem(type);
-	register_shrinker(&s->s_shrink);
+	err = register_shrinker(&s->s_shrink);
+	if (err) {
+		deactivate_locked_super(s);
+		s = ERR_PTR(err);
+	}
 	return s;
 }