[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=whLadznjNKZPYUjxVzAyCH-rRhb24_KaGegKT9E6A86Kg@mail.gmail.com>
Date: Wed, 27 Sep 2023 10:48:20 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Christian Brauner <brauner@...nel.org>
Cc: Mateusz Guzik <mjguzik@...il.com>, viro@...iv.linux.org.uk,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v2] vfs: shave work on failed file open
On Wed, 27 Sept 2023 at 07:10, Christian Brauner <brauner@...nel.org> wrote:
>
> No need to resend I can massage this well enough in-tree.
Hmm. Please do, but here's some more food for thought for at least the
commit message.
Because there's more than the "__fput_sync()" issue at hand, we have
another delayed thing that this patch ends up short-circuiting, which
wasn't obvious from the original description.
I'm talking about the fact that our existing "file_free()" ends up
doing the actual release with
call_rcu(&f->f_rcuhead, file_free_rcu);
and the patch under discussion avoids that part too.
And I actually like that it avoids it, I just think it should be
mentioned explicitly, because it wasn't obvious to me until I actually
looked at the old __fput() path. Particularly since it means that the
f_creds are free'd synchronously now.
I do think that's fine, although I forget what path it was that
required that rcu-delayed cred freeing. Worth mentioning, and maybe
worth thinking about.
However, when I *did* look at it, it strikes me that we could do this
differently.
Something like this (ENTIRELY UNTESTED) patch, which just moves this
logic into fput() itself.
Again: ENTIRELY UNTESTED, and I might easily have screwed up. But it
looks simpler and more straightforward to me. But again: that may be
because I missed something.
Linus
View attachment "patch.diff" of type "text/x-patch" (1223 bytes)
Powered by blists - more mailing lists