linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Andrey Albershteyn <aalbersh@redhat.com>,
	Amir Goldstein <amir73il@gmail.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Casey Schaufler <casey@schaufler-ca.com>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	Paul Moore <paul@paul-moore.com>,
	linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org,
	selinux@vger.kernel.org, Andrey Albershteyn <aalbersh@kernel.org>
Subject: Re: [PATCH v6 6/6] fs: introduce file_getattr and file_setattr syscalls
Date: Tue, 1 Jul 2025 21:17:46 +0200	[thread overview]
Message-ID: <20250701191746.cekhigo4e6xespjj@pali> (raw)
In-Reply-To: <20250701190857.GR10009@frogsfrogsfrogs>

On Tuesday 01 July 2025 12:08:57 Darrick J. Wong wrote:
> On Tue, Jul 01, 2025 at 08:54:57PM +0200, Pali Rohár wrote:
> > On Tuesday 01 July 2025 11:43:17 Darrick J. Wong wrote:
> > > On Mon, Jun 30, 2025 at 06:20:16PM +0200, Andrey Albershteyn wrote:
> > > > diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
> > > > index 0098b0ce8ccb..0784f2033ba4 100644
> > > > --- a/include/uapi/linux/fs.h
> > > > +++ b/include/uapi/linux/fs.h
> > > > @@ -148,6 +148,24 @@ struct fsxattr {
> > > >  	unsigned char	fsx_pad[8];
> > > >  };
> > > >  
> > > > +/*
> > > > + * Variable size structure for file_[sg]et_attr().
> > > > + *
> > > > + * Note. This is alternative to the structure 'struct fileattr'/'struct fsxattr'.
> > > > + * As this structure is passed to/from userspace with its size, this can
> > > > + * be versioned based on the size.
> > > > + */
> > > > +struct fsx_fileattr {
> > > > +	__u32	fsx_xflags;	/* xflags field value (get/set) */
> > > 
> > > Should this to be __u64 from the start?  Seeing as (a) this struct is
> > > not already a multiple of 8 bytes and (b) it's likely that we'll have to
> > > add a u64 field at some point.  That would also address brauner's
> > > comment about padding.
> > 
> > Hello!
> > 
> > As I have already mentioned, after this syscall API/ABI is finished, I'm
> > planning to prepare patches for changing just selected fields / flags by
> > introducing a new mask field, and support for additional flags used by
> > existing filesystems (like windows flags).
> > 
> > My idea is extending this structure for a new "u32 fsx_xflags_mask"
> > and new "u32 fsx_xflags2" + "u32 fsx_xflags2_mask". (field names are
> > just examples).
> > 
> > So in case you are extending the structure now, please consider if it
> > makes sense to add all members, so we do not have to define 2 or 3
> > structure versions in near feature.
> > 
> > Your idea of __u64 for fsx_xflags means that it will already cover the
> > "u32 fsx_xflags2" field.
> 
> Ah, ok, so that work *is* still coming. :)

Yes. I'm just waiting until this patch series is accepted.

In past I have already sent RFC patches to the list which modifies the
existing ioctl interface. So you can look at it if you want :-)

> Are you still planning to add masks for xflags bits that are clearable
> and settable?  i.e.
> 
> 	__u64	fa_xflags;		/* state */
> 	...
> 	<end of V0 structure>
> 
> 	__u64	fa_xflags_mask;		/* bits for setattr to examine */
> 	__u64	fa_xflags_clearable;	/* clearable bits */
> 	__u64	fa_xflags_settable;	/* settable bits */
> 
> I think it's easier just to define u64 in the V0 structure and then add
> the three new fields in V1.  What do you think?

I wanted the interface which would allow to atomically change specified
bit/flag without the need for get-modify-set. And I think that this
would not work as the fa_xflags requires the state.

My idea is following:

  __u64 fa_xflags;
  ...
  <end of V0 structure>
  __u64 fa_xflags_mask;

The fa_xflags_mask will specify which bits from the fa_xflags and from
other fa_* fields in V0 struct are going to be changed.

> --D
> 
> > > --D
> > > 
> > > > +	__u32	fsx_extsize;	/* extsize field value (get/set)*/
> > > > +	__u32	fsx_nextents;	/* nextents field value (get)   */
> > > > +	__u32	fsx_projid;	/* project identifier (get/set) */
> > > > +	__u32	fsx_cowextsize;	/* CoW extsize field value (get/set) */
> > > > +};
> > > > +
> > > > +#define FSX_FILEATTR_SIZE_VER0 20
> > > > +#define FSX_FILEATTR_SIZE_LATEST FSX_FILEATTR_SIZE_VER0
> > > > +
> > > >  /*
> > > >   * Flags for the fsx_xflags field
> > > >   */
> > > > diff --git a/scripts/syscall.tbl b/scripts/syscall.tbl
> > > > index 580b4e246aec..d1ae5e92c615 100644
> > > > --- a/scripts/syscall.tbl
> > > > +++ b/scripts/syscall.tbl
> > > > @@ -408,3 +408,5 @@
> > > >  465	common	listxattrat			sys_listxattrat
> > > >  466	common	removexattrat			sys_removexattrat
> > > >  467	common	open_tree_attr			sys_open_tree_attr
> > > > +468	common	file_getattr			sys_file_getattr
> > > > +469	common	file_setattr			sys_file_setattr
> > > > 
> > > > -- 
> > > > 2.47.2
> > > > 
> > > > 
> > 

  reply	other threads:[~2025-07-01 19:17 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-30 16:20 [PATCH v6 0/6] fs: introduce file_getattr and file_setattr syscalls Andrey Albershteyn
2025-06-30 16:20 ` [PATCH v6 1/6] fs: split fileattr related helpers into separate file Andrey Albershteyn
2025-07-01  5:39   ` Amir Goldstein
2025-07-01 12:38   ` Jan Kara
2025-07-01 18:13   ` Darrick J. Wong
2025-06-30 16:20 ` [PATCH v6 2/6] lsm: introduce new hooks for setting/getting inode fsxattr Andrey Albershteyn
2025-07-01 12:39   ` Jan Kara
2025-07-01 18:18   ` Darrick J. Wong
2025-07-02  8:47     ` Andrey Albershteyn
2025-06-30 16:20 ` [PATCH v6 3/6] selinux: implement inode_file_[g|s]etattr hooks Andrey Albershteyn
2025-06-30 16:20 ` [PATCH v6 4/6] fs: make vfs_fileattr_[get|set] return -EOPNOSUPP Andrey Albershteyn
2025-06-30 18:05   ` Pali Rohár
2025-07-01  6:05   ` Amir Goldstein
2025-07-01 12:51     ` Jan Kara
2025-07-01 14:16       ` Amir Goldstein
2025-07-01 12:52   ` Jan Kara
2025-07-01 18:18   ` Darrick J. Wong
2025-06-30 16:20 ` [PATCH v6 5/6] fs: prepare for extending file_get/setattr() Andrey Albershteyn
2025-07-01 13:06   ` Jan Kara
2025-07-01 18:31   ` Darrick J. Wong
2025-07-01 19:27     ` Amir Goldstein
2025-07-01 19:40       ` Darrick J. Wong
2025-07-01 19:54         ` Pali Rohár
2025-07-02  7:03           ` Amir Goldstein
2025-07-02  9:48             ` Amir Goldstein
2025-07-02 12:24               ` Christian Brauner
2025-06-30 16:20 ` [PATCH v6 6/6] fs: introduce file_getattr and file_setattr syscalls Andrey Albershteyn
2025-07-01 12:34   ` Christian Brauner
2025-07-02  9:13     ` Amir Goldstein
2025-07-01 13:24   ` Jan Kara
2025-07-01 18:43   ` Darrick J. Wong
2025-07-01 18:54     ` Pali Rohár
2025-07-01 19:08       ` Darrick J. Wong
2025-07-01 19:17         ` Pali Rohár [this message]
2025-07-02 12:40     ` Christian Brauner
2025-07-02 13:43       ` Amir Goldstein
2025-07-02 18:37         ` Darrick J. Wong
2025-07-03  8:28           ` Christian Brauner
2025-07-03  8:42             ` Amir Goldstein
2025-07-03  8:46               ` Christian Brauner
2025-07-03 22:35                 ` Darrick J. Wong
2025-07-01  6:11 ` [PATCH v6 0/6] " Amir Goldstein
2025-07-01 12:29 ` Christian Brauner
2025-07-07 12:05   ` Andrey Albershteyn
2025-07-07 12:19     ` Christian Brauner
2025-07-07 12:27       ` Andrey Albershteyn
2025-07-07 12:19 ` Christian Brauner

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=20250701191746.cekhigo4e6xespjj@pali \
    --to=pali@kernel.org \
    --cc=aalbersh@kernel.org \
    --cc=aalbersh@redhat.com \
    --cc=amir73il@gmail.com \
    --cc=arnd@arndb.de \
    --cc=brauner@kernel.org \
    --cc=casey@schaufler-ca.com \
    --cc=djwong@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=selinux@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).