lkml.org 
[lkml]   [2023]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH v3] vfs: avoid delegating to task_work when cleaning up failed open
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))
\
 
 \ /
  Last update: 2023-09-29 15:00    [W:0.072 / U:3.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site