[PATCH RFC v3 26/26] fs: stop rewriting paths for PF_EXITING | PF_DUMPCORE
From: Christian Brauner
Date: Wed Mar 11 2026 - 18:03:58 EST
If the task is dead or dumping core stop messing with its fs struct.
There's no point in doing that. Worst case it'll be stuck in a stale
path until it calls exit_fs().
Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
---
fs/fs_struct.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/fs_struct.c b/fs/fs_struct.c
index 2a98cfbedd32..34699f3b6f88 100644
--- a/fs/fs_struct.c
+++ b/fs/fs_struct.c
@@ -61,8 +61,7 @@ void chroot_fs_refs(const struct path *old_root, const struct path *new_root)
read_lock(&tasklist_lock);
for_each_process_thread(g, p) {
- /* leave kthreads alone */
- if (p->flags & PF_KTHREAD)
+ if (p->flags & (PF_KTHREAD | PF_EXITING | PF_DUMPCORE))
continue;
task_lock(p);
--
2.47.3