From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Daejun Park <daejun7.park@samsung.com>,
Sashiko <sashiko-bot@kernel.org>,
Amir Goldstein <amir73il@gmail.com>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.15.y] ovl: bump the impure dir version when linking a file with origin
Date: Wed, 25 Nov 2026 23:07:43 -0500 [thread overview]
Message-ID: <20261126040732.1923854-1-sashal@kernel.org> (raw)
In-Reply-To: <2026112549-garter-shredder-8b5c@gregkh>
From: Daejun Park <daejun7.park@samsung.com>
[ Upstream commit 86e2facd8630cc2fdec6ea80c53e370b26b441d9 ]
Linking a file with copy up origin into a non-merge impure dir does
not bump the dir version. readdir then reuses the impure dir cache
built before the link. It reports the upper inode number as d_ino of
the new link, not st_ino.
Pass whether the linked file has an origin to ovl_dir_modified(), as
rename and unlink do.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-98f207b6-3936-48e9-a40f-88f20be4db7b
Fixes: 4edb83bb1041 ("ovl: constant d_ino for non-merge dirs")
Cc: stable@vger.kernel.org
Signed-off-by: Daejun Park <daejun7.park@samsung.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
[ sashal: adapted ovl_instantiate()/ovl_create_upper()/ovl_create_over_whiteout() to the older signatures, passing origin directly to ovl_instantiate() and dropping the ovl_create_handle_whiteouts() changes. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/overlayfs/dir.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index 0b89cbc4b018a..75a262f309b97 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -260,14 +260,14 @@ static int ovl_set_opaque(struct dentry *dentry, struct dentry *upperdentry)
* may not use to instantiate the new dentry.
*/
static int ovl_instantiate(struct dentry *dentry, struct inode *inode,
- struct dentry *newdentry, bool hardlink)
+ struct dentry *newdentry, bool hardlink, bool origin)
{
struct ovl_inode_params oip = {
.upperdentry = newdentry,
.newinode = inode,
};
- ovl_dir_modified(dentry->d_parent, false);
+ ovl_dir_modified(dentry->d_parent, origin);
ovl_dentry_set_upper_alias(dentry);
ovl_dentry_init_reval(dentry, newdentry);
@@ -319,7 +319,7 @@ static bool ovl_type_origin(struct dentry *dentry)
}
static int ovl_create_upper(struct dentry *dentry, struct inode *inode,
- struct ovl_cattr *attr)
+ struct ovl_cattr *attr, bool origin)
{
struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent);
@@ -346,7 +346,8 @@ static int ovl_create_upper(struct dentry *dentry, struct inode *inode,
ovl_set_opaque(dentry, newdentry);
}
- err = ovl_instantiate(dentry, inode, newdentry, !!attr->hardlink);
+ err = ovl_instantiate(dentry, inode, newdentry, !!attr->hardlink,
+ origin);
if (err)
goto out_cleanup;
out_unlock:
@@ -460,7 +461,7 @@ static int ovl_set_upper_acl(struct ovl_fs *ofs, struct dentry *upperdentry,
}
static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode,
- struct ovl_cattr *cattr)
+ struct ovl_cattr *cattr, bool origin)
{
struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
struct dentry *workdir = ovl_workdir(dentry);
@@ -546,7 +547,7 @@ static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode,
if (err)
goto out_cleanup;
}
- err = ovl_instantiate(dentry, inode, newdentry, hardlink);
+ err = ovl_instantiate(dentry, inode, newdentry, hardlink, origin);
if (err) {
ovl_cleanup(ofs, udir, newdentry);
dput(newdentry);
@@ -624,9 +625,9 @@ static int ovl_create_or_link(struct dentry *dentry, struct inode *inode,
}
if (!ovl_dentry_is_whiteout(dentry))
- err = ovl_create_upper(dentry, inode, attr);
+ err = ovl_create_upper(dentry, inode, attr, origin);
else
- err = ovl_create_over_whiteout(dentry, inode, attr);
+ err = ovl_create_over_whiteout(dentry, inode, attr, origin);
out_revert_creds:
revert_creds(old_cred);
--
2.53.0
prev parent reply other threads:[~2026-11-26 4:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 10:44 FAILED: patch "[PATCH] ovl: bump the impure dir version when linking a file with" failed to apply to 5.15-stable tree gregkh
2026-11-26 4:07 ` Sasha Levin [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=20261126040732.1923854-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=amir73il@gmail.com \
--cc=daejun7.park@samsung.com \
--cc=sashiko-bot@kernel.org \
--cc=stable@vger.kernel.org \
/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