linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	"linux-unionfs@vger.kernel.org" <linux-unionfs@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [RFC][PATCH 02/13] ovl: redirect dir by file handle on copy up
Date: Thu, 20 Apr 2017 11:55:57 +0300	[thread overview]
Message-ID: <CAOQ4uxgyqeAxMgewLhpOXQpdKMWRdiQxESZwpSacL1naAD75YA@mail.gmail.com> (raw)
In-Reply-To: <CAOQ4uxgQ4naPLq2n2GBEyAL0qW=Pwm=Qkw4QX8nwiNmCESDoTA@mail.gmail.com>

On Wed, Apr 19, 2017 at 6:27 PM, Amir Goldstein <amir73il@gmail.com> wrote:
> On Wed, Apr 19, 2017 at 6:16 PM, Miklos Szeredi <miklos@szeredi.hu> wrote:
>> On Mon, Apr 17, 2017 at 1:59 AM, Amir Goldstein <amir73il@gmail.com> wrote:
>>> When mounted with mount option redirect_dir=fh,
>>> every copy up of lower directory stores the lower
>>> dir file handle in overlay.fh xattr of upper dir.
>>
>> Is there a disadvantage to doing this unconditionally? (Same goes for patch 4)
>>
>> Is there a disadvantage to doing this even for the non-samefs case?
>>
>
> Not that I can think of. It's just that all the features that stable
> inode brings
> to the table only work for same_fs right now, but we can store overlay.fh
> anyway.
>

Sorry, I remembered what the reason was.

File handles are only unique for a single fs namespace.
Right now, the copy up stores the lower handle in overlay.fh
without storing lower layer number and/or lower fs device id.

The overlay.fh format has a header with version and magic:
struct ovl_fh {
        unsigned char version;  /* 0 */
        unsigned char magic;    /* 0xfb */

So we can easily extend this format later on to support non
same fs redirect_fh.

That said, to answer your question, there is no disadvantage to
storing the lower handle for non-samefs case, there is only
a problem with lookup in the case of several lower layers
no on the same fs.

So we can actually relax the samefs constrain for redirect_fh
to exclude upper layer and specifically, we can always use redirect_fh
in the single lower layer case.

There is one more advantage to storing overlay.fh unconditionally.
Even with multi non-samefs lower layers, the overlay.fh on upper
can be used to distinguish between "merge" and "pure" upper
for non dirs.

I would like to extend the meaning of OVL_TYPE_MERGE
to represent an upper non-dir that has been copied up.
Patch #5 already takes the first step and sets numlower = 1
for non-dirs that have been copied up on samefs.

The next steps would be:
1. remove d_is_dir() check from ovl_path_type()
    BTW, can you please explain this comment.
    I don't understand how this could be:

                /*
                 * Non-dir dentry can hold lower dentry from previous
                 * location.
                 */
                if (oe->numlower && d_is_dir(dentry))
                        type |= __OVL_PATH_MERGE;

2. check merge_or_lower() in ovl_rename() also for non-dir case
    this will cause setting overlay.redirect on non-dir
    and then hardlinks could work better when copying layers
    even without reverse mapping and recovery

3. set __OVL_PATH_MERGE flag during lookup for non-samefs
    In non-samefs case, __OVL_PATH_MERGE may not always be
    deduced from numlower, so need to use my patch that add
    ovl_update_type() [1]

[1] https://marc.info/?l=linux-unionfs&m=149079818122017&w=2

Amir.

  parent reply	other threads:[~2017-04-20  8:55 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-16 23:59 [RFC][PATCH 00/13] overlayfs stable inodes Amir Goldstein
2017-04-16 23:59 ` [RFC][PATCH 01/13] ovl: check if all layers are on the same fs Amir Goldstein
2017-04-16 23:59 ` [RFC][PATCH 02/13] ovl: redirect dir by file handle on copy up Amir Goldstein
2017-04-17 13:33   ` Rock Lee
2017-04-17 14:03     ` Amir Goldstein
2017-04-17 19:49   ` Vivek Goyal
2017-04-17 21:14     ` Amir Goldstein
2017-04-19 15:16   ` Miklos Szeredi
2017-04-19 15:27     ` Amir Goldstein
2017-04-19 15:33       ` Miklos Szeredi
2017-04-19 15:43         ` Amir Goldstein
2017-04-20  8:55       ` Amir Goldstein [this message]
2017-04-21 15:02         ` Miklos Szeredi
2017-04-21 15:29           ` Amir Goldstein
2017-04-16 23:59 ` [RFC][PATCH 03/13] ovl: lookup redirect by file handle Amir Goldstein
2017-04-18 13:05   ` Vivek Goyal
2017-04-18 14:05     ` Amir Goldstein
2017-04-18 18:32       ` Vivek Goyal
2017-04-18 18:57         ` Amir Goldstein
2017-04-19 15:21           ` Miklos Szeredi
2017-04-19 15:35             ` Amir Goldstein
2017-04-16 23:59 ` [RFC][PATCH 04/13] ovl: store file handle of stable inode Amir Goldstein
2017-04-16 23:59 ` [RFC][PATCH 05/13] ovl: lookup stable inode by file handle Amir Goldstein
2017-04-16 23:59 ` [RFC][PATCH 06/13] ovl: move inode helpers to inode.c Amir Goldstein
2017-04-16 23:59 ` [RFC][PATCH 07/13] ovl: create helpers for initializing hashed inode Amir Goldstein
2017-04-16 23:59 ` [RFC][PATCH 08/13] ovl: allow hashing non upper inodes Amir Goldstein
2017-04-16 23:59 ` [RFC][PATCH 09/13] ovl: inherit overlay inode ino/generation from real inode Amir Goldstein
2017-04-16 23:59 ` [RFC][PATCH 10/13] ovl: hash overlay inodes by stable inode Amir Goldstein
2017-04-16 23:59 ` [RFC][PATCH 11/13] ovl: fix du --one-file-system on overlay mount Amir Goldstein
2017-04-16 23:59 ` [RFC][PATCH 12/13] ovl: constant ino across copy up Amir Goldstein
2017-04-16 23:59 ` [RFC][PATCH 13/13] ovl: try to hardlink upper on copy up of lower hardlinks Amir Goldstein
2017-04-18 18:37 ` [RFC][PATCH 00/13] overlayfs stable inodes Amir Goldstein
2017-04-19  9:16   ` Miklos Szeredi
2017-04-19 10:37     ` Amir Goldstein
2017-04-19 13:52       ` Miklos Szeredi
2017-04-19 14:46         ` Amir Goldstein
2017-04-19 15:01           ` Miklos Szeredi
2017-04-19 15:17             ` Amir Goldstein
2017-04-19 22:58               ` Darrick J. Wong
2017-04-19 23:15                 ` Andreas Dilger
2017-04-20  5:43                   ` Amir Goldstein
2017-04-20  8:45                   ` Miklos Szeredi
2017-04-20  8:47                     ` Miklos Szeredi

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=CAOQ4uxgyqeAxMgewLhpOXQpdKMWRdiQxESZwpSacL1naAD75YA@mail.gmail.com \
    --to=amir73il@gmail.com \
    --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).