Re: [PATCH v2 0/5] ntfs: support O_TMPFILE

From: Hyunchul Lee

Date: Wed Nov 04 2026 - 02:04:24 EST


This series look good to me.

Reviewed-by: Hyunchul Lee <hyc.lee@xxxxxxxxx>

On Sat, Oct 31, 2026 at 01:28:52PM +0800, Baolin Liu wrote:
> From: Baolin Liu <liubaolin@xxxxxxxxxx>
>
> This series adds O_TMPFILE support to fs/ntfs. Applications can prepare a
> regular file's contents and metadata before publishing it with linkat().
> Unpublished files are reclaimed when their last reference is released.
> O_EXCL prevents publication.
>
> The series keeps the same five changes and ordering as v1:
>
> 1. Initialize inherited ACLs after allocating the new MFT record.
> Anonymous creation needs its inherited ACL stored before returning.
> 2. Preserve prepared atime and mtime when publishing the inode through
> the hard-link path.
> 3. Initialize the new FILE_NAME's packed EA size, since a temporary
> file may already have EAs when it is published.
> 4. Complete unlinked-file attribute writes before dropping the cache,
> including nonresident EAs prepared before publication.
> 5. Add O_TMPFILE creation and publication support.
>
> As requested in review, patch 2 gives the new FILE_NAME and directory
> index entry the same ctime as the inode. The inode ctime is updated only
> after the link succeeds. Patch 1 also initializes a newly created
> FILE_NAME's ctime after inherited ACL setup, fixing a timestamp mismatch
> caused by moving ACL initialization later in v1.
>
> While implementing and testing O_TMPFILE, we also found pre-existing
> NTFS bugs in attribute rollback and ACL lookup. These include stale
> attribute inodes left cached after failed creation, which can cause
> subsequent creation to return EIO even after space is freed, incorrect
> ACL inheritance when the default ACL is not cached, and a fixed-size
> read buffer that cannot handle larger ACL values. The underlying bugs
> predate this series.
>
> To keep this series focused on O_TMPFILE support and the v1 review
> feedback, we are leaving these existing bugs to a separate bug-fix
> series. We plan to submit those fixes after this series is accepted and
> merged. These issues remain present with this series applied.
>
> Tested this five-patch series in QEMU with four CPUs, NTFS debug and
> lockdep enabled. The requested unchanged xfstests generic/004 and
> generic/389 passed. Tests covered creation, publication, last-reference
> cleanup, O_EXCL, normal idmapped ownership, named streams, nonresident
> EAs, direct I/O, mmap, allocation and concurrent publication. Published
> data and metadata were checked after cache eviction, remount and reboot.
> Offline inspection compared hard-link ctime in STANDARD_INFORMATION,
> the new FILE_NAME and the directory index.
>
> Changes in v2:
> - Update FILE_NAME and index ctime as requested in review.
> - Set the source inode ctime only after successful hard-link creation.
> - Initialize creation FILE_NAME ctime after inherited ACL setup.
> - Run generic/004 and generic/389 on the standalone five-patch series.
> - Rebase onto ntfs-next commit
> 564c7753647731d19170914c1c637d3b33d88d3b, including the const mnt_idmap
> tmpfile callback signature and documentation context.
> - Resolve patch 1 against the updated early ACL error handling in
> __ntfs_create(); the relocated ACL failure still uses MFT/EA rollback.
> - Keep the original five-patch scope; submit fixes for the pre-existing
> attribute rollback and ACL lookup bugs separately after this series
> is merged.
> - No functional changes to patches 3 and 4.
>
> Thanks,
> Baolin
>
> Baolin Liu (2):
> ntfs: initialize inherited ACLs after allocating the MFT record
> ntfs: support O_TMPFILE
>
> Xuewen Wang (3):
> ntfs: preserve timestamps when creating hard links
> ntfs: initialize packed EA size when creating hard links
> ntfs: write unlinked file attributes before dropping their cache
>
> Documentation/filesystems/ntfs.rst | 15 ++++
> fs/ntfs/inode.c | 8 ++
> fs/ntfs/namei.c | 140 +++++++++++++++++++++++------
> 3 files changed, 136 insertions(+), 27 deletions(-)
>
>
> base-commit: 564c7753647731d19170914c1c637d3b33d88d3b
>
>

--
Thanks,
Hyunchul