[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240726053430.GB99483@ZenIV>
Date: Fri, 26 Jul 2024 06:34:30 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: Song Liu <song@...nel.org>
Cc: bpf@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-team@...a.com,
andrii@...nel.org, eddyz87@...il.com, ast@...nel.org,
daniel@...earbox.net, martin.lau@...ux.dev, brauner@...nel.org,
jack@...e.cz, kpsingh@...nel.org, mattbobrowski@...gle.com
Subject: Re: [PATCH bpf-next 1/2] bpf: Add kfunc bpf_get_dentry_xattr() to
read xattr from dentry
On Thu, Jul 25, 2024 at 04:47:05PM -0700, Song Liu wrote:
> +__bpf_kfunc struct dentry *bpf_file_dentry(const struct file *file)
> +{
> + /* file_dentry() does not hold reference to the dentry. We add a
> + * dget() here so that we can add KF_ACQUIRE flag to
> + * bpf_file_dentry().
> + */
> + return dget(file_dentry(file));
> +}
> +
> +__bpf_kfunc struct dentry *bpf_dget_parent(struct dentry *dentry)
> +{
> + return dget_parent(dentry);
> +}
> +
> +__bpf_kfunc void bpf_dput(struct dentry *dentry)
> +{
> + return dput(dentry);
> +}
If you keep a file reference, why bother grabbing dentry one?
If not, you have a very bad trouble if that opened file is the only
thing that keeps the filesystem busy.
It's almost certainly a wrong interface; please, explain what
exactly are you trying to do here.
Powered by blists - more mailing lists