From: Vivek Goyal <vgoyal@redhat.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>, linux-unionfs@vger.kernel.org
Subject: Re: [PATCH] ovl: fix lookup with middle layer opaque dir and absolute path redirects
Date: Thu, 8 Mar 2018 17:17:17 -0500 [thread overview]
Message-ID: <20180308221717.GC2732@redhat.com> (raw)
In-Reply-To: <1520544700-17628-1-git-send-email-amir73il@gmail.com>
On Thu, Mar 08, 2018 at 11:31:40PM +0200, Amir Goldstein wrote:
> The only way to explain the problem is with an example.
> Watch me make foo disappear:
Hi Amir,
I will look at it tomorrow more closely. I am also about to send 3 RFC
fixes for the issues we discussed. Please have a look and see what do you
think.
Vivek
>
> $ mkdir lower middle upper work work2 merged
> $ mkdir lower/origin
> $ touch lower/origin/foo
> $ mount -t overlay none merged/ \
> -olowerdir=lower,upperdir=middle,workdir=work2
> $ mkdir merged/pure
> $ mv merged/origin merged/pure/redirect
> $ umount merged
> $ mount -t overlay none merged/ \
> -olowerdir=middle:lower,upperdir=upper,workdir=work
> $ mv merged/pure/redirect merged/redirect
>
> Now you see foo inside a twice redirected merged dir:
>
> $ ls merged/redirect
> foo
> $ umount merged
> $ mount -t overlay none merged/ \
> -olowerdir=middle:lower,upperdir=upper,workdir=work
>
> After mount cycle you don't see foo inside the same dir:
>
> $ ls merged/redirect
>
> During middle layer lookup, the opaqueness of middle/pure is left in
> the lookup state and then middle/pure/redirect is wrongly treated as
> opaque.
>
> Fixes: 02b69b284cd7 ("ovl: lookup redirects")
> Cc: <stable@vger.kernel.org> #v4.10
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
>
> Vivek,
>
> This is the bug I was talking about in review of metacopy lookup.
>
> Miklos,
>
> This change seems a bit subtle... besides the reproducer I sanity tested
> redirects with unionmount-testsuite ./run --ov=10 and the overlay/quick
> xfstests. Neither would have hit this sort of corner case though.
> I will add a test to cover this case later on.
>
> Thanks,
> Amir.
>
> fs/overlayfs/namei.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
> index 70fcfcc684cc..31ca563b7666 100644
> --- a/fs/overlayfs/namei.c
> +++ b/fs/overlayfs/namei.c
> @@ -51,6 +51,14 @@ static int ovl_check_redirect(struct dentry *dentry, struct ovl_lookup_data *d,
> if (res == 0)
> goto invalid;
> if (buf[0] == '/') {
> + /*
> + * One of the ancestor path elements in an absolute path
> + * lookup in ovl_lookup_layer() could have been opaque, but it
> + * possible for a decendant path element to reset opaqueness in
> + * case this path element has an absolute redirect to a lower
> + * layer.
> + */
> + d->stop = d->opaque = false;
> for (s = buf; *s++ == '/'; s = next) {
> next = strchrnul(s, '/');
> if (s == next)
> --
> 2.7.4
>
prev parent reply other threads:[~2018-03-08 22:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-08 21:31 [PATCH] ovl: fix lookup with middle layer opaque dir and absolute path redirects Amir Goldstein
2018-03-08 22:17 ` Vivek Goyal [this message]
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=20180308221717.GC2732@redhat.com \
--to=vgoyal@redhat.com \
--cc=amir73il@gmail.com \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.