Re: [PATCH v2] rust: file: handle fd table teardown in file descriptor APIs
From: Al Viro
Date: Tue Sep 29 2026 - 10:59:15 EST
On Tue, Sep 29, 2026 at 03:35:13PM +0200, Alice Ryhl wrote:
> Sorry I mixed it up ... the code called file_close_fd() and then
> filp_close() with current->files. The important call here is the
> file_close_fd() one, not the filp_close() one.
Er... But that would *not* see NULL ->files in case of workqueue -
you'd get init_files instead. vhost_task_create() is the only
thing that creates threads with NULL ->files; it might or might
not make sense to have the same for workqueue worker threads,
but that wouldn't change anything in that bug anyway.
When you want to change the state of a thread component, be it
descriptor table, cwd, umask, etc., you'd better do that in
a thread that *does* share that component with the thread you
want to have affected.
It's not a matter of race with exiting thread - closing a descriptor
via schedule_work() is _always_ wrong.
I really don't get it...