mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: bot+bpf-ci@kernel.org
To: tasos.papagiannnis@gmail.com,bpf@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,linux-fsdevel@vger.kernel.org,ast@kernel.org,daniel@iogearbox.net,andrii@kernel.org,eddyz87@gmail.com,memxor@gmail.com,viro@zeniv.linux.org.uk,brauner@kernel.org,jack@suse.cz,tasos.papagiannnis@gmail.com,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next 1/3] bpf: Add bpf_path_getattr()
Date: Thu, 29 Oct 2026 10:55:42 +0000 (UTC)	[thread overview]
Message-ID: <bc648f822c04dff3b0c594e7892fbae5a667df99bf4c59a69987594dbd33904b@mail.kernel.org> (raw)
In-Reply-To: <20261029095952.44833-2-tasos.papagiannnis@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2039 bytes --]

> bpf: Add bpf_path_getattr()

TL;DR: Design nit only: bpf_path_getattr() near-copies the mount ID and
mount-root handling from vfs_statx_path(), so the two may drift; suggests a
shared helper in fs/stat.c and avoiding VFS-private headers.

> diff --git a/fs/bpf_fs_kfuncs.c b/fs/bpf_fs_kfuncs.c
> index 35ccd98a4de6..95d7b0de2453 100644
> --- a/fs/bpf_fs_kfuncs.c
> +++ b/fs/bpf_fs_kfuncs.c

[ ... ]

> @@ -1,23 +1,127 @@
>  #include <linux/xattr.h>
>  
> +#include "internal.h"
> +#include "mount.h"
> +

[ ... ]

> +	if (request_mask & STATX_MNT_ID_UNIQUE) {
> +		out->mnt_id = real_mount(path->mnt)->mnt_id_unique;
> +		stat.result_mask |= STATX_MNT_ID_UNIQUE;
> +	} else {
> +		out->mnt_id = real_mount(path->mnt)->mnt_id;
> +		stat.result_mask |= STATX_MNT_ID;
> +	}
> +	out->size = stat.size;
> +	out->attributes = stat.attributes & ~STATX_ATTR_CHANGE_MONOTONIC;
> +	if (path_mounted(path))
> +		out->attributes |= STATX_ATTR_MOUNT_ROOT;
> +	out->attributes_mask = stat.attributes_mask | STATX_ATTR_MOUNT_ROOT;

this isn't a bug, but could the mount ID and STATX_ATTR_MOUNT_ROOT handling
be shared with vfs_statx_path() through a small helper in fs/stat.c?

This block looks like a near-verbatim copy of the post-getattr part of
vfs_statx_path(), plus the STATX_ATTR_CHANGE_MONOTONIC masking from
cp_statx().

The kernel-doc says 'Results follow statx(2)', so a later change to
vfs_statx_path() (a new mount attribute, a different mount ID rule) would
have to be mirrored here by hand.

The copy is also why this file now includes the VFS-private headers:

	#include "internal.h"
	#include "mount.h"

just to reach real_mount() and path_mounted().  A helper in fs/stat.c that
applies the mount ID and mount-root fields to a kstat would keep the two
in sync and keep struct mount inside fs/.


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/40857522501

  reply	other threads:[~2026-10-29 10:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29  9:59 [PATCH bpf-next 0/3] " Anastasios Papagiannis
2026-10-29  9:59 ` [PATCH bpf-next 1/3] " Anastasios Papagiannis
2026-10-29 10:55   ` bot+bpf-ci [this message]
2026-10-29  9:59 ` [PATCH bpf-next 2/3] docs/bpf: Document bpf_path_getattr() Anastasios Papagiannis
2026-10-29  9:59 ` [PATCH bpf-next 3/3] selftests/bpf: Test bpf_path_getattr() Anastasios Papagiannis

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=bc648f822c04dff3b0c594e7892fbae5a667df99bf4c59a69987594dbd33904b@mail.kernel.org \
    --to=bot+bpf-ci@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=mason@kernel.org \
    --cc=memxor@gmail.com \
    --cc=tasos.papagiannnis@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yonghong.song@linux.dev \
    /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

all inboxes | Powered by JetHome®