[PATCH RFC v3 25/26] fs: stop rewriting kthread fs structs

Christian Brauner
2026-03-11T21:57:13Z

Now that we isolated kthreads filesystem state completely from userspace
stop rewriting their state.

Signed-off-by: Christian Brauner <brauner@kernel.org>
---
fs/fs_struct.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/fs/fs_struct.c b/fs/fs_struct.c
index f44e43ce6d93..2a98cfbedd32 100644
--- a/fs/fs_struct.c
+++ b/fs/fs_struct.c
@@ -61,6 +61,10 @@ 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)
+ continue;
+
task_lock(p);
fs = p->real_fs;
if (fs) {

--
2.47.3