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=1796381591; b=atoKPFA85PwMptBty33z+NDqeuP65kgBqHmdcu9fFSsoQmdrpUrlWdoILWRKMbjcgWln GAZXUfDziyvfvA3+wu2/IXQe88ETcOZ+/BitYP8XwhLquaA9GK34CMcFhCEOQHhXpPCGI woxCEJmNJHzVnEZZARqDM7TGjTr23UfsYjSUrKeYuxCU/CtbD/aZdWNDMxx4wrEMLhn+o +KJfM3a4tkAcu8jFryCOkX480Wk0uSy2dnOenp5GE5fZlvGiFB2ldbXBUH/yyNfezM4CQ 4wOu/3Nbxled7C36DVRMZBNQc53ZNSrQtTR1arXersTI8i6J9tiKwnXFzHN1x+fokyA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381591; 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=syfmdx6sqROO/1teaQKzSj3/JfFWE2EMDMJ3k2WvzY8=; b=qiL7lq5A/+sVYGe/RnJF274vg5kdABRCngYiRsG0ZCOzv2nXvkgkEl9CSIdWahc6I3E6 9bdgfhxcLIs3146ZLENSS6B1R+KpUwQt96s4ZMUK2kAJAKc5YLlJC9TLI0A1fBmtYgh6G jdh13uhpipqcvyZxJ75bQuwcad9XdfGIVWS8l71qZqtBLYQaRMjqLf5IuRwzlXaGgNH0Y SX+ntOHcI2mdC9Cy76jAV1aZVT8AfY1XQNnKAv7mLLtjlKdt+/AqT9QnN7yc1bxPzxY7j 2obnWcoZTxbbBv+m9GK/YooE86GvppNcRjdErFT/XWV3isP/pywKnw+1skwJil45HRA== 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=mI77XuZJ; 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 2776E606A322; Fri, 4 Dec 2026 10:53:11 +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=mI77XuZJ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9248D1F000C2; Fri, 4 Dec 2026 10:53:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381591; bh=syfmdx6sqROO/1teaQKzSj3/JfFWE2EMDMJ3k2WvzY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mI77XuZJfQKFvVP6z8Q/a6gsdPtzj9SS5Itn4CKSYZvGDOmIuC+3+sLshxqoGQ+0H 70iUREvMVPTRxvXPknhgDkVZPpP/QjF9aYz3ceIQxEyWXp+T1zL4TknWQ+82gOUoKO 2WYD8FlRlG1ffh9mpnTFBgFaqR0Woebeg5+2Lp5s= 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.18 090/703] ovl: bump the impure dir version when linking a file with origin Date: Fri, 4 Dec 2026 18:59:49 +0900 Message-ID: <20261204100630.133839247@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@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.18-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: Added a bool origin parameter to ovl_create_upper() and ovl_create_over_whiteout() and passed it from the direct calls in ovl_create_or_link(), since the upstream ovl_create_handle_whiteouts() wrapper doesn't exist here. ] Signed-off-by: Sasha Levin --- fs/overlayfs/dir.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index 8377f112feca3..b9f0eb5e7dd78 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c @@ -355,7 +355,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); @@ -378,7 +378,7 @@ static int ovl_create_upper(struct dentry *dentry, struct inode *inode, ovl_set_opaque(dentry, newdentry); } - ovl_dir_modified(dentry->d_parent, false); + ovl_dir_modified(dentry->d_parent, origin); err = ovl_instantiate(dentry, inode, newdentry, !!attr->hardlink, NULL); if (err) goto out_cleanup; @@ -471,7 +471,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); @@ -557,7 +557,7 @@ static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode, if (err) goto out_cleanup_unlocked; } - ovl_dir_modified(dentry->d_parent, false); + ovl_dir_modified(dentry->d_parent, origin); err = ovl_instantiate(dentry, inode, newdentry, hardlink, NULL); if (err) { ovl_cleanup(ofs, upperdir, newdentry); @@ -656,9 +656,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: ovl_revert_creds(old_cred); -- 2.53.0