FAILED: patch "[PATCH] ovl: do not take a name snapshot in RCU walk" failed to apply to 6.18-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x 0b691c3c59a58aa6a2fc3f87c10cc1e399f1d33f
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026110403-limeade-limit-5dd3@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 0b691c3c59a58aa6a2fc3f87c10cc1e399f1d33f Mon Sep 17 00:00:00 2001
From: Chris Mason <[email protected]>
Date: Wed, 7 Oct 2026 10:38:39 +0000
Subject: [PATCH] ovl: do not take a name snapshot in RCU walk
A path lookup on an overlay over FUSE loops in the kernel for ever and stalls RCU.
take_dentry_name_snapshot() needs a dentry that the caller keeps alive, because for a dead dentry the refcount of an external name stays at zero and the function retries without end. In RCU walk ovl_revalidate_real() holds no reference on the real dentry, and the eviction of the overlay inode on another CPU can drop the last one.
With a delay in ovl_revalidate_real(), a stat() loop on a 48 byte name in an overlay over FUSE, raced with drop_caches, spun for ever in take_dentry_name_snapshot() and stalled RCU.
Fix this by using try_take_dentry_name_snapshot() in RCU walk, and by returning -ECHILD when it fails.
fs/overlayfs/super.c +7 -1
@@ -100,11 +100,17 @@ static int ovl_revalidate_real(struct dentry *d, unsigned int flags, bool weak) dir =d_inode_rcu (parent);if (!dir)return -ECHILD ; +/* +* Nothing pins d in RCU walk: eviction of the overlay +* inode may drop the last reference at any time. +*/ +if (!try_take_dentry_name_snapshot (&n, d)) +return -ECHILD ; }else { parent =dget_parent (d); dir =d_inode (parent); +take_dentry_name_snapshot (&n, d); } -take_dentry_name_snapshot (&n, d); ret = d->d_op->d_revalidate (dir, &n.name, d, flags);release_dentry_name_snapshot (&n);if (!(flags &LOOKUP_RCU ))