Re: [PATCH 0/6] xfs: BPF data placement policy for zoned file systems
From: Alexei Starovoitov
Date: Sat Dec 05 2026 - 00:04:36 EST
On Tue, Dec 01, 2026 at 01:15 AM Christoph Hellwig <hch@xxxxxx> wrote:
> On Tue, Dec 01, 2026 at 04:56:50AM +0000, Alexei Starovoitov wrote:
>> Sorry, but the whole thing is an overkill if 'hint' is the only goal.
>> Here is a much simpler alternative:
>
> I have no idea how you think this helps?
The problem that you're trying to solve is the case
where app doesn't call fcntl(F_SET_RW_HINT).
and it happens at open() time where bpf hook is there already.
The only thing that is missing is lsm prog cannot write i_write_hint,
and trivial kfunc solves that.
>> SEC("lsm/file_open")
>
> Requiring LSM privileges for hints is not helpful.
What are you talking about?
In this series one needs CAP_BPF + CAP_PERFMON to load
and then CAP_SYS_ADMIN to attach,
while bpf lsm only needs CAP_BPF + CAP_PERFMON for both.
>> .dir = dentry->d_parent->d_inode->i_ino,
>
> FYI, ->d_parent dereferences aren't stable.
Yes, but bpf infra makes them safe to read as BPF_PROBE_MEM loads.
Sure, it can race and read garbage, but this is a hint anyway.
And 99.9% it will be accurate.
> This assumes you want to set hints on specific and not relative
> path, and encodes a really bad and mostly broken ABI in a userspace
> ABI due to the shared maps. But even with that you can't easily
> match for cgroup ID and other bits in here. And for anything we'd
> want to deploy the concept of a shared map with an implicit ABI
> is just a nightmare.
map was just an example.
It can be anything.
There is bpf_get_current_cgroup_id() to tie it to a cgroup.
security_file_open() runs in the context of the task,
so uid, pid, comm are also available for bpf prog to use as a key.
So is there anything more than the hint?