From 0f3d73a1e2053c3a1496dd7ace7771e02c52a09d Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Tue, 30 Nov 2021 16:33:00 +0800 Subject: [PATCH] ovl: warn about orphan metacopy mainline inclusion from mainline-v5.11-rc1 commit 0a8d0b64dd6acfbc9e9b79022654bbe1ade4a29a category: bugfix bugzilla: 185806 https://gitee.com/openeuler/kernel/issues/I4DDEL Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0a8d0b64dd6acfbc9e9b79022654bbe1ade4a29a ------------------------------------------------- When the lower file of a metacopy is inaccessible, -EIO is returned. For users not familiar with overlayfs internals, such as myself, the meaning of this error may not be apparent or easy to determine, since the (metacopy) file is present and open/stat succeed when accessed outside of the overlay. Add a rate-limited warning for orphan metacopy to give users a hint when investigating such errors. Link: https://lore.kernel.org/linux-unionfs/CAOQ4uxi23Zsmfb4rCed1n=On0NNA5KZD74jjjeyz+et32sk-gg@mail.gmail.com/ Signed-off-by: Kevin Locke Signed-off-by: Miklos Szeredi Signed-off-by: Zheng Liang Reviewed-by: Zhang Yi Signed-off-by: Chen Jun Signed-off-by: Zheng Zengkai --- fs/overlayfs/namei.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c index 092812c2f118..b1c8a38573c9 100644 --- a/fs/overlayfs/namei.c +++ b/fs/overlayfs/namei.c @@ -1004,6 +1004,8 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, * Just make sure a corresponding data dentry has been found. */ if (d.metacopy || (uppermetacopy && !ctr)) { + pr_warn_ratelimited("metacopy with no lower data found - abort lookup (%pd2)\n", + dentry); err = -EIO; goto out_put; } else if (!d.is_dir && upperdentry && !ctr && origin_path) { -- GitLab