Re: [16/32] kernfs, sysfs, cgroup, intel_rdt: Support fs_context [ver #8]

From: David Howells
Date: Sat Jun 23 2018 - 19:34:43 EST


Andrei Vagin <avagin@xxxxxxxxxxxxx> wrote:

> > > > percpu_ref_reinit(&root->cgrp.self.refcnt);
> > > > mutex_unlock(&cgroup_mutex);
> > > > }
> > > > + cgroup_get(&root->cgrp);
> > >
> > > This probably needs to be conditional on ret == 0.
> >
> > yes, you are right
>
>
> I've read the code and I think it isn't obvious. A reference will be
> released id cgroup_fs_context_free() even if ret isn't zero here.
>
> I look at do_new_mount()
>
> vfs_new_fs_context()
> ...
> if (vfs_get_tree())
> goto out_fc;
> ....
> out_fc:
> put_fs_context(fc);
> fc->ops->free(fc);
> cgroup_fs_context_free()
> cgroup_put(&ctx->root->cgrp);

Yeah, you're right: ctx->root is set above, so the put will trigger anyway.
I'll fold both of these changes in.

David