linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Trond Myklebust <trondmy@primarydata.com>
To: "miklos@szeredi.hu" <miklos@szeredi.hu>
Cc: "bfields@fieldses.org" <bfields@fieldses.org>,
	"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
	"jlayton@poochiereds.net" <jlayton@poochiereds.net>,
	"amir73il@gmail.com" <amir73il@gmail.com>,
	"linux-unionfs@vger.kernel.org" <linux-unionfs@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: overlayfs NFS export
Date: Fri, 7 Apr 2017 15:46:25 +0000	[thread overview]
Message-ID: <1491579981.12269.1.camel@primarydata.com> (raw)
In-Reply-To: <CAJfpegu5hkHM7z4UWhoNhoXBJ9ZmmA8EpAaoThxRe45cCSDeAQ@mail.gmail.com>

On Fri, 2017-04-07 at 17:28 +0200, Miklos Szeredi wrote:
> On Fri, Apr 7, 2017 at 4:57 PM, Trond Myklebust <trondmy@primarydata.
> com> wrote:
> 
> > What is the problem you are trying to solve?
> 
> The problem is getting a persistent file handle for overlayfs files.
> 
> One idea suggested by Viro is to create a dummy inode on the upper
> layer whenever we look up a dentry in the overlay filesystem.  Then
> we
> have an inode number reserved for the file if it needs to be copied
> up. This solves the file handle problem, since we can generate a path
> from the file handle and from there get the original lower layer file
> (assumes the file handle has the parent handle encoded as well).  If
> the file is copied up, the file is no longer assiciated with the
> lower
> layer, we just need to use the upper inode, this works too.  And also
> files created on the upper work fine.
> 

Why do you need the parent directory to be encoded as well? Doesn't
fh_to_dentry() suffice?

The thing is that for all namespace related operations (mkdir(),
rmdir(), open(O_CREATE), unlink,...) the client will supply the parent
filehandle, so those operations should not normally suffer.

The only operation that would be a problem is when you have to copy up
a regular file, but for that case overlayfs needs to generate dentries
for _all_ hardlinks to that file, in the upper layer, no?

> The only little problem is that we are creating lots of inodes on
> disk
> and memory that until now we haven't.  Currently overlayfs only
> modifies upper layer if there's a good reason to believe that there
> is
> really going to be modification (e.g. when file is opened for write).
> 
> The alternative is generate file handle from lower file (if on lower)
> and from upper file (if on upper).   The issue is if the file is
> copied up and goes from lower to upper.  In that case we need to find
> the upper file from the handle generated from the lower file.   This
> works as long as the upper file hasn't been renamed, same way we
> found
> the lower from the upper Viro's scheme: generate path from lower file
> handle and look up in overlay.  When copied up file is renamed, this
> doesn't work anymore, so we need a mapping from lower-handle to
> upper-handle.
> 
Generating filehandles from the namespace is a nightmare. It only works
if you have strict non-POSIX-compatible rules about not being able to
modify the parent of a subtree if there is a file in use in that
subtree. You can therefore make it work if the underlying filesystem is
something like NTFS, but not if you want POSIX semantics.

-- 
Trond Myklebust
Linux NFS client maintainer, PrimaryData
trond.myklebust@primarydata.com

  parent reply	other threads:[~2017-04-07 15:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-07 14:29 overlayfs NFS export Amir Goldstein
2017-04-07 14:53 ` Jeff Layton
2017-04-07 15:26   ` Amir Goldstein
2017-04-07 14:57 ` Trond Myklebust
2017-04-07 15:28   ` Miklos Szeredi
2017-04-07 15:45     ` Amir Goldstein
2017-04-07 15:58       ` Trond Myklebust
2017-04-07 16:10         ` Amir Goldstein
2017-04-07 16:21           ` Trond Myklebust
2017-04-07 18:43             ` Amir Goldstein
2017-04-07 16:47           ` Jeff Layton
2017-04-07 18:53             ` Amir Goldstein
2017-04-07 15:46     ` Trond Myklebust [this message]
2017-04-07 15:58       ` Amir Goldstein
2017-04-07 16:02         ` Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1491579981.12269.1.camel@primarydata.com \
    --to=trondmy@primarydata.com \
    --cc=amir73il@gmail.com \
    --cc=bfields@fieldses.org \
    --cc=jlayton@poochiereds.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).