[PATCH RFC v3 26/26] fs: stop rewriting paths for PF_EXITING | PF_DUMPCORE

Christian Brauner posted 26 patches 3 weeks, 5 days ago
[PATCH RFC v3 26/26] fs: stop rewriting paths for PF_EXITING | PF_DUMPCORE
Posted by Christian Brauner 3 weeks, 5 days ago
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@kernel.org>
---
 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