From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Vagin Subject: Re: [PATCH 0/5 RFC] Add an interface to discover relationships between namespaces Date: Mon, 25 Jul 2016 19:54:56 -0700 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="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <87r3ahepb4.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: "Eric W. Biederman" Cc: Serge Hallyn , Andrey Vagin , Linux API , Linux Containers , LKML , "criu-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org" , "Michael Kerrisk (man-pages)" , linux-fsdevel , James Bottomley , Alexander Viro List-Id: containers.vger.kernel.org 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754979AbcGZF20 (ORCPT ); Tue, 26 Jul 2016 01:28:26 -0400 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 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=avagin@virtuozzo.com; 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> User-Agent: Mutt/1.6.2 (2016-07-01) X-Originating-IP: [67.183.159.197] X-ClientProxiedBy: BY2PR04CA0074.namprd04.prod.outlook.com (10.255.247.42) To DB6PR0801MB1974.eurprd08.prod.outlook.com (10.168.85.147) X-MS-Office365-Filtering-Correlation-Id: cc16ffaa-9c51-40b1-d264-08d3b500427f X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB1974;2:UUQjceJecLIA9ulJRriFnaNaY+lBE//Xi8QVLP/ty9CmIiMLc7Ewo9sMao3qAtyucj+qHyup6hjb1eNHMgYMnQ2De4VPGl1gZgwG6a+NlhHXxA3HA/cINR12G98xKypPNhWQp6FohXTVt+D/jleySlwDu6/PvAF+hpem1vQB3rAKHqnWJrY7EYRm1l9jIdSY;3:0Hs661WnLNZVcCigRmOUi5fvN2xi24xFCxE+L87fW4Huiw1gw58fj7i0MTDPZ6iYmXyXRxVOgvOLCOvd3Rg+lUywYKoxw+8ZBPgnOKACA/kOY9kM+imUA2do17aAXPT9;25:qEIjE9/iQrpXBiSEchK4qO0K4z585vT+cYMy/QQ3jDvAa6T71ArQIYMy25E9ItFfbtdCaZgXuIUGEf+Wp1sfkg1riF1Igk7DV9egCaAT4w0nqmlQtoa9dewcmHe404s7o4HNPr6olQsr71UJDINi4xeUBl+mRYJxVR5UODL+nrzBPpLtR1weIBfhPw1iOluzGm752lqp3IWrzTTKFnr6CGQZu1QNnVEQuk+n8X4+OH0ALshA3Y6gMfQH200sqb/Qg6quya3cDAZPwPxb9W9A69/aN0K/qJbRNzuvZCcO9j6yQczmiC3xDl8aDGq6yMjP7NSMLGcBoTWYV1BoqpMe1xavHJHqMUJJh0BjDtxnlylEwYwGvhUIEohWCjNGZAafBW9v0CFSv7jND3/9WByPevxPljhBpkS/KKO1yVNwU1Y= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0801MB1974; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB1974;31:W9fE5Q8oCoCzklzR+lQ2ju4zhz727Wfs3KB7JIURltr66n7bcDPeGA9mOP1dTtAkxgwseQTw6r2S2rcg5hvNTUgMSwuJlXpZHtspTuAM/iL2JQ9Do2keLV1+yUNWn3DhRe6jaZd/1/x6GamZNsLFRg/Zd2/shqWvA6FF6sabryZ3t1Uu1LAsN575RSLQo2Lw2f86hukgw53NJJ/BWOpAvQ==;4:s0X0AhfgtPBqlw0GWnxZEaKYdDJQt0Bh8WiRqc+mLuRD064T4n1K9RlLotGAtpwoRD1m0CM33PMUysBr6iALAxR6A4G17qLMbuJ1R+mi5Fc4hCKAvEchWwZIw4gLakmuEmE+pVVfMH+viSTjhYpysD9WsC7RLr4ujD9zsGHXZTR+STVMACf7TdGEPSyo1UUtEucAXl3czyZzh4/+eGBjdEsSLvZHFBl9Co1i9eabiD05xIxWjlzTLqzSl74KYbFhoQC/FAnzuzddCvjJJlaIiXlr3AmA8ecrmKz/EuJsHFc62v6TVve3OAZQYRwAiadxhUEfCs2sqi0Oia9c7hjaQ72WZ3DFQ+pmNZB5ZexlwiG64Hh/FDM0tGMTVsR8QeVJue8Knyc5BPzUzJCxR0ls1oPLtX5jViVJm4oc/tE36l0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040130)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041072)(6043046);SRVR:DB6PR0801MB1974;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0801MB1974; X-Forefront-PRVS: 00159D1518 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(24454002)(51444003)(189002)(305945005)(50466002)(7736002)(33656002)(4326007)(81166006)(69596002)(2950100001)(2906002)(3846002)(47776003)(7846002)(586003)(77096005)(8676002)(105586002)(66066001)(19580395003)(19580405001)(83506001)(6116002)(1076002)(81156014)(97736004)(68736007)(9686002)(23686003)(4001350100001)(42186005)(106356001)(93886004)(101416001)(53416004)(189998001)(110136002)(92566002)(50986999)(54356999)(86362001)(76176999)(18370500001)(26326002);DIR:OUT;SFP:1102;SCL:1;SRVR:DB6PR0801MB1974;H:outlook.office365.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?koi8-r?Q?1;DB6PR0801MB1974;23:xAeWmCaBKoCPLOgYZ5mo264N9Q1qMuzjAQhx61aMy?= =?koi8-r?Q?ELCvOz4nDMdZu9ETiqLTOEWFuYOeJ9wE88LV17UT0M9ll01UZMOZ/Idwk8SK6G?= =?koi8-r?Q?BhQ+NZEoPom2YPz5IpIYjLc4QRnzfDSxNoUVxSM9ukB+TjXuvBu7+p4bYlEGrs?= =?koi8-r?Q?8eJN6bsc1C/Wo5IqHDtYDwsn2Oo/yoQiGuiPCdcvaZ52MwxXjT95LqO/SJeEAL?= =?koi8-r?Q?FhhTVjT0keOqrJrN5hv+DNeagz1xd4U7FivK1yP1E3BdJH1k12evIkwpqtnf8e?= =?koi8-r?Q?7P9+fP92HHJXzux1aU4pIngtyPcagDNvuU/lkl8DtDkOqswgnWKFW61goWeFZ6?= =?koi8-r?Q?gCYIxnA+hsokKhgKQnXqohuB0RBlNo2IsIgcivISlS506tcsqTMBEdY/5JBVQr?= =?koi8-r?Q?3RpIi0N4Vyn4ORrquOOii2yNt9hK0Usr0i+AtJ3rmf4QsGAYPgLv3osGRaEgpO?= =?koi8-r?Q?V32pxRKnlqhChAahyKd5+zbyLXnoK4+Mw4VTWg00itiGpS1c1F7UFSQr0ckvhs?= =?koi8-r?Q?eSn+D5HZG1KUy3M5kjnhruc3FmKbjZhAoCd198dBgg3X5k3hPFOnGFBMk2IJuI?= =?koi8-r?Q?MjXWxWA+leSj4wjU1MeUt8oZyVCPRzZWPiUIb0+CHb5LfHkbVC52pviKRK0esa?= =?koi8-r?Q?P3GqGYoqzVW7H52+2b4+zPWt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Z+e5rQ7AFrESH6MXtZXozlqCK1cYXOQEeaIOTv5LyNt78QLaBl2zMJeLkpdcDYxUqKywjFhUhttnDH0nGzOmIMEPlDa+AnbWZ61BHPJJkYReXhSIMjhvw7e7CzBA==;24:aZlqc0/jVGI3KhIB6cCf1NHBsbmG3JJLcgzNX/HnWnTUeID3i9KrXEEjP/SlrajykUMcd9JWx63XvqW/6Nqu8ITpjw5NUm9/qkMNCFhgwP4=;7:mWF2c346BTUp8e1Wmflof0HZ9j2gO8M6SeOwmoGlBc7QTQbUdkTe7h+0FUSFQsSRSHgdGblU4JyqQ+kZAeaCZPLcDEbaVZ6FW3Y3IaoaCgG2osftK8VBdlgEdGdCIGtidSWtvxbely2vkhLz+6bQFDB6DVF8EcoPisvwcWNcP44s4+bavehCNw9EUoiPSk3M0LbZWamug7K3aNQPpRCgphYLIAmH0IMroW3T0dfBaqLh29OEcCnf+7ZT5BIC00GH SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB1974;20:KYZk6V4UbCj/G0U6YmFiHapGL+H4leMiGG1Lw7pBoe0e6vNThfslIrZMAvLQgdTPy3jj0tuEOUqJ5T8+2a087T2ADt59GMNCb/QCxo+t/1Jpd4LsVS2sbSi8bn1EVvKYCbkkS9risZp+veeSvxXmT+sjo08WNFs1lO2UPPg2+kY= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2016 02:55:08.2930 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1974 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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