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=1795976414; b=fdpZfD3GEtvhYZURAnaAUUJMp2/OGiximiQ8aNEsbFiyR1wWr/d3hnVA2Tq42Q68hBox 3CBHRcorKNOfM+tDr705Ns+RbhAnGMfJ4GnEexQ7KTdn1y7OueYA/mS6MK7kB8u6a9S4o UyT1eox167POOR/jG5ilRxgvfs6WTtXUcNXf7jLRnzxIu+TneP5FO4c0iIpftxVBevjbF 08zhPDiZnfi6ykEMwpju9/8h5hkEGnP5E4tSkOfI6qVw1h50vG9t7fBeEnddM5s6Zd5nO DShATOt7aaBfW4VcaaMbYB3nZt6eN9WzXFSkBZRTzwSq8DAjHlG3AY8G6z2GMfJSSoA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795976414; 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:Subject:From:To:Cc:X-Mailer: References:In-Reply-To; bh=ow0gh1mmdygv9Aa1zDYMwfVwIzWsW3h0z63AOxRo408=; b=TIQGEjYctvQMUe2Wv+Q9XqWkaunP/TczxZisZdnfYUojR9eXBPYG5FV4UsZgnaqYM4UF 7Y7AoS+W7+J7aWcO1XrxE1rWwp1m9ECmb7afD2OHAHyskz/TEN9INz9Nq8TChgjEJ+NeM ocWFPp7of99oOJmnXRDnfmipqmK69WyPgfN5sq8b2yb1MkFguYp2TTPM00EhEfXbZjXID KPIWGJzQPqASbznf15vW/Xjkt7y58Vk/NNgmKgMwKCa4KdNJagQophroqzlDewi2nJAef nRZ0h/f+MD0ZyH/vIXqg40TuDpFUtzZyAqLOQKjJJ650ae0gmteXwkYjK76/cO4QHdA== 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=ZrNJ5hqj; 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 82B96606A335 for ; Sun, 29 Nov 2026 18:20:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 82B96606A335 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=ZrNJ5hqj Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-4a34ffd3e39so5264077f8f.0 for ; Sun, 29 Nov 2026 10:20:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795976412; x=1796581212; darn=vger.kernel.org; h=in-reply-to:references:cc:to:from:subject:message-id:date :content-type:mime-version:from:to:cc:subject:date:message-id :reply-to:content-type; bh=ow0gh1mmdygv9Aa1zDYMwfVwIzWsW3h0z63AOxRo408=; b=ZrNJ5hqjMuehnHAEJZagCTCbODXJ3psRNqRrKDEJj02FgxUopOaK/ynh6lTCbuQ1hY DzyImEbxVKIP7sMVVhmO9MGLdi+tVEtgvn8dXduhcgNUkLGX9jCHVDwGLSQKqVD+LlOL 7cEJKC0JTfcW1Pic7TsGOUinEnY4EygWBSIsdh+cnoIAti2NgMd4ODA27Oo8ce1B1ODE 9gL33lvTgNDD0oS0Z7YTXoI00tc9pLx9E6Mv13VpmMWLu5dhzvHXyRU0tJc7Ry8VGR31 gIQi6Fa1uD037OhkZAWEph2aN8CSw9ix6xQqsNTRPH1gecBjWLwWE27k+Fe0X4Bb4zpb 71sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795976412; x=1796581212; h=in-reply-to:references:cc:to:from:subject: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=ow0gh1mmdygv9Aa1zDYMwfVwIzWsW3h0z63AOxRo408=; b=QVgzZaqRo5OGdRysU8TsPmXRYHqssgkgDIWThWcbZeier3CyP0HzYBQvcBzGPbctGP wRjln4ps8xKKyYjuG/BNR4iYn6IrA9IOBZFaz+Nas3+NlvTEYPG2ZMhmHjJAorBDmDDH 59DPWAsCg4bdzMUubb4t/FwrVXIILMBNws15c1AH/dpXwViiIV8J+VMQujdVwrTRbza6 qV0cGPdb8tSQpGD5mYTbOf0zG5FFhVhlg6/BKiX9s51CCSxA6qnrzObM5Hu0/TRuHTuT 2IkozIYzjiBAM8HRZ9syaSAZQDfaQDYgacoA/fGiP+pgHdHLHxfM1hy5l7MZ5C8fR9af BdHQ== X-Forwarded-Encrypted: i=1; AL+hErEnm/gOSeJbdMM+lpB0pbKrEBjHTPF/e8d4dErspgfnOrvMlu4i/bh+JxPkrKi+fq/YLe96ZXGEsfk=@vger.kernel.org X-Gm-Message-State: APuU4Z/BcJ6rW7/DsMzzNSd1016ylz84RRWque8Iysf7AO7eB3BAT0gO xUfWPWlK9WB0NcyiYpfZURmbZq/6z4h3ZqHNjmIpMxQou3U8JxyZF/6C X-Gm-Gg: AZFdTZd9mJKprMOI7rTEBg7uqGQQ/anMk6JMhbcb5kXjrpizPlO/EU50JJ2LqKvk65S mNeLHf1slq5WEt4q6tfZbGIF/1c9Sm5d6zHNMnYdywxPCQx6JlVoUQWzEK+ZRogzx/eP88atNf7 AN5q84h7l1rwDiI/O5VaccfnVkiZfaiANlrxPLyaLqaRN49zUol3rVpVI7bScg65TddVmWWaIEM 7i65emPoXTA6R9Jtgq8f3/dIgB47U9mi+NudKJwj5MfS7rB2NCPdCchnGvrLWLYSadyi7jlnUOO +rWc0Gz3ytN6hE7esldf0gJUFYq+krjGcF5q7pPAvhkWARR6GZuf7H0SL+klgRoFbblAY5D9WUz s0guKAJwz2BU79hPm1fA7oatb2vpuBdgwjRwB7q7xzUGLEc9WfeM24icC+zxQTLo3l6GiUbHent Cm/9o/GgT8AKB347jFTwPs+q7Ai2fEuhasJWT2xceBYGBFX8kOwBhNlqMekFGsyu4+TCHxWD/kN Ggls/+sS09GaVX43Pgf4ZPjdHj9XJpfNNG9S7bpp+cKo9IREOyPkeSb07+53oHQQXAsL3f9GfBD 7+JHnd8moX1P6xHudLuSENi9DA== X-Received: by 2002:a05:600c:154e:b0:4a3:59ee:86b with SMTP id 5b1f17b1804b1-4bb887c3b63mr646170455e9.4.1795976411684; Sun, 29 Nov 2026 10:20:11 -0800 (PST) Received: from localhost ([2001:b07:5d26:7a6a:365a:60ff:fe0d:cfc6]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb884865b1sm885774235e9.5.2026.11.29.10.20.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 29 Nov 2026 10:20:10 -0800 (PST) X-Mailing-List: linux-nfs@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=7b0bd7f55c600d83f6b8122fba54f09b1885be508bfe8189a1af477ef183; micalg=pgp-sha512; protocol="application/pgp-signature" Date: Sun, 29 Nov 2026 19:20:02 +0100 Message-Id: Subject: Re: [PATCH v3 3/5] vfs: add COMPR/ENCRYPT xflags from FS_COMPR_FL/FS_ENCRYPT_FL From: "koraynilay" To: "Amir Goldstein" , "koraynilay" 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" , , , , , , , , , X-Mailer: aerc 0.22.0-0-gc2f86b7abde3 References: <20261129024233.2361718-1-koray.fra@gmail.com> <20261129024233.2361718-4-koray.fra@gmail.com> In-Reply-To: --7b0bd7f55c600d83f6b8122fba54f09b1885be508bfe8189a1af477ef183 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 On Sun Nov 29, 2026 at 11:11 AM CET, Amir Goldstein wrote: > On Sun, Nov 29, 2026 at 3:43=E2=80=AFAM koraynilay = wrote: >> > > "vfs: add COMPR/ENCRYPT xflags from FS_COMPR_FL/FS_ENCRYPT_FL" > > This is not the best description of this change. > > A better description would be > > "vfs: advertise COMPR/ENCRYPT xflags in file_getattr()" > > Which is exactly the behavior change that I asked you to spell out. > You spelled it out in the cover letter, but not here. Hmm ok yeah now I understand what you mean. I should make the commit more about "let userspace know we have these too" instead of just a "add missing flags". > The commit message should also mention FS_IOC_FSGETXATTR > but for brevity the subject above is enough. what about this? "vfs: fileattr: advertise COMPR/ENCRYPT xflags on get" and the masks patch could become: "vfs: fileattr: add xflags masks to internal and user API" > The commit message should also mention FS_IOC_FSGETXATTR (And I'll add this to the description) >> Introduce FS_XFLAG_COMPR and FS_XFLAG_ENCRYPT to be used in the vfs >> _masks API upgrade for fs/ntfs ([1] and newer versions). >> >> Following the FS_XFLAG_CASEFOLD example, put FS_XFLAG_COMPR in >> FS_XFLAG_RDONLY_MASK but not in FS_XFLAG_COMMON, since it's read-write >> for some filesystems and read-only for others, to avoid breaking >> existing filesystems. > > This sentence is very hard to understand, because it is missing some > important information. > The CASEFOLD flag (and now COMPR) is only read-write via the legacy > SETFLAGS ioctl and read-only via the xflag apis. > Also in your documentation patch, you list them as RO/RW which does not > fully convey this meaning. > Don't forget why you started this patch set - BTIME is also going to be R= O > on some fs and RW on others, but in a very different category than those = two. > >> >> Following the FS_XFLAG_VERITY example, put FS_XFLAG_ENCRYPT in >> FS_XFLAG_RDONLY_MASK and in FS_XFLAG_COMMON, since it's read-only for >> all filesystems. > > ... in all the uapi flavors. Hmm, yes, but I should mention both "uapi flavors" and "filesystems", since casefold can be toggled only with SETFLAGS, but not on all filesystems, while saying that ENCRYPT is read-only for all uapi flavours doesn't mean that no filesystems supports setting it (well, in this case that's true, but in general there could be a filesystem that decides to expose a FS-specific ioctl to enable/disable FS_XFLAG_ENCRYPT and that reports FS_XFLAG_ENCRYPT in fileattr_get). Anyway, I'll change the message to be more easily readable and mention these cases. >> >> Also update vfs fileattr_fill_* helpers to convert these two flags as >> well. > > That's backwards. It's not the "Also" it's the main dish, as my comment > about the patch subject implies. > There is no "Also" in this patch - it does one thing. Fair, will change that. >> >> Link: https://lore.kernel.org/20261122000856.536902-1-koray.fra@gmail.co= m/ [1] >> Assisted-by: Gemini:3.8-flash-high antigravity-cli-1.5.11 >> Signed-off-by: koraynilay >> --- >> fs/file_attr.c | 8 ++++++++ >> include/linux/fileattr.h | 7 ++++--- >> include/uapi/linux/fs.h | 2 ++ >> 3 files changed, 14 insertions(+), 3 deletions(-) >> >> diff --git a/fs/file_attr.c b/fs/file_attr.c >> index 5d3834f4405b..314d779e41d6 100644 >> --- a/fs/file_attr.c >> +++ b/fs/file_attr.c >> @@ -39,6 +39,10 @@ void fileattr_fill_xflags(struct file_kattr *fa, u32 = xflags) >> fa->flags |=3D FS_VERITY_FL; >> if (fa->fsx_xflags & FS_XFLAG_CASEFOLD) >> fa->flags |=3D FS_CASEFOLD_FL; >> + if (fa->fsx_xflags & FS_XFLAG_COMPR) >> + fa->flags |=3D FS_COMPR_FL; >> + if (fa->fsx_xflags & FS_XFLAG_ENCRYPT) >> + fa->flags |=3D FS_ENCRYPT_FL; >> } >> EXPORT_SYMBOL(fileattr_fill_xflags); >> >> @@ -71,6 +75,10 @@ void fileattr_fill_flags(struct file_kattr *fa, u32 f= lags) >> fa->fsx_xflags |=3D FS_XFLAG_VERITY; >> if (fa->flags & FS_CASEFOLD_FL) >> fa->fsx_xflags |=3D FS_XFLAG_CASEFOLD; >> + if (fa->flags & FS_COMPR_FL) >> + fa->fsx_xflags |=3D FS_XFLAG_COMPR; >> + if (fa->flags & FS_ENCRYPT_FL) >> + fa->fsx_xflags |=3D FS_XFLAG_ENCRYPT; >> } >> EXPORT_SYMBOL(fileattr_fill_flags); >> >> diff --git a/include/linux/fileattr.h b/include/linux/fileattr.h >> index fb158269b4ea..9a8de4190133 100644 >> --- a/include/linux/fileattr.h >> +++ b/include/linux/fileattr.h >> @@ -12,17 +12,18 @@ >> #define FS_COMMON_FL \ >> (FS_SYNC_FL | FS_IMMUTABLE_FL | FS_APPEND_FL | \ >> FS_NODUMP_FL | FS_NOATIME_FL | FS_DAX_FL | \ >> - FS_PROJINHERIT_FL | FS_VERITY_FL) >> + FS_PROJINHERIT_FL | FS_VERITY_FL | FS_ENCRYPT_FL) >> >> #define FS_XFLAG_COMMON \ >> (FS_XFLAG_SYNC | FS_XFLAG_IMMUTABLE | FS_XFLAG_APPEND | \ >> FS_XFLAG_NODUMP | FS_XFLAG_NOATIME | FS_XFLAG_DAX | \ >> - FS_XFLAG_PROJINHERIT | FS_XFLAG_VERITY) >> + FS_XFLAG_PROJINHERIT | FS_XFLAG_VERITY | FS_XFLAG_ENCRYPT) >> >> /* Read-only inode flags */ >> #define FS_XFLAG_RDONLY_MASK \ >> (FS_XFLAG_PREALLOC | FS_XFLAG_HASATTR | FS_XFLAG_VERITY | \ >> - FS_XFLAG_CASEFOLD | FS_XFLAG_CASENONPRESERVING) >> + FS_XFLAG_CASEFOLD | FS_XFLAG_CASENONPRESERVING | FS_XFLAG_ENCRY= PT | \ >> + FS_XFLAG_COMPR) >> > > The addition of FS_XFLAG_CASEFOLD in FS_XFLAG_RDONLY_MASK and not > in FS_XFLAG_COMMON left the code in a very fragile undocumented state whi= ch > took me personally a lot of time to figure out. > > Let's please document the meaning of these macros better. > I propose something like: > > /* > * FS_COMMON_FL/FS_XFLAG_COMMON are preserved through RMW > * cycle via either uapi flavor. > * They may NOT include flags which are read-write via one api flavor and > * read-only in another (e.g. CASEFOLD, COMPR). > */ > #define FS_XFLAG_COMMON \ > ... > > /* > * Read-only xflags via FS_IOC_FS[GS]ETXATTR and file_[gs]etattr(). > * The respective flags may be read-write via the FS_IOC_SETFLAGS ioctl. > */ > #define FS_XFLAG_RDONLY_MASK \ Yes I agree, I'll add these to v4. Thanks, koraynilay > Thanks, > Amir. --7b0bd7f55c600d83f6b8122fba54f09b1885be508bfe8189a1af477ef183 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQSgVimKafU5DQMcjcDmj22qf5IGXAUCawxs0gAKCRDmj22qf5IG XE1dAP9HI0MZWGxSqaDITJoPjScqEK8WFXh1aLfDEqxdIdw5nAD/eYQvju2L0qJy 7AOHwpAAlgClZZAtiXgEz6WmiPLzhQI= =NtbT -----END PGP SIGNATURE----- --7b0bd7f55c600d83f6b8122fba54f09b1885be508bfe8189a1af477ef183--