[PATCH v4 00/12] ntfs: support O_TMPFILE
From: Baolin Liu
Date: Sun Nov 15 2026 - 08:27:18 EST
From: Baolin Liu <liubaolin@xxxxxxxxxx>
This series adds O_TMPFILE support to fs/ntfs. Applications can prepare
a regular file's data and metadata before publishing it with linkat().
Unpublished files are reclaimed when their last reference is released;
O_EXCL prevents publication.
Patches 1-4 fix creation rollback; patch 5 moves ACL initialization after
MFT allocation. Patches 6-7 fix large ACL reads and cold-cache ACL lookup.
These changes make inherited ACLs persistent and clean up failed creation.
Patches 8-9 preserve timestamps and packed EA size when publishing a file.
Patch 10 writes internal attributes before zero-link inode eviction.
Patch 11 flushes previously dirtied attributes before ordinary unlink or
rename-overwrite; patch 12 adds anonymous creation. The five v3 patches
are now numbered 5, 8, 9, 10 and 12.
Changes since v3:
- Include the six cleanup and ACL lookup fixes to address the review
concerns about the creation path.
- Also fix the preexisting loss of dirty internal attributes on unlink:
flush before removing names, rescan under the MFT locks, and return
writeback errors before changing the namespace.
- Guard writeback with I_CREATING after failed creation clears I_NEW.
- Check the attribute inode's own link count for synchronous writes and
conversion, since it can remain zero after the base file is published.
- Rebase onto b028412297e6, which includes Wahid Khan's named-stream v9.
Retain its NOWAIT and zero-link protections and propagate conversion
I/O errors while skipping busy candidates.
- Add Fixes tags. Drop Reviewed-by from the changed ACL initialization
patch; retain it on the unchanged hard-link, packed-EA and O_TMPFILE
code. The FILE_NAME/index ctime update requested in v1 review is retained.
The final series was tested in QEMU with four CPUs, NTFS debug and lockdep.
generic/004 and generic/389 passed, along with creation, publication,
cleanup, permissions, idmapped mounts, EAs, streams, mmap, direct I/O,
concurrency, full-volume retries, and persistence checks.
Unlink and rename-overwrite preserved dirty EAs with 512-byte/4 KiB/8 KiB
clusters. Directory removal/replacement, hard links and concurrent EA/fsync
tests passed. Injected EA writeback EIO left names and link counts unchanged;
writing new data and retrying succeeded.
Earlier validation of the preceding fixes covered cold-cache/large ACLs,
1536 injected creation failures, offline reclamation, failed-creation
writeback, publication with a retained zero-link EA inode, SD/EA conversion
and block-write EIO, and the named-stream conversion paths. These patches
are unchanged in this update. Test-only hooks are not included.
v3: https://lore.kernel.org/r/20261106063059.2904988-1-liubaolin12138@xxxxxxx
v3 review: https://sashiko.dev/#/patchset/20261106063059.2904988-1-liubaolin12138%40163.com
Baolin Liu (5):
ntfs: initialize inherited ACLs after allocating the MFT record
ntfs: read ACLs using their stored size
ntfs: load uncached ACLs through get_inode_acl
ntfs: flush internal attributes before unlinking a file
ntfs: support O_TMPFILE
Dandan Wu (2):
ntfs: return zero after removing nonresident attributes
ntfs: discard attribute inodes after failed initialization
Xuewen Wang (5):
ntfs: discard reparse attributes when creation fails
ntfs: remove remaining attribute lists on creation failure
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/attrib.c | 72 ++++++++-
fs/ntfs/ea.c | 23 +--
fs/ntfs/ea.h | 3 +-
fs/ntfs/file.c | 4 +-
fs/ntfs/inode.c | 14 ++
fs/ntfs/namei.c | 227 ++++++++++++++++++++++++-----
7 files changed, 304 insertions(+), 54 deletions(-)
base-commit: b028412297e640db52195df2649368c1910e8e4b