From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752657AbcGYPNc (ORCPT ); Mon, 25 Jul 2016 11:13:32 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:48691 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753125AbcGYPNP convert rfc822-to-8bit (ORCPT ); Mon, 25 Jul 2016 11:13:15 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: "Michael Kerrisk \(man-pages\)" Cc: Andrey Vagin , Serge Hallyn , Andrew Vagin , "criu\@openvz.org" , Linux API , Linux Containers , LKML , James Bottomley , linux-fsdevel , Alexander Viro References: <1468520419-28220-1-git-send-email-avagin@openvz.org> <20160721210650.GA10989@outlook.office365.com> <1515f5f2-5a49-fcab-61f4-8b627d3ba3e2@gmail.com> <87lh0pg8jx.fsf@x220.int.ebiederm.org> <44ca0e41-dc92-45b1-2a6c-c41a048a072d@gmail.com> Date: Mon, 25 Jul 2016 09:59:43 -0500 In-Reply-To: <44ca0e41-dc92-45b1-2a6c-c41a048a072d@gmail.com> (Michael Kerrisk's message of "Mon, 25 Jul 2016 16:46:25 +0200") Message-ID: <87r3ahepb4.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; charset=utf-8 Content-Transfer-Encoding: 8BIT X-XM-SPF: eid=1bRhYr-0001s0-1P;;;mid=<87r3ahepb4.fsf@x220.int.ebiederm.org>;;;hst=in02.mta.xmission.com;;;ip=67.3.204.119;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+uMELHzSLO32Nl7yCXWgUt05LxlGBH0hs= 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.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.4843] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;"Michael Kerrisk \(man-pages\)" X-Spam-Relay-Country: X-Spam-Timing: total 344 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 3.3 (1.0%), b_tie_ro: 2.5 (0.7%), parse: 1.12 (0.3%), extract_message_metadata: 5 (1.5%), get_uri_detail_list: 2.9 (0.8%), tests_pri_-1000: 5 (1.6%), tests_pri_-950: 1.59 (0.5%), tests_pri_-900: 1.34 (0.4%), tests_pri_-400: 30 (8.8%), check_bayes: 29 (8.4%), b_tokenize: 11 (3.2%), b_tok_get_all: 9 (2.6%), b_comp_prob: 3.5 (1.0%), b_tok_touch_all: 2.9 (0.8%), b_finish: 0.72 (0.2%), tests_pri_0: 277 (80.5%), check_dkim_signature: 0.49 (0.1%), check_dkim_adsp: 22 (6.3%), tests_pri_500: 5 (1.5%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 0/5 RFC] Add an interface to discover relationships between namespaces 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 in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "Michael Kerrisk (man-pages)" writes: > Hi Eric, > > On 07/25/2016 03:18 PM, Eric W. Biederman wrote: >> "Michael Kerrisk (man-pages)" writes: >> >>> Hi Andrey, >>> >>> On 07/22/2016 08:25 PM, Andrey Vagin wrote: >>>> On Thu, Jul 21, 2016 at 11:48 PM, Michael Kerrisk (man-pages) >>>> wrote: >>>>> Hi Andrey, >>>>> >>>>> >>>>> On 07/21/2016 11:06 PM, Andrew Vagin wrote: >>>>>> [snip] >>>>>> where ioctl_type is one of the following: >>>>>> >>>>>> NS_GET_USERNS >>>>>> Returns a file descriptor that refers to an owning user names‐ >>>>>> pace. >>>>>> >>>>>> NS_GET_PARENT >>>>>> Returns a file descriptor that refers to a parent namespace. >>>>>> This ioctl(2) can be used for pid and user namespaces. For user >>>>>> namespaces, NS_GET_PARENT and NS_GET_USERNS have the same mean‐ >>>>>> ing. >>> >>> For each of the above, I think it is worth mentioning that the >>> close-on-exec flag is set for the returned file descriptor. >> >> Hmm. That is an odd default. > > Why do you say that? It's pretty common as the default for various > APIs that create new FDs these days. (There's of course a strong argument > that the original UNIX default was a design blunder...) Interesting. I haven't kept up on that, but it seems reasonable. [snip] >>> So, from my point of view, the important piece that was missing from >>> your commit message was the note to use readlink("/proc/self/fd/%d") >>> on the returned FDs. I think that detail needs to be part of the >>> commit message (and also the man page text). I think it even be >>> helpful to include the above program as part of the commit message: >>> it helps people more quickly grasp the API. >> >> Please, please make the standard way to compare these things fstat. >> That is much less magic than a symlink, and a little more future proof. >> Possibly even kcmp. > > As in fstat() to get the st_ino field, right? Both the st_ino and st_dev fields. The most likely change to support checkpoint/restart in the future is to preserve st_ino across migrations and instantiate a different instance of nsfs to hold the inode numbers from the previous machine. We would need to handle the preservation carefully or else there is a chance that two namespace file descriptors (collected from different sources) with different st_dev and st_ino fields may actuall refer to the same object. Which is a long way of saying we have the st_dev field please use it, it may matter at some point. Eric