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=1793726874; b=YdggfLNCQFzoCNws4QVmWtOlwECgxx3YfdYIRZDOiXlNtg8X67W4ejC8UTrlKNL3Z+ai p3CofCHd4QY2CYrsLQ8mP93Gt3rbcCf8dJ/DUUxX4yKiN9ge1rScWkRwdu+Qt05+JfCcm heQbKhKAOnGORlxhxKmHOGFGbIbODFnnSUKZOMwOZVD2jmLDw9ghJ4Wh6yyS0W0lRdpbv cu8TVsT9Ku30n21tRJyRLRqtkUZVRm39TM4nexQKXQGCqHoVutRRjjQEyVvwbNoYb7wRx Z69A+mMzhnB0gdWpoeplhObB+2ISKNoRp8lOQxVgl5SBar90XqEZyW2icY+fmjt66Xg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793726874; 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=C7J2xwMhxMcLYQn+HgHArsLVIUvcNtC3sZDiMzWGQG0=; b=Dqpui6YSjE99W4tk08y4PrdMFm06i/cZqX2xHIppYwHT/W8BH7/zfqrTXXu9vGoOtsW0 +B/l6t1HUeZrX9sH9h0JfsyxhzgsjZtBiE7A01ph+tkkkNrZeej5OmPffSny7Vspuf7fe CkZbOeYesa3Bi8X/DjmYUbk2rGTHNlLRYGsgMuVlUOmdM3mfREeCmiLSjti7Ss37SsKFm /d06lbl1d2SSnLEIc7RsnqfYLr3UdfQq0Oo5SJmT8Td4KpWTeYa4uMKqAapgzbGwfrLnP Xg8etzq0fu15Lo6ZsVNwnjYfzl5erwqmYfnVrmX8wbIRG7HtDzQKGBIrT6BRhdCcBtg== 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=qvfk2p2C; 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 C2390606A32C for ; Tue, 3 Nov 2026 17:27:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C2390606A32C 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, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=qvfk2p2C Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-48e4831c028so3912013f8f.0 for ; Tue, 03 Nov 2026 09:27:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793726872; x=1794331672; 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=C7J2xwMhxMcLYQn+HgHArsLVIUvcNtC3sZDiMzWGQG0=; b=qvfk2p2C7RCe841ado8qfFCS9EjFtuex2WDROo9E1Fc+ZhltsWR8vV/rOq8z5I/k57 i3OGX0Wr2HUlX5zo0HJCLZs28lP+10Fth3SFAs8j1PknAVLmwsILnXxT75hbwpoj3mJz IYCPW01qa04mTijdJ4QJYJANkJ9seTSqhbYnwcHcZ35YfNGTk7XzMa2YjOrSZQ68spD9 +s8BYOoXJ+NdDhKHpkfxestZlteDvW1FVKYgK0L1ajglWzOoUcwAHlqS3XXE88Sz26Ne kKl3qzhacnH2H3er+WMxxp5rl8vZTDFab0IITU4dQil1PxAIXbLjlf2wr0tvFf9Wb6BA vszw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793726872; x=1794331672; 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=C7J2xwMhxMcLYQn+HgHArsLVIUvcNtC3sZDiMzWGQG0=; b=uMo6pdK+XPdhdRs+vGy2rtyJpUOOr3op+hxzV4hnt8DmHBXtoE4nzjxzX8JRZbfpTo 06Yr/LyobnoN1IpvGMuCA/dMg5ZbclZNN8e8qWQb4pLTbqfCz6k0/KWckWBbWmbjsryF UBtVwXf2CUQFqkKQ9SvQ+/Bkm96rIy1APk7d79Su8Ocp9CKPFXFPlybF0hkTU9tfHGf/ +NYS/bfjJXrqUWRfRXpQuYz5zyAqrMaEz+wMVYcmRR0Ax2v3/qqSS90wNFBR+mSWbLpK SSFdBH0UOLqU9gw1Vat8jLSzkKdwzrruBBRm8ZIPMNwyfmwmQ+ThzmqQZ534WRI8wGUm TGTQ== X-Forwarded-Encrypted: i=1; AKwUvBzbqoHoCEoMmvG4dLm35bOAAVEOC+Z5UoY2GfCnhZk03vRLLYcpO9erQgERjnYOZE41qazE2o7WSb261QQ=@vger.kernel.org X-Gm-Message-State: APuU4Z/bofnNHMBkj6t+N17UHWzOQp9cKTDfeXsu3UEPRS2YXZj210zg L3PR5WcwyiwDZy9KKhAUdBvnmvF489OW7+K5OBGDlb/uJaPzEOZaO4Xd X-Gm-Gg: AYBFou3+NPU1keRcXqJDTm7Cg30mMbJmWpI4hT2DBSUsGc67UcVAwbZAyJngtGHhS9F MYnm52RtdGB7TBrQf0yskztuAdftJ5ckt3B6fBwX77wkXWJ5k8vJcO3UuN58jzVizgmK+zhEiD4 4bEotORGna1JngIPEfqvOONy0S52XEm3MbNCHxp/X7HGJ+JlySe9N9QZ/CHKnccef9mPVy0FMVa L/cazUIZzzWU4dWa65SMS7Z5DVWBbN5br5HGxc7CnW4VS25UPXukOR3U9jM9C6tkCrBo/kKERRD WhODUVpAwGawMAHL3X0gaHFEVhDJn228pKpwi/YAH49scw06WWbgc3pUKvV45oU7v354wXnvSL2 q0aDW/3pMy9D6e5jfEYm+GuCix23rPhqPdzopaEuzhHQUzc1FYMePX8VNoBYheJu+bRihB5xc9m AzSxQqsOE0P3CxGw+hNAVMBwhhOoQDO+yYk1XsV8PeA5vjua0XrdaJLRiLwmlNPSFpsmZp/xCVx BYEgl5O4UgHn4ChTcpp+Gza6jFVzxG0B63f1w1FvR8BcdhehJJR1e3m71D4bp+6VU3+XCG7FVQw LyZLlB/yUgs53aBekIGRHspxV9HVCUII9K7FLrS02A3g5A== X-Received: by 2002:a05:6000:26c8:b0:48e:10a7:40f with SMTP id ffacd0b85a97d-48e6e302612mr29233891f8f.17.1793726872045; Tue, 03 Nov 2026 09:27:52 -0800 (PST) Received: from localhost ([151.60.201.12]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e71b728ddsm25764477f8f.9.2026.11.03.09.27.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Nov 2026 09:27:50 -0800 (PST) X-Mailing-List: linux-kernel@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=7bf7be77af3bb2ca970a31782cf12336c55eb4edcc365a7f2b8809684642; micalg=pgp-sha512; protocol="application/pgp-signature" Date: Tue, 03 Nov 2026 18:27:48 +0100 Message-Id: Cc: "David Sterba" , "Alexander Viro" , "Christian Brauner" , "Namjae Jeon" , "Sungjong Seo" , "Konstantin Komarov" , "Chris Mason" , "Jan Kara" , "Yuezhang Mo" , "Chuck Lever" , "Darrick J . Wong" , "Sean Smith" , "Andrey Albershteyn" , "Pedro Falcato" , =?utf-8?q?Pali_Roh=C3=A1r?= , , , , , , Subject: Re: [RFC PATCH v3 1/5] vfs: add provenance time (ptime) From: "koraynilay" To: "Amir Goldstein" , "koraynilay" X-Mailer: aerc 0.22.0-0-gc2f86b7abde3 References: <20261101015551.786044-1-koray.fra@gmail.com> <20261101015551.786044-2-koray.fra@gmail.com> In-Reply-To: --7bf7be77af3bb2ca970a31782cf12336c55eb4edcc365a7f2b8809684642 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 On Tue Nov 3, 2026 at 4:14 PM CET, Amir Goldstein wrote: > On Tue, Nov 3, 2026 at 12:13=E2=80=AFPM koraynilay = wrote: >> >> On Mon Nov 2, 2026 at 3:00 PM CET, Amir Goldstein wrote: >> > On Sun, Nov 1, 2026 at 2:57=E2=80=AFAM koraynilay wrote: >> >> >> >> Add provenance time (ptime), indicating the time when a file or >> >> directory was created. This is user-settable via file_setattr() and >> >> retrievable via statx(2) (using STATX_PTIME) or file_getattr(). >> >> >> >> The semantics of when to preserve this new timestamp are the same as >> >> mtime, the idea being that there is a correspondence like this: >> >> >> >> ctime <-> btime >> >> mtime <-> ptime >> >> >> >> so every operation (copying, moving, ...) that currently preserves mt= ime >> >> should also preserve ptime. >> >> >> >> Furthermore, in order to avoid the legacy FS_IOC_FSSETXATTR accepting >> >> FS_XFLAG_PTIME, add an FS_FILE_ATTR_XFLAGS_MASK mask to support new >> >> xflags, and use it in fileattr_to_file_attr()/file_attr_to_fileattr()= to >> >> allow ptime to be used with the file_setattr()/file_getattr() syscall= s. >> >> >> >> [ This is a re-implementation of the initial patch[1] by Sean Smith >> >> , following the advice[2] from Darrick= J. >> >> Wong of using file_setattr() instead of updatin= g >> >> utimensat() ] >> >> >> >> [1]: https://lore.kernel.org/20260405195007.1306-2-DefendTheDisabled@= gmail.com >> >> [2]: https://lore.kernel.org/20260407014129.GC6192@frogsfrogsfrogs >> >> >> >> Assisted-by: Gemini:3.8-flash-high antigravity-cli-1.4.7 >> >> Signed-off-by: koraynilay >> >> --- >> >> fs/file_attr.c | 33 +++++++++++++++++++++++++++++++-- >> >> fs/stat.c | 2 ++ >> >> include/linux/fileattr.h | 5 +++++ >> >> include/linux/stat.h | 1 + >> >> include/uapi/linux/fs.h | 8 +++++++- >> >> include/uapi/linux/stat.h | 7 ++++++- >> >> 6 files changed, 52 insertions(+), 4 deletions(-) >> >> >> >> diff --git a/fs/file_attr.c b/fs/file_attr.c >> >> index 833e03810b24..c0645cb22bf3 100644 >> >> --- a/fs/file_attr.c >> >> +++ b/fs/file_attr.c >> >> @@ -102,7 +102,7 @@ EXPORT_SYMBOL(vfs_fileattr_get); >> >> static void fileattr_to_file_attr(const struct file_kattr *fa, >> >> struct file_attr *fattr) >> >> { >> >> - __u32 mask =3D FS_XFLAGS_MASK; >> >> + __u32 mask =3D FS_FILE_ATTR_XFLAGS_MASK; >> >> >> >> memset(fattr, 0, sizeof(struct file_attr)); >> >> fattr->fa_xflags =3D fa->fsx_xflags & mask; >> >> @@ -110,6 +110,8 @@ static void fileattr_to_file_attr(const struct fi= le_kattr *fa, >> >> fattr->fa_nextents =3D fa->fsx_nextents; >> >> fattr->fa_projid =3D fa->fsx_projid; >> >> fattr->fa_cowextsize =3D fa->fsx_cowextsize; >> >> + fattr->fa_ptime_sec =3D fa->fsx_ptime.tv_sec; >> >> + fattr->fa_ptime_nsec =3D fa->fsx_ptime.tv_nsec; >> >> } >> >> >> >> /** >> >> @@ -141,15 +143,20 @@ EXPORT_SYMBOL(copy_fsxattr_to_user); >> >> static int file_attr_to_fileattr(const struct file_attr *fattr, >> >> struct file_kattr *fa) >> >> { >> >> - __u64 mask =3D FS_XFLAGS_MASK; >> >> + __u64 mask =3D FS_FILE_ATTR_XFLAGS_MASK; >> > >> > That is not the correct way to extend this API. >> > This fixed mask was added as a placeholder for >> > "We intend to add support for more xflags to selective filesystems": >> > https://lore.kernel.org/linux-fsdevel/20250329143312.1350603-2-amir73i= l@gmail.com/ >> > >> > Please see this POC patch for filesystems to publish their supported >> > xflags mask: >> > https://lore.kernel.org/linux-fsdevel/20250329143312.1350603-3-amir73i= l@gmail.com/ >> >> Thanks, I did not think of adding a dynamic mask like that, I will look >> into it and implement it for v4. >> >> > This will allow callers of file_getattr() to know if the filesystem >> > supports ptime >> > without trying to set it and failing. >> >> So after adding fsx_xflags_mask to file_kattr, every filesystem would >> populate fsx_xflags_mask with all the returned (=3D=3D supported) FS_XFL= AG_* >> in their own specific .fileattr_get, correct? > > Not all filesystems. Just the ones that wish to extend the constant > legacy FS_XFLAGS_MASK. > So just the ones that you change to support XFLAGS_PTIME Ah ok yeah that makes more sense, so like the fileattr_has_fsx_mask() (that checks if fa has fsx, ignoring the suppored/allowed ones specified as second arg) that I added, but in the opposite way: "I advertise only the extra fsx (so only 0 or FS_XFLAG_PTIME rn) that I support". Thanks, koraynilay > Thanks, > Amir. --7bf7be77af3bb2ca970a31782cf12336c55eb4edcc365a7f2b8809684642 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRJ2XvJtXGwULYEerQ0bnTtJTDoOAUCauoZlAAKCRA0bnTtJTDo OBnVAP9J2oe3Q/z4+CIvNcDvvOtFdyX98jyvuqmiHKySHzb6XAD+N8QVNASksB7a or/C2uBDgyHnZr93FRknmz2MMzGnvwQ= =0YAO -----END PGP SIGNATURE----- --7bf7be77af3bb2ca970a31782cf12336c55eb4edcc365a7f2b8809684642--