Linux filesystem development
 help / color / mirror / Atom feed
From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Christoph Hellwig" <hch@lst.de>
Cc: "Naohiro Aota" <naohiro.aota@wdc.com>, <viro@zeniv.linux.org.uk>,
	<brauner@kernel.org>, <cem@kernel.org>, <djwong@kernel.org>,
	<dgc@kernel.org>, <jack@suse.cz>, <linux-xfs@vger.kernel.org>,
	<linux-fsdevel@vger.kernel.org>, <bpf@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <dlemoal@kernel.org>,
	"Hans Holmberg" <hans.holmberg@wdc.com>,
	"Anuj Gupta" <anuj20.g@samsung.com>,
	"Kanchan Joshi" <joshi.k@samsung.com>
Subject: Re: [PATCH 0/6] xfs: BPF data placement policy for zoned file systems
Date: Sat, 05 Dec 2026 05:04:29 +0000	[thread overview]
Message-ID: <DNCJC6S59TD6.1BZ9YS02I339A@gmail.com> (raw)
In-Reply-To: <20261201091528.GA27736@lst.de>

On Tue, Dec 01, 2026 at 01:15 AM Christoph Hellwig <hch@lst.de> 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?

      reply	other threads:[~2026-12-05  5:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  4:34 [PATCH 0/6] xfs: BPF data placement policy for zoned file systems Naohiro Aota
2026-12-01  4:34 ` [PATCH 1/6] fs: add fs_dp BPF struct_ops for file data placement Naohiro Aota
2026-12-01  4:34 ` [PATCH 2/6] bpf: allow fs_dp struct_ops programs to call FS kfuncs Naohiro Aota
2026-12-01  4:34 ` [PATCH 3/6] xfs: add BPF data placement hook at file open Naohiro Aota
2026-12-01  4:34 ` [PATCH 4/6] xfs: add ioctls to select a BPF data placement policy Naohiro Aota
2026-12-01  4:34 ` [PATCH 5/6] xfs: bind a BPF data placement policy to a project ID Naohiro Aota
2026-12-01  4:34 ` [PATCH 6/6] xfs: let XFS_IOC_{SET,GET}_DP_OPS act on " Naohiro Aota
2026-12-01  4:37 ` [PATCH 1/2] fs_dp: let a policy pick a write stream Naohiro Aota
2026-12-01  4:37   ` [PATCH 2/2] xfs: bind write streams along with a data placement policy Naohiro Aota
2026-12-01  4:56 ` [PATCH 0/6] xfs: BPF data placement policy for zoned file systems Alexei Starovoitov
2026-12-01  9:15   ` Christoph Hellwig
2026-12-05  5:04     ` Alexei Starovoitov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DNCJC6S59TD6.1BZ9YS02I339A@gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=anuj20.g@samsung.com \
    --cc=bpf@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=cem@kernel.org \
    --cc=dgc@kernel.org \
    --cc=djwong@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=hans.holmberg@wdc.com \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=joshi.k@samsung.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=naohiro.aota@wdc.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox