From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932289AbcHBTXQ (ORCPT ); Tue, 2 Aug 2016 15:23:16 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:32839 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753867AbcHBTXK (ORCPT ); Tue, 2 Aug 2016 15:23:10 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: "J. Bruce Fields" Cc: Nikolay Borisov , jlayton@poochiereds.net, viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, containers@lists.linux-foundation.org, serge.hallyn@canonical.com References: <1470148943-21835-1-git-send-email-kernel@kyup.com> <87r3a7qhy0.fsf@x220.int.ebiederm.org> <20160802174003.GD11767@fieldses.org> Date: Tue, 02 Aug 2016 14:09:22 -0500 In-Reply-To: <20160802174003.GD11767@fieldses.org> (J. Bruce Fields's message of "Tue, 2 Aug 2016 13:40:03 -0400") Message-ID: <87invjq97h.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-SPF: eid=1bUfGt-0000yk-0R;;;mid=<87invjq97h.fsf@x220.int.ebiederm.org>;;;hst=in01.mta.xmission.com;;;ip=67.3.204.119;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX19baXVGxELOhEptpK0QCEfae5/61WIQCUE= X-SA-Exim-Connect-IP: 67.3.204.119 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.7 XMSubLong Long Subject * 0.0 TVD_RCVD_IP Message was received from an IP address * 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.4996] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa01 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa01 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;"J. Bruce Fields" X-Spam-Relay-Country: X-Spam-Timing: total 575 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 3.6 (0.6%), b_tie_ro: 2.6 (0.4%), parse: 1.22 (0.2%), extract_message_metadata: 29 (5.1%), get_uri_detail_list: 2.2 (0.4%), tests_pri_-1000: 10 (1.8%), tests_pri_-950: 1.97 (0.3%), tests_pri_-900: 1.64 (0.3%), tests_pri_-400: 34 (5.9%), check_bayes: 32 (5.6%), b_tokenize: 10 (1.8%), b_tok_get_all: 7 (1.3%), b_comp_prob: 4.1 (0.7%), b_tok_touch_all: 4.7 (0.8%), b_finish: 2.3 (0.4%), tests_pri_0: 480 (83.5%), check_dkim_signature: 1.48 (0.3%), check_dkim_adsp: 4.1 (0.7%), tests_pri_500: 7 (1.3%), rewrite_mail: 0.00 (0.0%) Subject: Re: [RFC PATCH] locks: Show only file_locks created in the same pidns as current process X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "J. Bruce Fields" writes: > On Tue, Aug 02, 2016 at 11:00:39AM -0500, Eric W. Biederman wrote: >> Nikolay Borisov writes: >> >> > Currently when /proc/locks is read it will show all the file locks >> > which are currently created on the machine. On containers, hosted >> > on busy servers this means that doing lsof can be very slow. I >> > observed up to 5 seconds stalls reading 50k locks, while the container >> > itself had only a small number of relevant entries. Fix it by >> > filtering the locks listed by the pidns of the current process >> > and the process which created the lock. >> >> The locks always confuse me so I am not 100% connecting locks >> to a pid namespace is appropriate. >> >> That said if you are going to filter by pid namespace please use the pid >> namespace of proc, not the pid namespace of the process reading the >> file. > > Oh, that makes sense, thanks. > > What does /proc/mounts use, out of curiosity? The mount namespace that > /proc was originally mounted in? /proc/mounts -> /proc/self/mounts /proc/[pid]/mounts lists mounts from the mount namespace of the appropriate process. That is another way to go but it is a tread carefully thing as changing things that way it is easy to surprise apparmor or selinux rules and be surprised you broke someones userspace in a way that prevents booting. Although I suspect /proc/locks isn't too bad. Eric