From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796386072; b=RKeA8kHI5IlRda8HkBStobRReFhMzRuAAGaIvNS5NAm6LilgTUJiB2lFjTfH7GRyvmyw ChNmUTeeAaqdbtwXHk6dlHM/OGvM2XuG4cOUNCHc6O5+T+VOOefKwAWQnaXqYng83peo3 T6YX85h1z0wDM8Vma0U075T4UFa4ZR7JHLbck4ui+9QfAj+k2iKoY68ssL+ln5o9an5z+ jh5X1xDeXYAGA/wZ3comAC9nupiiarMD1WAgQjdz70DLpzIAU5OKfsUnde6hkeSW6cmh0 uq7PFEQfIDddmkfOTmCvdjMzkCBZLvC1KJhxArr2rBsnP1oHcUrRBc13RNANgmDC5HA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386072; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=bNZmle/t79hRsaZRtYlEGlvdel6CV61op6mLOCoAvBE=; b=NhVW3slYXQmWL5tBU3/F3MElqmros8196sfrR4oIz+WcjJUw7luo3t1TDB1pDRlpqqmf oglTbc9E7JvsccIpWcdK18QytmD+9CCr/zbcDI+QlozQwfnxZgfHrSuLjY9+SlyCT+G32 2x9fvZWRg9jxY+dt2hFqgHlt3rDb7iw8W78dktGoiMfTUnJvCrG1C1Yphcb3miCl5a+pU lmG+0t9xigzZuwV7XXy0Bh54SjlUVI0VgZauCd61ccR8JrX8QnNnFIxDLfcWD6Saew9ct K8NDndX6Xh+F8xQ8i1yq7i528tgGolu8T1rOH/zrg5uhnTR+EMqzABuNVkyzpwRjPWA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=MAU6fsJR; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D19B0606A32D; Fri, 4 Dec 2026 12:07:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=MAU6fsJR Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E9CF1F000C2; Fri, 4 Dec 2026 12:07:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796386072; bh=bNZmle/t79hRsaZRtYlEGlvdel6CV61op6mLOCoAvBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MAU6fsJRuH21CKv2ABb5KBzZYy3gdQinQ1uEotyV4HR07I1iyQM1ZwtcnidtF+uj6 Y0cy3tZJ78xIj+NYxktbnD8Hlc/EnxINWd6LGUpXaXo83aGZ0rLzTkhBv7nGH6GAZa acdHyV+IUjp4OngMSv2n/0mxF/qGGRueg6s1I0cM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sashiko , Daejun Park , Amir Goldstein , Sasha Levin Subject: [PATCH 6.6 0816/1167] ovl: bump the impure dir version when linking a file with origin Date: Fri, 4 Dec 2026 19:04:03 +0900 Message-ID: <20261204100723.379432541@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Daejun Park [ 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 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 Signed-off-by: Amir Goldstein [ sashal: Threaded the existing origin argument through the two create helpers into ovl_instantiate(), since this tree has no ovl_create_handle_whiteouts() and ovl_dir_modified() is called inside ovl_instantiate(). ] Signed-off-by: Sasha Levin --- 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 3bf306330a8c2..0e1531dbeaec6 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); if (!hardlink) { @@ -325,7 +325,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); @@ -348,7 +348,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: @@ -446,7 +447,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); @@ -532,7 +533,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); @@ -610,9 +611,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