Re: [PATCH] fs: handle shrinker registration failure in sget_userns

From: Michal Hocko
Date: Thu Nov 23 2017 - 10:00:59 EST


On Thu 23-11-17 14:47:35, Al Viro wrote:
> On Thu, Nov 23, 2017 at 12:52:47PM +0100, Michal Hocko wrote:
> > @@ -503,12 +504,18 @@ struct super_block *sget_userns(struct file_system_type *type,
> > s = alloc_super(type, (flags & ~SB_SUBMOUNT), user_ns);
> > if (!s)
> > return ERR_PTR(-ENOMEM);
> > + if (register_shrinker(&s->s_shrink)) {
> > + spin_unlock(&sb_lock);
> > + destroy_unused_super(s);
> > + return ERR_PTR(-ENOMEM);
>
> Have you even tested that? What the hell is that spin_unlock() doing there?

Yeah, that patch was just screwed up. Have a look at
http://lkml.kernel.org/r/20171123143537.ztpxpk3sjbpo72rf@xxxxxxxxxxxxxx
which should even resemble a real patch.

Sorry about all the confusion.

--
Michal Hocko
SUSE Labs