[kernel]:overlayfs: invalid origin (root/bmcweb_persistent_data.json, ftype=8000, origin ftype=4000)

Amir Goldstein amir73il at gmail.com
Tue Apr 27 05:22:55 EDT 2021


On Tue, Apr 27, 2021 at 11:40 AM www <ouyangxuan10 at 163.com> wrote:
>
> Hi Amir,
>
> To solve this problem, we are trying to upgrade the kernel version or upgrade the file system separately, but because the kernel version we are using is quite different from the one that solves the problem. So I would like to ask you a few questions:
>
> 1. What is the root cause of this problem?

As I wrote:
I suppose lower squashfs was recreated and mounted with an existing
upper dir that already contains upper files with origin references to the
old squashfs lower fs.

>
> 2. Can we just upgrade overlay fs to solve this problem without upgrading the kernel or all file systems?
>

No.

> 3. If we upgrade overlayfs separately, we are not very good at verifying that we have solved this problem, because the recurrence probability of this problem is very low. So I want to ask, how can we quickly reproduce this problem?

Re-creating a lower squashfs after files have been copied to upper should
reproduce the problem quite often.

>
> 4. Do you have any good suggestions?
>

Is the creation of the lower image under your control?
Did you try the workaround I suggested to create lower squashfs
with the "-no-exports" mksquashfs option?

Try this patch:

diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index 71e264e2f16b..850c0a37f1f0 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -392,7 +392,7 @@ int ovl_check_origin_fh(struct ovl_fs *ofs, struct
ovl_fh *fh, bool connected,
                            upperdentry, d_inode(upperdentry)->i_mode & S_IFMT,
                            d_inode(origin)->i_mode & S_IFMT);
        dput(origin);
-       return -EIO;
+       return -EINVAL;
 }

 static int ovl_check_origin(struct ovl_fs *ofs, struct dentry *upperdentry,
@@ -408,7 +408,7 @@ static int ovl_check_origin(struct ovl_fs *ofs,
struct dentry *upperdentry,
        kfree(fh);

        if (err) {
-               if (err == -ESTALE)
+               if (err == -ESTALE || err == -EINVAL)
                        return 0;
                return err;
        }

It should apply to any kernel and if not it's quite easy to manually apply it.
This fix will not get rid of the warning printed to kmsg, but it will hide the
error from userspace.

If it fixes your problem I think we should apply it to upstream and stable
kernels as well.

Thanks,
Amir.



More information about the Kernelnewbies mailing list