linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Miklos Szeredi <mszeredi@redhat.com>,
	"linux-unionfs@vger.kernel.org" <linux-unionfs@vger.kernel.org>,
	Guillem Jover <guillem@debian.org>,
	Raphael Hertzog <hertzog@debian.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/3] ovl: redirect on rename-dir
Date: Wed, 26 Oct 2016 22:56:07 +0300	[thread overview]
Message-ID: <CAOQ4uxidCNkXNVBZFM9q9261DGZ_mmBNjWkDTsZii7Z12dyRKg@mail.gmail.com> (raw)
In-Reply-To: <CAJfpegs+NDycOda67y5-8zDYHk90gxdQuQsRQ2pLq58UcUqa9A@mail.gmail.com>

On Wed, Oct 26, 2016 at 2:26 PM, Miklos Szeredi <miklos@szeredi.hu> wrote:
> On Tue, Oct 25, 2016 at 2:49 PM, Amir Goldstein <amir73il@gmail.com> wrote:
>
>>> @@ -880,31 +913,34 @@ static int ovl_rename(struct inode *olddir, struct dentry *old,
>>>         if (WARN_ON(olddentry->d_inode == newdentry->d_inode))
>>>                 goto out_dput;
>>>
>>> -       if (is_dir && !old_opaque && ovl_lower_positive(new)) {
>>> -               err = ovl_set_opaque(olddentry);
>>> -               if (err)
>>> -                       goto out_dput;
>>> -               ovl_dentry_set_opaque(old, true);
>>> +       if (is_dir) {
>>> +               if (ovl_type_merge_or_lower(old)) {
>>> +                       err = ovl_set_redirect(old);
>>
>> There is a fair chance of getting ENOSPC/EDQUOT here and confuse user space.
>> Would it be better to convert these non fatal errors with EXDEV, so
>> user space will
>> gracefully fallback to recursive rename/clone/copy?
>
> Recursive copy up will surely consume more space than an xattr?
>
>>> @@ -162,6 +223,23 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
>>>                 stack[ctr].dentry = this;
>>>                 stack[ctr].mnt = lowerpath.mnt;
>>>                 ctr++;
>>> +
>>> +               if (!stop && i != poe->numlower - 1 &&
>>> +                   d_is_dir(this) && ovl_redirect_dir(dentry->d_sb)) {
>>> +                       err = ovl_check_redirect(this, &redirect);
>>> +                       if (err)
>>> +                               goto out_put;
>>> +
>>> +                       if (redirect && poe != dentry->d_sb->s_root->d_fsdata) {
>>> +                               poe = dentry->d_sb->s_root->d_fsdata;
>>> +
>>
>> Now you are about to continue looping until new value of poe->numlower,
>> which is >= then olf value of poe->numlower, but 'stack' was allocated
>> according to old value of poe->numlower, so aren't you in danger of
>> overflowing it?
>>
>> Please add a comment to explain the purpose of this loop rewind.
>
> We are jumping to a stack possibly wider than the current one and need
> to find the layer where to continue the downward traversal.  I'll add
> the comment.
>

OK. my point was that you need to allocate an sb max depth stack in advance,
in case you need to jump to a wider stack.

> BTW I don't remember having tested this, so it might possibly be
> buggy.  Automatic multi-layer testing would really be good.  What we
> basically need is:
>
>  - create normal (two layer) overlay (with interesting constructs,
> whiteout, opaque dir, redirect)
>  - umount
>  - create three layer overlay where the two lower layers come from the
> previous upper/lower layers
>  - do more interesting things
>
> There's one such test in xfstests but it would be good to have more.
>

I just sent 2 patches to fix 2 overlayfs xfstests failures.
With these 2 changes, the entire quick test group passes on my setup
(short of one test that also fails on ext4 and xfs).

Now I will start to think about instrumenting generic xfstests with lower/upper
files and then with rotating upper (i.e. layer stack).

Amir.

  parent reply	other threads:[~2016-10-26 19:56 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-25  7:34 [PATCH 0/3] overlayfs: allow moving directory trees Miklos Szeredi
2016-10-25  7:34 ` [PATCH 1/3] ovl: check fs features Miklos Szeredi
2016-10-25 11:24   ` Amir Goldstein
2016-11-05 20:40     ` Amir Goldstein
2016-10-25  7:34 ` [PATCH 2/3] vfs: export vfs_path_lookup() Miklos Szeredi
2016-10-25  7:34 ` [PATCH 3/3] ovl: redirect on rename-dir Miklos Szeredi
2016-10-25 11:57   ` Raphael Hertzog
2016-10-26 11:12     ` Miklos Szeredi
2016-10-28 12:56       ` Raphael Hertzog
2016-10-28 12:59         ` Miklos Szeredi
2016-11-06 19:14       ` Konstantin Khlebnikov
2016-11-07  8:07         ` Miklos Szeredi
2016-11-07  9:58           ` Konstantin Khlebnikov
2016-11-07 10:04             ` Miklos Szeredi
2016-11-07 10:08               ` Konstantin Khlebnikov
2016-11-07 13:38                 ` Amir Goldstein
2016-11-10 22:56                   ` Amir Goldstein
2016-11-11  9:46                     ` Konstantin Khlebnikov
2016-11-11 10:06                       ` Miklos Szeredi
2016-11-11 12:42                         ` Amir Goldstein
2016-11-13  9:11                           ` Amir Goldstein
2016-11-07 11:03         ` Raphael Hertzog
2016-11-07 11:31           ` Konstantin Khlebnikov
2016-11-07 13:42             ` Raphael Hertzog
2016-11-10 22:39               ` Miklos Szeredi
2016-11-11  9:41                 ` Konstantin Khlebnikov
2016-11-13 10:00                 ` Amir Goldstein
2016-11-14 16:25                   ` Amir Goldstein
2016-11-16 22:00                     ` Miklos Szeredi
2016-11-18 15:37                       ` Amir Goldstein
2016-11-20 11:39                         ` Amir Goldstein
2016-11-21  9:54                         ` Miklos Szeredi
2016-11-21 10:13                           ` Amir Goldstein
2016-11-21 10:16                             ` Miklos Szeredi
2016-11-22 13:42                               ` Amir Goldstein
2016-10-25 12:49   ` Amir Goldstein
2016-10-26 11:26     ` Miklos Szeredi
2016-10-26 12:11       ` Amir Goldstein
2016-10-26 12:51         ` Miklos Szeredi
2016-10-26 19:56       ` Amir Goldstein [this message]
2016-10-28 16:15   ` Al Viro
2016-11-03 15:50     ` Miklos Szeredi
2016-11-04  9:29       ` Amir Goldstein
2016-11-04 13:48         ` 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=CAOQ4uxidCNkXNVBZFM9q9261DGZ_mmBNjWkDTsZii7Z12dyRKg@mail.gmail.com \
    --to=amir73il@gmail.com \
    --cc=guillem@debian.org \
    --cc=hertzog@debian.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=mszeredi@redhat.com \
    /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).