Re: [RFC 1/1] shiftfs: uid/gid shifting bind mount
From: James Bottomley
Date: Mon Feb 06 2017 - 11:30:04 EST
On Mon, 2017-02-06 at 08:38 +0200, Amir Goldstein wrote:
> On Mon, Feb 6, 2017 at 5:25 AM, J. R. Okajima <hooanon05g@xxxxxxxxx>
> 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