From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754602AbdBFQ3t (ORCPT ); Mon, 6 Feb 2017 11:29:49 -0500 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:48140 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754175AbdBFQ3r (ORCPT ); Mon, 6 Feb 2017 11:29:47 -0500 Message-ID: <1486398583.2474.61.camel@HansenPartnership.com> Subject: Re: [RFC 1/1] shiftfs: uid/gid shifting bind mount From: James Bottomley To: Amir Goldstein , "J. R. Okajima" Cc: Djalal Harouni , Chris Mason , Theodore Tso , Josh Triplett , "Eric W. Biederman" , Andy Lutomirski , Seth Forshee , linux-fsdevel , linux-kernel , LSM List , Dongsu Park , David Herrmann , Miklos Szeredi , Alban Crequy , Al Viro , "Serge E. Hallyn" , Phil Estes Date: Mon, 06 Feb 2017 08:29:43 -0800 In-Reply-To: References: <1486235880.2484.17.camel@HansenPartnership.com> <1486235972.2484.19.camel@HansenPartnership.com> <4608.1486351540@jrobl> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.5 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2017-02-06 at 08:38 +0200, Amir Goldstein wrote: > On Mon, Feb 6, 2017 at 5:25 AM, J. R. Okajima > wrote: > > James Bottomley: > > > This allows any subtree to be uid/gid shifted and bound > > > elsewhere. It > > ::: > > > > Interesting. > > But I am afraid that the inconsistency problem of the inode numbers > > will happen. > > > > Yet another example that overlayfs already is in the process of > solving (it is fixed for stat of merged directory inode). > In fact, fir the case of single layer overlay (as well as shiftfs) > the solution is trivial - preserve underlying inode st_ino/d_ino and > use the overlayed fs st_dev. not sure I follow what st_ino is, do you mean s_root->d_inode->i_ino? or did you mean s_dev (which is more traditional)? The problem with this is there's no way to ensure global uniqueness in a mapping that goes (ino, ino) -> (ino) (or (s_dev, ino) -> (ino)) and I believe global uniqueness is more important because the i_ino is used in the hashed lookups. Secondly you're not guaranteed that s_root ->d_inode->i_ino is unique ... historically a lot of filesystems use a well known inode number as the root, that's why filehandles traditionally used something representing the device and the inode number (we also have s_dev uniqueness problems for tmpfs which is used in some overlays). We can certainly construct a filehandle using an export operations override that is unique and can be used to lookup the underlying object (based on the underlying device and inode). James