From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx3-rdu2.redhat.com ([66.187.233.73]:39756 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751583AbeFWXei (ORCPT ); Sat, 23 Jun 2018 19:34:38 -0400 From: David Howells In-Reply-To: <20180622165715.GA5361@outlook.office365.com> References: <20180622165715.GA5361@outlook.office365.com> <20180621184754.GB21326@outlook.office365.com> <152720682792.9073.14747437198191460035.stgit@warthog.procyon.org.uk> <29799.1529671936@warthog.procyon.org.uk> <20180622153029.GA3070@outlook.office365.com> To: Andrei Vagin Cc: dhowells@redhat.com, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, Tejun Heo Subject: Re: [16/32] kernfs, sysfs, cgroup, intel_rdt: Support fs_context [ver #8] MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <16504.1529796876.1@warthog.procyon.org.uk> Date: Sun, 24 Jun 2018 00:34:36 +0100 Message-ID: <16505.1529796876@warthog.procyon.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Andrei Vagin 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