On Thu, Sep 28, 2023 at 12:25:16PM +0200, Mateusz Guzik wrote: > Below is my rebased patch + rewritten commit message with updated bench > results. I decided to stick to fput_badopen name because with your patch > it legitimately has to unref. Naming that "release_empty_file" or > whatever would be rather misleading imho. Do we still need fput_badopen()? Couldn't we just make this part of regular fput() at this point? ie: +++ b/fs/file_table.c @@ -435,6 +435,10 @@ void fput(struct file *file) if (atomic_long_dec_and_test(&file->f_count)) { struct task_struct *task = current; + if (!(file->f_mode & FMODE_OPENED)) { + file_free(file); + return; + } if (likely(!in_interrupt() && !(task->flags & PF_KTHREAD))) { init_task_work(&file->f_rcuhead, ____fput); if (!task_work_add(task, &file->f_rcuhead, TWA_RESUME))