[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZRbKMmRm8i+/E88f@casper.infradead.org>
Date: Fri, 29 Sep 2023 13:59:30 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Mateusz Guzik <mjguzik@...il.com>
Cc: brauner@...nel.org, viro@...iv.linux.org.uk,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
torvalds@...ux-foundation.org
Subject: Re: [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))
Powered by blists - more mailing lists