From: "koraynilay" <koray.fra@gmail.com>
To: "Amir Goldstein" <amir73il@gmail.com>,
"koraynilay" <koray.fra@gmail.com>
Cc: "Namjae Jeon" <linkinjeon@kernel.org>,
"Hyunchul Lee" <hyc.lee@gmail.com>,
"Alexander Viro" <viro@zeniv.linux.org.uk>,
"Christian Brauner" <brauner@kernel.org>,
"Chuck Lever" <cel@kernel.org>,
"Jeff Layton" <jlayton@kernel.org>, "Jan Kara" <jack@suse.cz>,
"Darrick J . Wong" <djwong@kernel.org>,
"Andrey Albershteyn" <aalbersh@kernel.org>,
"Pali Rohár" <pali@kernel.org>,
"Lauri Gates" <lauri.gates@gmail.com>,
"Christoph Hellwig" <hch@infradead.org>,
"Dave Chinner" <dgc@kernel.org>,
linux-btrfs@vger.kernel.org, linux-xfs@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
ntfs@lists.linux.dev, linux-nfs@vger.kernel.org,
linux-api@vger.kernel.org
Subject: Re: [PATCH 2/3] vfs: add xflags mask to fileattr API
Date: Thu, 26 Nov 2026 10:47:26 +0100 [thread overview]
Message-ID: <DN51PX8IPQRE.120Q2U9RLZZ7B@gmail.com> (raw)
In-Reply-To: <CAOQ4uxgJTSspRJqRFaSJxKUShVULaJpMv8UhBFR-DV2kUe1sXw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3767 bytes --]
On Thu Nov 26, 2026 at 10:23 AM CET, Amir Goldstein wrote:
> On Thu, Nov 26, 2026 at 9:59 AM koraynilay <koray.fra@gmail.com> wrote:
>>
> ...
>> >> > Attributes that have X_value like fsx_projid have few types:
>> >> > 1. 0 means disabled (all existing values incl. projid)
>> >> > 2. 0 is a valid value but cannot be unset (btime)
>> >> > 3. 0 is a valid value and NULL/unset is also a valid value
>> >> >
>> >> > Only for type 3 does can the interpretation of
>> >> > (!XFLAG_X && !fsx_X) be considered as an "unset"
>> >> > and anyway, this will require support in individual fs.
>> >>
>> >> IMO !(xflags & XFLAG) && (rw_mask & XFLAG) should clear/unset the value
>> >> in all cases, ignoring what's in fsx_X.
>> >>
>> >> And all existing values would be of type 1 for VER0, but of type 1 + 3
>> >> for VER1.
>> >>
>> >
>> > I agree that this will be more consistent.
>> >
>> > With explicit opt-in to FILEATTR_MASKS API
>> > vfs can determine that
>> > (!XFLAG_X && !!fsx_X) is alway -EINVAL
>> >
>> > When fsx_X == 0, the value of XFLAG_X does not really matter
>> > so filesystems can decide themselves if they want to act on
>> > an "unset" flag or not.
>>
>> Hmm, I think fsx_xflags should have priority over the value in this
>> _masks API.
>>
>> In my mind, to clear PROJID a userspace program would only need to do:
>>
>> struct file_attr fa = {
>> .fsx_xflags = 0,
>> .fsx_xflags_rw_mask = FS_XFLAG_PROJID
>> };
>> file_setattr(&fa, AT_FILE_ATTR_MASKS);
>
> If the program (e.g. chattr -p) internationally sets rw_mask = FS_XFLAG_PROJID
> what do we gain from not requiring the program to also set fsx_projid = 0?
> I just don't see any wins for anyone from this design choice.
>
> Maybe I am missing something.
I don't think we gain something, but I think it wouldn't make sense
semantically to require it.
At least personally, I wouldn't expect to be required to also 0 the
value if I'm already saying "I want to change PROJID and I want to unset
it" (rw mask = PROJID, xflags = 0).
Also for maybe future attributes belonging to type 3, the value should
be ignored when unsetting, since there would be no "invalid value" like
0 for projid.
>>
>> and have projid cleared (same for EXTSIZE/EXTSZINHERIT/COWEXTESIZE),
>> while to set/change it:
>>
>> struct file_attr fa = {
>> .fsx_xflags = FS_XFLAG_PROJID,
>> .fsx_xflags_rw_mask = FS_XFLAG_PROJID,
>> .fsx_projid = 67,
>> };
>> file_setattr(&fa, AT_FILE_ATTR_MASKS);
>>
>> and this:
>>
>> struct file_attr fa = {
>> .fsx_xflags = FS_XFLAG_PROJID,
>> .fsx_xflags_rw_mask = FS_XFLAG_PROJID,
>> .fsx_projid = 0,
>> };
>> file_setattr(&fa, AT_FILE_ATTR_MASKS);
>>
>> would have the same result as the first snippet, but not the same
>> meaning, since this would mean "set projid to 0" while the first snippet
>> means "clear/unset projid" (but in this case, for projid and all the
>> other already existing fsx_* it would have the same result).
>>
>
> As I wrote it could matter per attribute and per filesystem
> whether set to 0 or unset is different.
Yes, then filesystems could handle them however they want, maybe even
use the fsx_* value (if it's not 0) in the reset case above.
> The man page language should be flexible enough about this point.
>
> It only needs to document the invalid combinations.
>
> When proposing an UAPI change I often included a man-page draft
> as a proof that the UAPI can make sense to human readers.
Yes, I think I'll write the explanation in the cover letter to have the
ideas written down, then I can add man-pages and docs in v3.
Thanks,
koraynilay
> Thanks,
> Amir.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2026-11-26 9:47 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 0:08 [PATCH 0/3] Add f*_xflags_{rw,ro}_mask flags to the " koraynilay
2026-11-22 0:08 ` [PATCH 1/3] vfs: use goto out on error in vfs_fileattr_set() koraynilay
2026-11-23 8:42 ` Andrey Albershteyn
2026-11-23 14:15 ` koraynilay
2026-11-23 14:18 ` Amir Goldstein
2026-11-23 14:22 ` koraynilay
2026-11-22 0:08 ` [PATCH 2/3] vfs: add xflags mask to fileattr API koraynilay
2026-11-23 13:24 ` Amir Goldstein
2026-11-23 13:58 ` koraynilay
2026-11-23 15:29 ` Amir Goldstein
2026-11-25 15:01 ` koraynilay
2026-11-25 16:51 ` Amir Goldstein
2026-11-25 20:22 ` koraynilay
2026-11-26 7:07 ` Amir Goldstein
2026-11-26 8:59 ` koraynilay
2026-11-26 9:23 ` Amir Goldstein
2026-11-26 9:47 ` koraynilay [this message]
2026-11-22 0:08 ` [PATCH 3/3] ntfs: switch to the new xflags " koraynilay
2026-11-22 12:49 ` liubaolin
2026-11-23 0:38 ` koraynilay
2026-11-23 3:06 ` liubaolin
2026-11-23 14:13 ` koraynilay
2026-11-23 13:00 ` Amir Goldstein
2026-11-23 13:50 ` koraynilay
2026-11-23 14:14 ` Amir Goldstein
2026-11-23 14:31 ` koraynilay
2026-11-23 14:55 ` Amir Goldstein
2026-11-23 15:18 ` Amir Goldstein
2026-11-23 13:35 ` [PATCH 0/3] Add f*_xflags_{rw,ro}_mask flags to the " Amir Goldstein
2026-11-23 14:10 ` koraynilay
2026-11-23 15:42 ` Amir Goldstein
2026-11-23 17:58 ` koraynilay
2026-11-23 21:45 ` koraynilay
2026-11-23 22:47 ` Amir Goldstein
2026-11-23 22:56 ` koraynilay
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=DN51PX8IPQRE.120Q2U9RLZZ7B@gmail.com \
--to=koray.fra@gmail.com \
--cc=aalbersh@kernel.org \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=cel@kernel.org \
--cc=dgc@kernel.org \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=hyc.lee@gmail.com \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=lauri.gates@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=ntfs@lists.linux.dev \
--cc=pali@kernel.org \
--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
all inboxes | Powered by JetHome®