{"id":2220010,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2220010/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20260405195007.1306-4-DefendTheDisabled@gmail.com/","project":{"id":8,"url":"http://patchwork.ozlabs.org/api/1.2/projects/8/?format=json","name":"Linux ext4 filesystem development","link_name":"linux-ext4","list_id":"linux-ext4.vger.kernel.org","list_email":"linux-ext4@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260405195007.1306-4-DefendTheDisabled@gmail.com>","list_archive_url":null,"date":"2026-04-05T19:49:59","name":"[3/6] ntfs3: map ptime to NTFS creation time with rename-over","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"97d39b44b306eef479bb73dcee69a7d6c3e41327","submitter":{"id":93064,"url":"http://patchwork.ozlabs.org/api/1.2/people/93064/?format=json","name":"Sean Smith","email":"defendthedisabled@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20260405195007.1306-4-DefendTheDisabled@gmail.com/mbox/","series":[{"id":498804,"url":"http://patchwork.ozlabs.org/api/1.2/series/498804/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/list/?series=498804","date":"2026-04-05T19:49:56","name":"provenance_time (ptime): a new settable timestamp for cross-filesystem provenance","version":1,"mbox":"http://patchwork.ozlabs.org/series/498804/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2220010/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2220010/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <SRS0=a4oE=CE=vger.kernel.org=linux-ext4+bounces-15645-patchwork-incoming=ozlabs.org@ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-ext4@vger.kernel.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","patchwork-incoming@ozlabs.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=EVXrs8bm;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;\n envelope-from=srs0=a4oe=ce=vger.kernel.org=linux-ext4+bounces-15645-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)","gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c09:e001:a7::12fc:5321\"\n arc.chain=subspace.kernel.org","gandalf.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","gandalf.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=EVXrs8bm;\n\tdkim-atps=neutral","gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c09:e001:a7::12fc:5321; helo=sto.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15645-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"EVXrs8bm\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.167.179","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com"],"Received":["from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fpjkk28Nqz1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 06 Apr 2026 05:51:10 +1000 (AEST)","from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4fpjkk1cV5z4wCm\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 06 Apr 2026 05:51:10 +1000 (AEST)","by gandalf.ozlabs.org (Postfix)\n\tid 4fpjkk1VfKz4wF0; Mon, 06 Apr 2026 05:51:10 +1000 (AEST)","from sto.lore.kernel.org (sto.lore.kernel.org\n [IPv6:2600:3c09:e001:a7::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4fpjkf4K8rz4wCm\n\tfor <patchwork-incoming@ozlabs.org>; Mon, 06 Apr 2026 05:51:06 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id 2B1063000097\n\tfor <patchwork-incoming@ozlabs.org>; Sun,  5 Apr 2026 19:50:46 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 5F5C4381AF2;\n\tSun,  5 Apr 2026 19:50:40 +0000 (UTC)","from mail-oi1-f179.google.com (mail-oi1-f179.google.com\n [209.85.167.179])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id D525E381AEF\n\tfor <linux-ext4@vger.kernel.org>; Sun,  5 Apr 2026 19:50:38 +0000 (UTC)","by mail-oi1-f179.google.com with SMTP id\n 5614622812f47-464bc03efd8so1642569b6e.2\n        for <linux-ext4@vger.kernel.org>;\n Sun, 05 Apr 2026 12:50:38 -0700 (PDT)","from localhost.localdomain (c-73-5-99-191.hsd1.la.comcast.net.\n [73.5.99.191])\n        by smtp.gmail.com with ESMTPSA id\n 5614622812f47-46f46160155sm4547428b6e.17.2026.04.05.12.50.34\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Sun, 05 Apr 2026 12:50:36 -0700 (PDT)"],"ARC-Seal":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1775418670; cv=pass;\n\tb=G8vklvTlu9T/rYb4OkRR2IBguPAKVvblH9yzQfSfB/tgkhS67SoIH7rjIfmPXeYs9UgNnjyMmNgBosnG6+Ue8MWxFBQhJOJRMIgFDckC2AwPDfRZZBgHvxen2vgBNn1269F92YQB58/VIPcpUR57XvhDTI0P6S2c8IMKr9lXKKvPMlVUuVg1DR9OqKfbnOXxosHirSGncWt+tW+mvNUnq9pQHmZcyd0bdjvWkwYQ4IWdX0q2r6A2A/5yMbJcu+8PJcJZerWnkM27p+bcBc7NifVblNmXds97xAsM9DKgIGunHDt2AkVcnJJ/8DUCKuaBP/mnj2TXCCgftjRi1Q9Icg==","i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775418640; cv=none;\n b=o83jYU9q9crOSWOFenOYhrET65gm3yUQAh2zCp5Jcijsv+yNU8FPpMtlWsxyBOxRg6OCSJMAOr2Bu8FWW2hLuRNftuVrTiGJTqBwQJJkeMTjI9/CC2T6rqmJNSII0lz4C84LCXcr8wEx9DQOhMIngaqfVkYPujR9g6+1jeMuyNo="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1775418670; c=relaxed/relaxed;\n\tbh=8YfcbYnu/pMQdwPjkXzXqWwSF71Fmf6slXoGMkRuceU=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=jLSGVgPlM9BIrKG9PTxkqjeRkAgxnu6+woCzhtu3tZP/qsTNIY0YkgeHkcSg/bi3TkST9/Qp2bEr1brQoTyeBm55WN61t7zNdUQwooIFYx5sb2fN+d93srkKX6A1K0zuHrZVhGKv+QSbGBqEeHDx+3GFaD2OoC0yVh010wfqjiy8dfOcXmXhnfCNSgd/KlYCf/ATc6WY+aOdA4t4EDd+GV8P0fFclt+eh0qJYLcqCbOOmUvcpS0Yr/N/KmEnh+R+Ye9H0kKdrWrjRXX9BuaMnu+89lLus2fnkpPbMYcRsNwLVJLHbbNMW6BVGorrj0Sl5sbYGG11l/GDKtUZg50VRg==","i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775418640; c=relaxed/simple;\n\tbh=hU9BEcBtU1BBLNMoyk+Hth5Nr+ssFTdxV7hM11OlEK8=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=uX3re5dEODeTnQLuQ7RJOm9WFRucAbKoUUrc34/8XKGI9+Dmhdngv6pixbxd4O4rA6N7aVgWUzyFjgFOZhs0NTZMtN+ZTnk+V2B81zfZyo4OiQgDkxmcn+SyERPn1vK/CAfk81I0MDeSmBKcpkmiOur9fzxV+rGEwZEf+eD2pDk="],"ARC-Authentication-Results":["i=2; gandalf.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com; dkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=EVXrs8bm; dkim-atps=neutral;\n spf=pass (client-ip=2600:3c09:e001:a7::12fc:5321; helo=sto.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15645-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org","i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=EVXrs8bm; arc=none smtp.client-ip=209.85.167.179"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1775418638; x=1776023438;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=8YfcbYnu/pMQdwPjkXzXqWwSF71Fmf6slXoGMkRuceU=;\n        b=EVXrs8bmHgO5s1t90z3Eg+M08P1oG8LrWnRCgXbjTfDMCRDKHcHznXQIsEr8SaYN2V\n         jynu10b89Jm8Xtk5/TelCEnVUsbUEbbK0I5anXQjsuIegtGQR9dLqSPB/wPJn9oHPgcg\n         ho9znGnNCmJKeu4INjVpi/1+6LT4IO5xLcnCkD31QwuIl5UVGsLBpVi1GaOvTQ+//Ejq\n         BWeEwYqj0YmOPSqZ/5IpuZOav4vxXJ7wUTD8Ba//k4MGi4cGxTU5X30PHG+DlvR91H24\n         utNwxCv+gYX3zqC81ePRIlWdDBvzENw2reukDwk15K+wD9MSIyLNaVxfpqMHjlEBGCee\n         oteA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1775418638; x=1776023438;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n         :to:cc:subject:date:message-id:reply-to;\n        bh=8YfcbYnu/pMQdwPjkXzXqWwSF71Fmf6slXoGMkRuceU=;\n        b=tRdIyn1k75cQ5XNILHwSpR/DRmTaLyyljTqPuspweWZxgWft316F7ZFtTEQLp7Hqci\n         8OFIM/X/fqtzhqQ10ppNbq53c0HBcndbqkEZXBLxHRpecAF6ckRut8Kgi9isf/wQZXt1\n         2HD5j/mVmdPrtFzqDcEds858paqpqbgqQecMTOARR0i6Y2ofKSnTj9JLNqb2AM3cwUGm\n         /t0RIYV8eSWruwTjlNH0TA52SpUbNax2or1fOCuiceieKSqVE7/3aEM2JlQAQ0ggpTlf\n         lvN90hEXaE5PzziJuX/dJbUxEJJlXtVvP2rCQjYSMvMVgh1R18olPIwfM8BYDC6WBrup\n         YArA==","X-Gm-Message-State":"AOJu0YzF1Y4gPRPZ3eu00F6xmc5jb+zalAPT2iZq9d7FLQ7YhKcHdwm4\n\tcBhVzWJ8jZwc6I5agD5kl8X7iNLNgOHjd6XetG/DEfyVoHVEfQ3ADDjSSpszQlJg","X-Gm-Gg":"AeBDievn2c59A1ka1ZK8q1l0F1wEIV4D0VHsao2fIaVNX0AcG6KBR0Y/AFzMEgye9xJ\n\tblPbyvdckwvnlXM5JtuqFhs2j8rj6fqjRrN7Ht/Mabk6H0Z+BCf9G2yl8IYuoINVsv0Ospj9LGg\n\txMJGUa/2Mt7C+Sw6xqM6Zwu25wIQLdHgHroMaPvqpJQH33dOVtMdESrBFsMzFQzEJU2eq26STXO\n\txvUlt0T9MKnw3/oULLMzUwUDXaYZGTSiI1ZOX0JY96plqaWdEnV65hQgeLj1xF9YHSSa+tZjxL8\n\tz10p5uh99kGSksefwcdmjq9i2w9OiCqRY821+pJgA8fFGOX2bgMA6xuPa/f1EUpkmxf5JdUGS/j\n\tuMhQCegBbyXTiaCN3xS6YqsoUDNSF1OGxLPj7+FTgfklJ1zbOcqSIC275Lin9XoSVpVmWb3hyvx\n\te5g0BlD8SRCiqEGp1WBcC31GKSVhLNI0Llxh4Ob6FKPjln9vL/Env5+QWM6M+tyTfm8E1VvjQON\n\tvCuBByUmAbsv/U=","X-Received":"by 2002:a05:6808:1903:b0:467:46e7:e6fd with SMTP id\n 5614622812f47-46efb1cf743mr5361782b6e.35.1775418637761;\n        Sun, 05 Apr 2026 12:50:37 -0700 (PDT)","From":"Sean Smith <defendthedisabled@gmail.com>","X-Google-Original-From":"Sean Smith <DefendTheDisabled@gmail.com>","To":"linux-fsdevel@vger.kernel.org","Cc":"linux-ext4@vger.kernel.org,\n\tlinux-btrfs@vger.kernel.org,\n\ttytso@mit.edu,\n\tdsterba@suse.com,\n\tdavid@fromorbit.com,\n\tbrauner@kernel.org,\n\tosandov@osandov.com,\n\talmaz@kernel.org,\n\thirofumi@mail.parknet.co.jp,\n\tlinkinjeon@kernel.org,\n\tSean Smith <DefendTheDisabled@gmail.com>","Subject":"[PATCH 3/6] ntfs3: map ptime to NTFS creation time with rename-over","Date":"Sun,  5 Apr 2026 14:49:59 -0500","Message-ID":"<20260405195007.1306-4-DefendTheDisabled@gmail.com>","X-Mailer":"git-send-email 2.51.0.windows.1","In-Reply-To":"<20260405195007.1306-1-DefendTheDisabled@gmail.com>","References":"<20260405195007.1306-1-DefendTheDisabled@gmail.com>","Precedence":"bulk","X-Mailing-List":"linux-ext4@vger.kernel.org","List-Id":"<linux-ext4.vger.kernel.org>","List-Subscribe":"<mailto:linux-ext4+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-ext4+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Spam-Status":"No, score=-1.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,\n\tFREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,\n\tMAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=disabled\n\tversion=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org"},"content":"Map ptime to the NTFS Date Created field in $STANDARD_INFORMATION.\nThis is a mapped-ptime implementation: setting ptime overwrites the\ncreation time. Justified because Windows treats NTFS creation time\nas mutable via SetFileTime() - it was never truly immutable.\n\nGetattr: report NTFS creation time as ptime.\nSetattr: write ptime to NTFS creation time via frecord cr_time path.\nRename-over: save target creation time before unlink, restore to\n  source after rename. Replicates Windows behavior where creation\n  time survives application atomic saves.\n\nRound-trip: NTFS Date Created -> Btrfs ptime -> NTFS Date Created\npreserves the original creation date through cross-FS copies.\n\nSigned-off-by: Sean Smith <DefendTheDisabled@gmail.com>\n---\n fs/ntfs3/file.c    | 13 +++++++++++++\n fs/ntfs3/frecord.c |  8 ++++++++\n fs/ntfs3/namei.c   | 14 ++++++++++++++\n 3 files changed, 35 insertions(+)","diff":"diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c\nindex 13d014b87..8688a48b1 100644\n--- a/fs/ntfs3/file.c\n+++ b/fs/ntfs3/file.c\n@@ -161,6 +161,13 @@ int ntfs_getattr(struct mnt_idmap *idmap, const struct path *path,\n \n \tstat->result_mask |= STATX_BTIME;\n \tstat->btime = ni->i_crtime;\n+\n+\t/* Map NTFS creation time to ptime (provenance time) */\n+\tif (request_mask & STATX_PTIME) {\n+\t\tstat->ptime = ni->i_crtime;\n+\t\tstat->result_mask |= STATX_PTIME;\n+\t}\n+\n \tstat->blksize = ni->mi.sbi->cluster_size; /* 512, 1K, ..., 2M */\n \n \tif (inode->i_flags & S_IMMUTABLE)\n@@ -857,6 +864,12 @@ int ntfs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,\n \t\ti_size_write(inode, newsize);\n \t}\n \n+\t/* Accept ptime and store as NTFS creation time */\n+\tif (ia_valid & ATTR_PTIME) {\n+\t\tni->i_crtime = attr->ia_ptime;\n+\t\tni->ni_flags |= NI_FLAG_UPDATE_PARENT;\n+\t}\n+\n \tsetattr_copy(idmap, inode, attr);\n \n \tif (mode != inode->i_mode) {\ndiff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c\nindex d5bbd47e1..b164b2f50 100644\n--- a/fs/ntfs3/frecord.c\n+++ b/fs/ntfs3/frecord.c\n@@ -3197,6 +3197,14 @@ int ni_write_inode(struct inode *inode, int sync, const char *hint)\n \t\t\tmodified = true;\n \t\t}\n \n+\t\t/* Write creation time (ptime maps to NTFS cr_time) */\n+\t\tts = ni->i_crtime;\n+\t\tdup.cr_time = kernel2nt(&ts);\n+\t\tif (std->cr_time != dup.cr_time) {\n+\t\t\tstd->cr_time = dup.cr_time;\n+\t\t\tmodified = true;\n+\t\t}\n+\n \t\tdup.fa = ni->std_fa;\n \t\tif (std->fa != dup.fa) {\n \t\t\tstd->fa = dup.fa;\ndiff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c\nindex b2af8f695..40d06884f 100644\n--- a/fs/ntfs3/namei.c\n+++ b/fs/ntfs3/namei.c\n@@ -292,6 +292,16 @@ static int ntfs_rename(struct mnt_idmap *idmap, struct inode *dir,\n \t\treturn -EINVAL;\n \t}\n \n+\t/* ptime rename-over: save target creation time before unlink */\n+\tstruct timespec64 saved_crtime = {};\n+\tbool inherit_crtime = false;\n+\n+\tif (new_inode && S_ISREG(inode->i_mode) &&\n+\t    S_ISREG(new_inode->i_mode) && inode->i_nlink == 1) {\n+\t\tsaved_crtime = ntfs_i(new_inode)->i_crtime;\n+\t\tinherit_crtime = true;\n+\t}\n+\n \tif (new_inode) {\n \t\t/* Target name exists. Unlink it. */\n \t\tdget(new_dentry);\n@@ -330,6 +340,10 @@ static int ntfs_rename(struct mnt_idmap *idmap, struct inode *dir,\n \n \terr = ni_rename(dir_ni, new_dir_ni, ni, de, new_de);\n \tif (!err) {\n+\t\t/* ptime rename-over: inherit target creation time */\n+\t\tif (inherit_crtime)\n+\t\t\tni->i_crtime = saved_crtime;\n+\n \t\tsimple_rename_timestamp(dir, dentry, new_dir, new_dentry);\n \t\tmark_inode_dirty(inode);\n \t\tmark_inode_dirty(dir);\n","prefixes":["3/6"]}