ovl: Do not check for redirect if this is last layer
authorVivek Goyal <vgoyal@redhat.com>
Fri, 9 Mar 2018 20:44:42 +0000 (15:44 -0500)
committerMiklos Szeredi <mszeredi@redhat.com>
Thu, 12 Apr 2018 10:04:49 +0000 (12:04 +0200)
If we are looking in last layer, then there should not be any need to
process redirect. redirect information is used only for lookup in next
lower layer and there is no more lower layer to look into. So no need
to process redirects.

IOW, ignore redirects on lowest layer.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/overlayfs/namei.c

index 810a333d2221a0d441d08c9a158374e17844a4b3..5287c4bcf14b11d715a014391efb80970703eec6 100644 (file)
@@ -258,7 +258,10 @@ static int ovl_lookup_single(struct dentry *base, struct ovl_lookup_data *d,
                goto out;
        }
        d->is_dir = true;
-       if (!d->last && ovl_is_opaquedir(this)) {
+       if (d->last)
+               goto out;
+
+       if (ovl_is_opaquedir(this)) {
                d->stop = d->opaque = true;
                goto out;
        }