From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.50 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796565648; b=sTXouKsd0aao6qxQqT7Ge+yeeabWkv5qG1e0jNG6M5hrc016fjIz+Epy3N9BL9EofAJu AHM0qTTTRTZ8TD5kxeJmLtAZlGbEbnVg0LsVG3VeXfomQjlUtv9+5n7Og6Y7b57KH1ArU OyBbnsZeCIdW3YOuefuT8lwFRUZg4ByolkSjbxMnn9uhGMndvO/779iPsGzjMIoiPLrzJ kUTHTEgdAAGb1XN+S5w8W5E0IHgEOSTzZ+66jqpMEixhPTQ9KGlz+vKH0OCNazUWlMndl 3q5nQTCXE9GiSbUAQv9OZsVEa9R9F8Cx8um7j4I1R14k3M5i5HW1SWUvyCHVLVpxUGw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796565648; 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=wiB98XitgLRNAPJuyw/s8XBOsJdixDuXkQa3P5BCx6Y=; b=WBFGOiNNpklHrhiWCg9rpsyFzaOIf5gCmYKHDmU4kf80LIhiwRghrLgFi0Vgony/1Y3f j4eX6q3Oem8vkTvgalccJ+SODmBdz58FtKHnc4ErU0NkDYVhBWvAw3EUuS9ezLp3JyXzk o6v31JG1z+rLR12ogamwEmeQwjOgax6qHs7HENmAibQwGsXc/yWYBEyKgZf6CwjXWhkst gR6C0CHQ2+zpborEAk9/RWrcmuNx6efc296k+UYkum0Ww+hg6B94JBFQiVFHg8fPHafOB gkWyCBmewRw3TN7N3I+rulxR3fxSwO3/e2PUoMQsSGm/bGI1sBkER7y/oa0/nFo0Jng== 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=O9N0KBgD; arc=none smtp.remote-ip=209.85.221.50 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (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 9BAF7606A330 for ; Sun, 6 Dec 2026 14:00:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9BAF7606A330 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=O9N0KBgD Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-491846221ffso2192335f8f.3 for ; Sun, 06 Dec 2026 06:00:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796565646; x=1797170446; 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=wiB98XitgLRNAPJuyw/s8XBOsJdixDuXkQa3P5BCx6Y=; b=O9N0KBgDafC/AtF+hRfQOMWwgpucRWQGIaGSHT/fRHIUXNBlrwe/nTIjJrVQszCVl9 HixYXvkIQvJgzLfVzssyDhYft6XqJ+NN35Pda2Emc5WhXA/zB1e8IRBmUOYFO9u/+GBa xSdh2ntpefg5hc2jZMR8C0aVCYGbsMBx/g7R+d3chbZ0L0A1lJr56P3MqlhBZzxUmyxU Vtlck0lgZoPOmPJwKd3jGwp93xtI/0tGNP55ZwmfzTOC0L5Ufu/a1sjs2In0qoOr5LfM 8En4Hn0Z7gL1p3qSfhhzVLwoP7pNyJwHcsruBGtn/m1uTQRkZn6gs+QP+SpWXl/OzAse 1fhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796565646; x=1797170446; 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=wiB98XitgLRNAPJuyw/s8XBOsJdixDuXkQa3P5BCx6Y=; b=Mo0uP0/lAr9LG+Ydmudh0JgJFnFlwpiGFNsFa7aTtsZag3xAcVeQ8DzLiqHoM0C0PL 3G1q+gdz+W+05xdmj5S01oxXCtpbbUerbbUu8YhoJTOxEfv1LPqSBl5K1z91ag/04cJu 8RmPte2ukCzFg8DK9UHOXwwIUUHrvRWKIeCDYDTmib73HdHT0WHA3SAXvHSrecnVUbCA cpetGf8J7eXjqUqQMt4v1qMfIlz4UpoZokHgbYsZ1e/J3gKBTKD/5arrdkh51vKyipOl jVjUVR9aCkvZMeBYoy1R6EebrHC3a103xso3cP0QWmNitcNvBSpLeg6JH5SZVnPU4FlX WLcg== X-Forwarded-Encrypted: i=1; AL+hErHcUjOfu2/9pGypTWG04PNvA2EPB1X9AOZ/9Dcrm91oIA8ya9QVkTIv3tnpgLdtHZ9h+J1bxwoRIF0=@vger.kernel.org X-Gm-Message-State: AB4q+uHkWEYfMxa3jYa3kMnsfE6Hj0OPYTNm/9iUBxMbOrCmtk37tVr+ aCJnrKkAtEjUO/v55TGYh6x9V/FXLvlGLlMoQEXOLjxhyY9PBq5tWuiD X-Gm-Gg: AZFdTZdPtoos3iK7r8Lv+QW9swiTJrNIcAGUk3sCQPHhvhNR14+0NqpA7a6dKBiNG9C ldKWwOi8J4A5FBqHaiOFkfAW36+KHh4WXpquNPa6vyAPixoTJvwgjti2lDH5dapzRFNszVFKaLH eXksD/6G00CtSz29F7IKLv9IBkLdEFN7SrTI+fWv2eu3BkN+9zNAavdoXzrpa2eoMyXd0Vn1vJb j6mTfDGHlf8SuN7lsJvjm2tSbnm/qVWQ8Y0Cv4P3H4X2kpg2oxg0Sl7zOByoL2gUCuS5XbYUrTk ZSQU7G3KSXvwb0gHMslkzky+UwGU9zxvG/rz53XhUtpAQd3bC7QJnKDYqNfdXjiHSV6dCc+QeVI qW0Q5wUTsBdolVqQqO4YgiYLWTqueCdd9TBgawvSXB6AowaGoKq67/4lcPj5pXyDM8VyGZwyfXj rDWIeZ3sRBgEYymQAcwoUchCapLRm3FSx//iJG8RrQ4GzYpcU7beu0CZ+zDiQ9mY5GzkNqtAneB aq7qZMPBDcRJqe/ikRjApOYDTRNqyLy8hrDZfP+YQXp08q8wtmo7OaHAPLPiazsjXymu40HzG03 eQnYdv/MdjZomhkxZzWjjHl9dw== X-Received: by 2002:a05:6000:387:b0:48f:d7cd:a5af with SMTP id ffacd0b85a97d-4d1dcb0ce87mr15625169f8f.0.1796565645736; Sun, 06 Dec 2026 06:00:45 -0800 (PST) Received: from localhost ([2001:b07:5d26:7a6a:365a:60ff:fe0d:cfc6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4d17435e113sm17760328f8f.52.2026.12.06.06.00.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 06 Dec 2026 06:00:45 -0800 (PST) X-Mailing-List: linux-xfs@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=37b7154a0264a50220abeb59f5609eed54eb100af8a986de7394d6e29b44; micalg=pgp-sha512; protocol="application/pgp-signature" Date: Sun, 06 Dec 2026 15:00:43 +0100 Message-Id: Cc: "Namjae Jeon" , "Hyunchul Lee" , "Jonathan Corbet" , "Eric Biggers" , "Theodore Y . Ts'o" , "Jaegeuk Kim" , "Alexander Viro" , "Christian Brauner" , "Shuah Khan" , "Randy Dunlap" , "Chuck Lever" , "Jeff Layton" , "Jan Kara" , "Alexander Aring" , "Darrick J . Wong" , "Andrey Albershteyn" , "Miklos Szeredi" , =?utf-8?q?Pali_Roh=C3=A1r?= , "Lauri Gates" , "Christoph Hellwig" , "Dave Chinner" , , , , , , , , , Subject: Re: [PATCH v5 04/12] fs: switch fileattr_set_prepare() to xflags and refactor projid check From: "koraynilay" To: "Amir Goldstein" , "koraynilay" X-Mailer: aerc 0.22.0-0-gc2f86b7abde3 References: <20261205142411.164484-1-koray.fra@gmail.com> <20261205142411.164484-5-koray.fra@gmail.com> In-Reply-To: --37b7154a0264a50220abeb59f5609eed54eb100af8a986de7394d6e29b44 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 On Sun Dec 6, 2026 at 1:19 PM CET, Amir Goldstein wrote: > On Sat, Dec 5, 2026 at 3:24=E2=80=AFPM koraynilay w= rote: >> >> In preparation for the addition of masks to the fileattr API, switch >> fileattr_set_prepare() checks from using FS_*_FL flags to FS_XFLAG_* >> xflags and refactor project ID value check to be cleaner. >> >> Signed-off-by: koraynilay >> --- >> fs/file_attr.c | 30 ++++++++++++++++++++---------- >> 1 file changed, 20 insertions(+), 10 deletions(-) >> >> diff --git a/fs/file_attr.c b/fs/file_attr.c >> index 77e2f1bc22ad..c1a0272f1a83 100644 >> --- a/fs/file_attr.c >> +++ b/fs/file_attr.c >> @@ -74,6 +74,14 @@ void fileattr_fill_flags(struct file_kattr *fa, u32 f= lags) >> } >> EXPORT_SYMBOL(fileattr_fill_flags); >> >> +static u32 xflags_to_flags(u32 xflags) >> +{ >> + struct file_kattr tmp =3D {}; >> + >> + fileattr_fill_xflags(&tmp, xflags); >> + return tmp.flags; >> +} >> + >> /** >> * vfs_fileattr_get - retrieve miscellaneous file attributes >> * @dentry: the object to retrieve from >> @@ -201,17 +209,20 @@ static int fileattr_set_prepare(struct inode *inod= e, >> const struct file_kattr *old_ma, >> struct file_kattr *fa) >> { >> + u32 changed =3D (fa->fsx_xflags ^ old_ma->fsx_xflags) & FSX_FSXA= TTR_MASK; >> int err; >> >> /* >> * The IMMUTABLE and APPEND_ONLY flags can only be changed by >> * the relevant capability. >> */ >> - if ((fa->flags ^ old_ma->flags) & (FS_APPEND_FL | FS_IMMUTABLE_F= L) && >> + if (changed & (FS_XFLAG_APPEND | FS_XFLAG_IMMUTABLE) && >> !capable(CAP_LINUX_IMMUTABLE)) >> return -EPERM; >> >> - err =3D fscrypt_prepare_setflags(inode, old_ma->flags, fa->flags= ); >> + err =3D fscrypt_prepare_setflags(inode, >> + xflags_to_flags(old_ma->fsx_xflag= s), >> + xflags_to_flags(fa->fsx_xflags)); > > Why is this needed? > fa->flags and old_ma->flags are kept in sync with fsx_xflags by the > VFS in all paths, Right, > including the masks conversions, > and fscrypt only cares about a newly set CASEFOLD flag. > I think this hunk can be dropped and xflags_to_flags() can be introduced > in the patch that first needs it. but wouldn't it be better to keep it for consistency, since from now on set_prepare should only handle xflags, and not rely on the assumption that flags is kept up to date? Though since right now it is kept up to date in all paths, we would just need to be careful in later patches and wait until fscrypt_prepare_setflags is switched to xflags (?). Thanks, koraynilay > With that changes you may add > > Reviewed-by: Amir Goldstein amir73il@gmail.com > > Thanks, > Amir. --37b7154a0264a50220abeb59f5609eed54eb100af8a986de7394d6e29b44 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQSgVimKafU5DQMcjcDmj22qf5IGXAUCaxVqiwAKCRDmj22qf5IG XAkbAP9yy/wdxYJm8RL8AaSE3KCOqL4Ah+1xpSfp4UPHvrbPaQEAu+oPpP2rndCV e+7naB19G6eAWh4P8XMBa6I8hi6owwc= =N/UR -----END PGP SIGNATURE----- --37b7154a0264a50220abeb59f5609eed54eb100af8a986de7394d6e29b44--