[PATCH] dcache: report a Tasks-RCU quiescent state in dentry_kill()

Breno Leitao posted 1 patch 6 days, 13 hours ago
fs/dcache.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] dcache: report a Tasks-RCU quiescent state in dentry_kill()
Posted by Breno Leitao 6 days, 13 hours ago
I am constantly seeing the following warning on Meta's fleet:

  INFO: rcu_tasks detected stalls on tasks:
    native_queued_spin_lock_slowpath
    locked_inode_to_wb_and_lock_list
    inode_io_list_del
    evict
    __dentry_kill
    shrink_dentry_list
    shrink_dcache_tree
    d_invalidate
    btrfs_delete_subvolume
    btrfs_ioctl_snap_destroy
    btrfs_ioctl
    do_syscall_64

dentry_kill() is the common funnel for dentry teardown: dput(),
shrink_dentry_list() and shrink_dcache_tree() all reach it, once per
dentry, and its cond_resched() is the only reschedule point on that path.

cond_resched() is not an RCU-tasks quiescent state.

Use cond_resched_tasks_rcu_qs() so the teardown reports an RCU-tasks
quiescent state as it proceeds.

Fixes: 9c5f1d30199d ("dcache: move cond_resched() into the end of __dentry_kill()")
Cc: stable@vger.kernel.org
Signed-off-by: Breno Leitao <leitao@debian.org>
---
 fs/dcache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index 1b1a81f10da67..b89c8480b655b 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -830,7 +830,7 @@ static struct dentry *dentry_kill(struct dentry *dentry)
 	if (dentry->d_op && dentry->d_op->d_release)
 		dentry->d_op->d_release(dentry);
 
-	cond_resched();
+	cond_resched_tasks_rcu_qs();
 	/* now that it's negative, ->d_parent is stable */
 	if (!IS_ROOT(dentry)) {
 		parent = dentry->d_parent;

---
base-commit: 5dd1818b15d98d4a20806cd00b1b40320b06004f
change-id: 20260918-dcache-task-rcu-qa-b4bcb13f1524

Best regards,
--  
Breno Leitao <leitao@debian.org>
Re: [PATCH] dcache: report a Tasks-RCU quiescent state in dentry_kill()
Posted by Paul E. McKenney 3 days, 7 hours ago
On Fri, Sep 18, 2026 at 04:01:57AM -0700, Breno Leitao wrote:
> I am constantly seeing the following warning on Meta's fleet:
> 
>   INFO: rcu_tasks detected stalls on tasks:
>     native_queued_spin_lock_slowpath
>     locked_inode_to_wb_and_lock_list
>     inode_io_list_del
>     evict
>     __dentry_kill
>     shrink_dentry_list
>     shrink_dcache_tree
>     d_invalidate
>     btrfs_delete_subvolume
>     btrfs_ioctl_snap_destroy
>     btrfs_ioctl
>     do_syscall_64
> 
> dentry_kill() is the common funnel for dentry teardown: dput(),
> shrink_dentry_list() and shrink_dcache_tree() all reach it, once per
> dentry, and its cond_resched() is the only reschedule point on that path.
> 
> cond_resched() is not an RCU-tasks quiescent state.
> 
> Use cond_resched_tasks_rcu_qs() so the teardown reports an RCU-tasks
> quiescent state as it proceeds.
> 
> Fixes: 9c5f1d30199d ("dcache: move cond_resched() into the end of __dentry_kill()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Breno Leitao <leitao@debian.org>

Reviewed-by: Paul E. McKenney <paulmck@kernel.org>

> ---
>  fs/dcache.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/dcache.c b/fs/dcache.c
> index 1b1a81f10da67..b89c8480b655b 100644
> --- a/fs/dcache.c
> +++ b/fs/dcache.c
> @@ -830,7 +830,7 @@ static struct dentry *dentry_kill(struct dentry *dentry)
>  	if (dentry->d_op && dentry->d_op->d_release)
>  		dentry->d_op->d_release(dentry);
>  
> -	cond_resched();
> +	cond_resched_tasks_rcu_qs();
>  	/* now that it's negative, ->d_parent is stable */
>  	if (!IS_ROOT(dentry)) {
>  		parent = dentry->d_parent;
> 
> ---
> base-commit: 5dd1818b15d98d4a20806cd00b1b40320b06004f
> change-id: 20260918-dcache-task-rcu-qa-b4bcb13f1524
> 
> Best regards,
> --  
> Breno Leitao <leitao@debian.org>
>