From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.52 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795686456; b=VFc6kmyd1tiW9RxaP/icHkYk2LvFz4gPgAAWkc0IAbN2h+cmUIdk6TCb+bqpmYv/38Fa x1Ppus6UwsGeHlC1PycXwySLDnBZpjAjYlHDFuYN1+YwuzAF2EBdqNtIQPvVM/5M9z99F xQOrl5mWz+HVMrmnDk+l+JqFkbrVLTaATFBsCeu/Uw0PEf94bMJL+Ocba3Tni7Afhn8L5 zrL3wiRZtwwyhYUeT2IrSEg3C9SwkYlxOvlgTVhN2hOJr93g7jNaaq/sTvnc0c6cuFZdP WLa3shfaYqb3xJrIUZmAXXJsnR7KiynLrdKLb+HcHSWT/SbnjZCP2qmgV/rWFVmR15g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795686456; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To:X-Mailer: References:In-Reply-To; bh=vftivs/ZcwAXfWGGaHfjRVFbQTh5u76KaVfGvH0yVJc=; b=OjaUX4QwsJ0/6Ofpc/GGXuz4GIBPelC3rIt4nE+LpSTAgsv7dVlY98G373zOmJ4+ka6T BxcBTWzlXgfxhWyOW29XWCQZUH0PMOfZ/SAsGTre13LJlNUwg92HLk0g+Am2/I/bXRoJZ 9xWP6mAnJgmDnJeViJySnFWKqFSCjKYyUfEqc8pmtKRNXEhb1HYXRPmf5wcC2t1Y0Gslj e8RatoHwRuJ/SDvYAMt+P50A1nxgY035ZJEIhBQsxc4FWewhfe3dUXUmYWOY58r56Vgfb BFXPAjMs4xRDlzT20ZCvLWnxKFWW7RKEdnEppVbyoVIOHintdpq2t7VggBzURCTWpdQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="a/5cpDpb"; arc=none smtp.remote-ip=209.85.221.52 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 75349606A330 for ; Thu, 26 Nov 2026 09:47:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 75349606A330 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=a/5cpDpb Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-4a34ffd3e39so3692297f8f.0 for ; Thu, 26 Nov 2026 01:47:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795686455; x=1796291255; darn=vger.kernel.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:mime-version:from:to:cc:subject:date:message-id :reply-to:content-type; bh=vftivs/ZcwAXfWGGaHfjRVFbQTh5u76KaVfGvH0yVJc=; b=a/5cpDpb4UOZipYKNI+uIXwTGnwMpDyDDiuIOac83Ij/fGM7n1D1hX3JwUZLHTV7rr tHqOdlSSrhKY8JV8uudY2iqFf9L6VT7cdHMgFu9+GR/JdDvvVXbNr0TXOFq+lJOZ6/QW VuWSGZIKw8x+7SZfh34i8wJ5HafX2i5rtrNkiYURX0JT+Lr0KmbdhM//KPdfbRLIF/TV V4HbKu5TjPb4L4qhSwOpVRJVDLPXz831BjgUBEd8RGK5gw3+zSbqLtXJ3pN7WcryOOg+ QAm9ty+qn0FkD3euxIMOpvh/2oLe71LJgexEnm0EDqIbCkPI/hBfL1V4dDs82F+O9jiN +WJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795686455; x=1796291255; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:mime-version:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=vftivs/ZcwAXfWGGaHfjRVFbQTh5u76KaVfGvH0yVJc=; b=nvzT53KPE2tUcQnF4tad2F8dHWMhce4C30X4MNLHS6sIg7ekVzBO7n5tTLfbhoNBFF 0b7FeesubLfeWxytCQNR2CPxYOhoCQdBENab/NTM2lIDPXNfj+7iDdgSIYTiu+2YPFmT GIZpzWCPZ3otwAql85mDEQqd9UM5uwE4z3NGalMFkQXXlfc8J03XQhs1pqXwfi7+9/G0 codjtTmRH+fRpdo+UjH0WVTSnhM4BOFlUGScIkaZakENSRGbwSONnX+8vZXsANLVF6jv 9iK8CKlQI9MnWHKVOkl4tckT00iuZpnEn7aeUFz6B5jid0oYPzJTYnQHJB6+WV7esqHD cwLQ== X-Forwarded-Encrypted: i=1; AL+hErE1vNoP1AsTzljHAnAOpJDd0AafaJ9b5CrRJqMt/Z/FFbg6SZqt9Uc0hgqpLGVf10lXe1A86CMyChY=@vger.kernel.org X-Gm-Message-State: APuU4Z8vBGFnrzC2tTr4+24SQ5EZsoAsBb4QwXvy/Vpn3Fz/QhgZDqil +Wnlbri1iO2NuubREt8IRFImMdSh2sEfIpdqF7T17DlndarmrnPY4q02 X-Gm-Gg: AZFdTZfPuI0zPqZbOHEmVfguJhhQEySCgs7iKGUB8ouZ5jdsWXDWSUfLTfLhJTb1q8K pVRd75FAyNMBhgqFX1jmtvcfr/KaaQE1iBWhhGvGnGp2sqT1+flTxXLiHyEq5Ar6QqCUvehLzHz kQuqlL0Og+mBYas/khx1T4hFYCTbAg18Nx75V0K3n9rTkL8mDQp6i+oHHGyIwg8HporLVWNireZ 2/YCnrkfhAKt4rVX4IEZ6PC1yQYHWZTA/qq753N0xA3XZFM+mKXRMGOLmD3gwysPc45fkfpaeZ7 weY5r9FhsWw9Qs4ZVCvrcPFvYFF998r7TvunZ5AEJqIYxxe0jMcRPB8G4d/L1RBG8Ow2P53ZOxO cFAow2kZsbyZx/rBLTewhHHqwz7z2hmpkyDGrZChtpb1T46Y9qMjQpdPz7CKQ2OTJ7uvd7kGW4H Pt/D7/gijqtla2Mp2dxbl51nv7aq+Q0DJHRYhvSUouPN7V6Uox3C3tC/MddxJASrI7zLAMtlXa4 O1bxr5cyq/T2EZ/VCXj8W2n0Q08w0usf+bWYN7xdyM0tzM5jVRJCndXLC/qFr8TlY67p8xQ6Y5/ aQlTOwPwUS4+j5Qr4ZowmH+SSwdWTnpN6h9El+QL2YlQVHkwSVEwHj2Jq59/31Q= X-Received: by 2002:a05:6000:200e:b0:4aa:76ce:4b9f with SMTP id ffacd0b85a97d-4abb6746af3mr40052013f8f.56.1795686454572; Thu, 26 Nov 2026 01:47:34 -0800 (PST) Received: from localhost (mob-176-246-236-25.net.vodafone.it. [176.246.236.25]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6a67f281sm37241600f8f.22.2026.11.26.01.47.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 26 Nov 2026 01:47:33 -0800 (PST) X-Mailing-List: linux-api@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 Content-Type: multipart/signed; boundary=79d3767db7994af79d385e900d46b036c798a71ba18599848e4679aadf0e; micalg=pgp-sha512; protocol="application/pgp-signature" Date: Thu, 26 Nov 2026 10:47:26 +0100 Message-Id: Cc: "Namjae Jeon" , "Hyunchul Lee" , "Alexander Viro" , "Christian Brauner" , "Chuck Lever" , "Jeff Layton" , "Jan Kara" , "Darrick J . Wong" , "Andrey Albershteyn" , =?utf-8?q?Pali_Roh=C3=A1r?= , "Lauri Gates" , "Christoph Hellwig" , "Dave Chinner" , , , , , , , Subject: Re: [PATCH 2/3] vfs: add xflags mask to fileattr API From: "koraynilay" To: "Amir Goldstein" , "koraynilay" X-Mailer: aerc 0.22.0-0-gc2f86b7abde3 References: <20261122000856.536902-1-koray.fra@gmail.com> <20261122000856.536902-3-koray.fra@gmail.com> In-Reply-To: --79d3767db7994af79d385e900d46b036c798a71ba18599848e4679aadf0e Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 On Thu Nov 26, 2026 at 10:23 AM CET, Amir Goldstein wrote: > On Thu, Nov 26, 2026 at 9:59=E2=80=AFAM koraynilay = 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 val= ue >> >> 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 =3D=3D 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 =3D { >> .fsx_xflags =3D 0, >> .fsx_xflags_rw_mask =3D FS_XFLAG_PROJID >> }; >> file_setattr(&fa, AT_FILE_ATTR_MASKS); > > If the program (e.g. chattr -p) internationally sets rw_mask =3D FS_XFLAG= _PROJID > what do we gain from not requiring the program to also set fsx_projid =3D= 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 =3D PROJID, xflags =3D 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 =3D { >> .fsx_xflags =3D FS_XFLAG_PROJID, >> .fsx_xflags_rw_mask =3D FS_XFLAG_PROJID, >> .fsx_projid =3D 67, >> }; >> file_setattr(&fa, AT_FILE_ATTR_MASKS); >> >> and this: >> >> struct file_attr fa =3D { >> .fsx_xflags =3D FS_XFLAG_PROJID, >> .fsx_xflags_rw_mask =3D FS_XFLAG_PROJID, >> .fsx_projid =3D 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. --79d3767db7994af79d385e900d46b036c798a71ba18599848e4679aadf0e Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRJ2XvJtXGwULYEerQ0bnTtJTDoOAUCawgALgAKCRA0bnTtJTDo OEQ/AP9wDjyrdFJEEzzmJJCrvCFrjxBqlkeNnNjqPWC/hJRgXgEA49DY4UXyB1Kj wKwdt2yo0aESyGLzlPUZRwD8RmhwnQQ= =UumB -----END PGP SIGNATURE----- --79d3767db7994af79d385e900d46b036c798a71ba18599848e4679aadf0e--