Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2365658imm; Sat, 23 Jun 2018 16:36:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKI6/tCSfXwoYUAip2DWrDElh+ygFAqUosBNhnV1Uctkg62VjeojJrc9nWvW6+HXhmG+QyK X-Received: by 2002:a62:f5da:: with SMTP id b87-v6mr7345915pfm.113.1529796966702; Sat, 23 Jun 2018 16:36:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529796966; cv=none; d=google.com; s=arc-20160816; b=qD/Odz0QQ+z8d2+ik4vlY5tksWBXe+n0JrbVOcge5VRXtpwKGTDBWX5P4e094a/1Uw 7gczyYnma/klQ2QRONpTJW7lsRBZbsphUHTXuSLuT53RjD/k7Yu4cg/H3MWWKYGfBa40 H8acBoLYdiYt/pQLg8LOrvdasoXYtLCvGhbfuGHtAdlNnBxjsz1u+hbX5x9J5AN3ySgE uTQPEvB1q4MQP5I3z43Qjeav9QGWraOrE1dUyo4TbqZ+CgwvjdQ3Cr5RuJVtah/0utyn SyHl7NwaHO/4sQifJDXx5cGi39zzFh6mb4wLopa4x+R2B6jiLJXgm0Gt62uMbx7bUTAn SNBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-id:mime-version :subject:cc:to:references:in-reply-to:from:organization :arc-authentication-results; bh=QxxgA+z6oSpK4xCqUwXpokQHfBNlo6gkIocHjN5iuO0=; b=PiU+Hdgv3qjDUPDMiQubgsu4bk+RO+CvJ0veE50OO/GKtuWjDctiHWrUE0UtZS/pHd H8T99ZVvCfngbrpl/4P6GznsL9n4qTKRzupvLnQAeYYCGBcXzwOhwVwcDtnXfGgfTExK ioYs3sSLvgOLFFvDUN+LBKmoAtaeaQtJZdyTNXJJGA0QBqw1jqyyn6SC6Hg5gKJnXwJy YWwRhEDNyYg0tL0kVtmdHXwdeoD7oaqFrX3C1ssVefl6Z6IaDzd0L1mH7GhtS3pm78QQ 8B9YUTO0StJx9N0UG8zGlTinO8VJ/v2y6Vf28kXLvBaQyYgD0Tw9ajbFUesKqfMrALCK YuNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f69-v6si10606834plb.503.2018.06.23.16.35.41; Sat, 23 Jun 2018 16:36:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751781AbeFWXek (ORCPT + 99 others); Sat, 23 Jun 2018 19:34:40 -0400 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 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3A92E7C6A9; Sat, 23 Jun 2018 23:34:38 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-238.rdu2.redhat.com [10.10.120.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 136E32026D69; Sat, 23 Jun 2018 23:34:36 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 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> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Sat, 23 Jun 2018 23:34:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Sat, 23 Jun 2018 23:34:38 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dhowells@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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