Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751899AbcDSBXL (ORCPT ); Mon, 18 Apr 2016 21:23:11 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:40877 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751600AbcDSBXI (ORCPT ); Mon, 18 Apr 2016 21:23:08 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: "Serge E. Hallyn" Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, containers@lists.linux-foundation.org, hannes@cmpxchg.org, gregkh@linuxfoundation.org, tj@kernel.org, cgroups@vger.kernel.org, akpm@linux-foundation.org, serge@hallyn.com References: <1460923472-29370-1-git-send-email-serge.hallyn@ubuntu.com> <1460923472-29370-3-git-send-email-serge.hallyn@ubuntu.com> <20160418041126.GA424@mail.hallyn.com> Date: Mon, 18 Apr 2016 20:12:39 -0500 In-Reply-To: <20160418041126.GA424@mail.hallyn.com> (Serge E. Hallyn's message of "Sun, 17 Apr 2016 23:11:27 -0500") Message-ID: <87mvoqqu48.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-AID: U2FsdGVkX1+qQNirlBNgDZDTsAgXn8o+t/8meZGqHSw= X-SA-Exim-Connect-IP: 97.119.105.151 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4544] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;"Serge E. Hallyn" X-Spam-Relay-Country: X-Spam-Timing: total 1996 ms - load_scoreonly_sql: 0.12 (0.0%), signal_user_changed: 6 (0.3%), b_tie_ro: 4.1 (0.2%), parse: 1.83 (0.1%), extract_message_metadata: 18 (0.9%), get_uri_detail_list: 1.77 (0.1%), tests_pri_-1000: 6 (0.3%), tests_pri_-950: 1.44 (0.1%), tests_pri_-900: 1.16 (0.1%), tests_pri_-400: 23 (1.1%), check_bayes: 21 (1.1%), b_tokenize: 6 (0.3%), b_tok_get_all: 6 (0.3%), b_comp_prob: 2.3 (0.1%), b_tok_touch_all: 2.7 (0.1%), b_finish: 0.86 (0.0%), tests_pri_0: 314 (15.7%), check_dkim_signature: 0.95 (0.0%), check_dkim_adsp: 4.5 (0.2%), tests_pri_500: 1620 (81.1%), poll_dns_idle: 1610 (80.6%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 2/2] mountinfo: implement show_path for kernfs and cgroup X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1228 Lines: 37 "Serge E. Hallyn" writes: >> diff --git a/kernel/cgroup.c b/kernel/cgroup.c >> index 671dc05..9a0d7b3 100644 >> --- a/kernel/cgroup.c >> +++ b/kernel/cgroup.c >> @@ -1593,6 +1593,40 @@ static int rebind_subsystems(struct cgroup_root *dst_root, u16 ss_mask) >> return 0; >> } >> >> +static int cgroup_show_path(struct seq_file *sf, struct kernfs_node *kf_node, >> + struct kernfs_root *kf_root) >> +{ >> + int len = 0, ret = 0; >> + char *buf = NULL; >> + struct cgroup_namespace *ns = current->nsproxy->cgroup_ns; >> + struct cgroup_root *kf_cgroot = cgroup_root_from_kf(kf_root); >> + struct cgroup *ns_cgroup; >> + >> + mutex_lock(&cgroup_mutex); > > Hm, I can't grab the cgroup mutex here because I already have the > namespace_sem. But that's required by cset_cgroup_from_root(). Can > I just call that under rcu_read_lock() instead? (Not without > changing the lockdep_assert_help()). Is there another way to get the > info needed here? Do we need the current cgroup namespace information at all? Could we not get the relevant cgroup namespace from the mount of cgroupfs? In general the better path is not to have the contents of files depend on who is reading the file. Eric