[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240822-notbremse-monitor-c8b88eb60fd2@brauner>
Date: Thu, 22 Aug 2024 11:31:41 +0200
From: Christian Brauner <brauner@...nel.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Mateusz Guzik <mjguzik@...il.com>, jack@...e.cz,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH 3/3] avoid extra path_get/path_put cycle in path_openat()
On Thu, Aug 22, 2024 at 01:41:49AM GMT, Al Viro wrote:
> Once we'd opened the file, nd->path and file->f_path have the
> same contents. Rather than having both pinned and nd->path
> dropped by terminate_walk(), let's have them share the
> references from the moment when FMODE_OPENED is set and
> clear nd->path just before the terminate_walk() in such case.
>
> To do that, we
> * add a variant of vfs_open() that does *not* do conditional
> path_get() (vfs_open_borrow()); use it in do_open().
> * don't grab f->f_path.mnt in finish_open() - only
> f->f_path.dentry. Have atomic_open() drop the child dentry
> in FMODE_OPENED case and return f->path.dentry without grabbing it.
> * adjust vfs_tmpfile() for finish_open() change (it
> is called from ->tmpfile() instances).
> * make do_o_path() use vfs_open_borrow(), collapse path_put()
> there with the conditional path_get() we would've get in vfs_open().
> * in FMODE_OPENED case clear nd->path before calling
> terminate_walk().
>
> Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
> ---
Reviewed-by: Christian Brauner <brauner@...nel.org>
Powered by blists - more mailing lists