[PATCH RFC v2 23/23] fs: stop rewriting kthread fs structs

From: Christian Brauner

Date: Thu Mar 05 2026 - 18:34:15 EST


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

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

diff --git a/fs/fs_struct.c b/fs/fs_struct.c
index c1afa7513e34..74fcee814be3 100644
--- a/fs/fs_struct.c
+++ b/fs/fs_struct.c
@@ -61,6 +61,9 @@ void chroot_fs_refs(const struct path *old_root, const struct path *new_root)

read_lock(&tasklist_lock);
for_each_process_thread(g, p) {
+ if (p->flags & PF_KTHREAD)
+ continue;
+
task_lock(p);
fs = p->fs;
if (fs) {

--
2.47.3