[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQ+_T2UTVQA9XXew26XR8zqhNpwX33Uy_pVW0_7s-bexLg@mail.gmail.com>
Date: Mon, 2 Jun 2025 08:40:03 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Song Liu <song@...nel.org>
Cc: Christian Brauner <brauner@...nel.org>, Al Viro <viro@...iv.linux.org.uk>, Jan Kara <jack@...e.cz>,
bpf <bpf@...r.kernel.org>, Linux-Fsdevel <linux-fsdevel@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
LSM List <linux-security-module@...r.kernel.org>, Kernel Team <kernel-team@...a.com>,
Andrii Nakryiko <andrii@...nel.org>, Eduard <eddyz87@...il.com>,
Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <martin.lau@...ux.dev>, KP Singh <kpsingh@...nel.org>,
Matt Bobrowski <mattbobrowski@...gle.com>, Amir Goldstein <amir73il@...il.com>, repnop@...gle.com,
Jeff Layton <jlayton@...nel.org>, Josef Bacik <josef@...icpanda.com>,
Mickaël Salaün <mic@...ikod.net>,
Günther Noack <gnoack@...gle.com>
Subject: Re: [PATCH bpf-next 3/4] bpf: Introduce path iterator
On Mon, Jun 2, 2025 at 6:27 AM Song Liu <song@...nel.org> wrote:
>
> On Mon, Jun 2, 2025 at 2:27 AM Christian Brauner <brauner@...nel.org> wrote:
> >
> > On Thu, May 29, 2025 at 11:00:51AM -0700, Song Liu wrote:
> > > On Thu, May 29, 2025 at 10:38 AM Al Viro <viro@...iv.linux.org.uk> wrote:
> > > >
> > > > On Thu, May 29, 2025 at 09:53:21AM -0700, Song Liu wrote:
> > > >
> > > > > Current version of path iterator only supports walking towards the root,
> > > > > with helper path_parent. But the path iterator API can be extended
> > > > > to cover other use cases.
> > > >
> > > > Clarify the last part, please - call me paranoid, but that sounds like
> > > > a beginning of something that really should be discussed upfront.
> > >
> > > We don't have any plan with future use cases yet. The only example
> > > I mentioned in the original version of the commit log is "walk the
> > > mount tree". IOW, it is similar to the current iterator, but skips non
> > > mount point iterations.
> > >
> > > Since we call it "path iterator", it might make sense to add ways to
> > > iterate the VFS tree in different patterns. For example, we may
> >
> > No, we're not adding a swiss-army knife for consumption by out-of-tree
> > code. I'm not opposed to adding a sane iterator for targeted use-cases
> > with a clear scope and internal API behavior as I've said multiple times
> > already on-list and in-person.
> >
> > I will not merge anything that will endup exploding into some fancy
> > "walk subtrees in any order you want".
>
> We are not proposing (and AFAICT never proposed) to have a
> swiss-army knife that "walk subtrees in any order you want". Instead,
> we are proposing a sane iterator that serves exactly one use case
> now. I guess the concern is that it looks extensible. However, I made
> the API like this so that it can be extended, with thorough reviews, to
> cover another sane use case. If there is still concern with this. We
> sure can make current code not extensible. In case there is a
> different sane use case, we will introduce another iterator after
> thorough reviews.
It's good that the iterator is extensible, but to achieve that
there is no need to introduce "enum bpf_path_iter_mode"
which implies some unknown walk patterns.
Just add "u64 flags" to bpf_iter_path_new() and
if (!flags) return -EINVAL;
Then we'll have a way to extend that kfunc if really necessary.
Deleting and introducing new kfuncs/iterators is not a big deal,
but reserving 'flags' as an option for extension is almost
always a good backup.
Powered by blists - more mailing lists