From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-db5eur01on0119.outbound.protection.outlook.com ([104.47.2.119]:38720 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751716AbcGZF2X (ORCPT ); Tue, 26 Jul 2016 01:28:23 -0400 Date: Mon, 25 Jul 2016 19:54:56 -0700 From: Andrew Vagin To: "Eric W. Biederman" CC: "Michael Kerrisk (man-pages)" , Andrey Vagin , Serge Hallyn , "criu@openvz.org" , Linux API , Linux Containers , LKML , James Bottomley , linux-fsdevel , Alexander Viro Subject: Re: [PATCH 0/5 RFC] Add an interface to discover relationships between namespaces Message-ID: <20160726025455.GC26206@outlook.office365.com> 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> <87r3ahepb4.fsf@x220.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Disposition: inline In-Reply-To: <87r3ahepb4.fsf@x220.int.ebiederm.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, Jul 25, 2016 at 09:59:43AM -0500, Eric W. Biederman wrote: > "Michael Kerrisk (man-pages)" writes: [snip] > [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. I like the idea to use kcmp to compare namespaces. I am going to add this functionality to kcmp and describe all these in the man page. > > > > 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. It sounds tricky. BTW: Actually this is not only one places where we have this sort of problem. For example, now mount id-s are not preserved when a container is migrated. The same problem is applied to tmpfs, where inode numbers are not preserved for files. > > 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