mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 0/5] ntfs: support O_TMPFILE
@ 2026-10-27  9:35 Baolin Liu
  2026-10-27  9:35 ` [PATCH v1 1/5] ntfs: initialize inherited ACLs after allocating the MFT record Baolin Liu
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Baolin Liu @ 2026-10-27  9:35 UTC (permalink / raw)
  To: linkinjeon, hyc.lee; +Cc: ntfs, linux-kernel, Baolin Liu

From: Baolin Liu <liubaolin@kylinos.cn>

Hi all,

This series adds O_TMPFILE support to fs/ntfs. Applications can prepare a
regular file's contents and metadata without exposing a directory entry,
then publish the file with linkat(). Unpublished files are reclaimed when
their last reference is released. O_EXCL prevents publication.

O_TMPFILE reuses the existing inode creation, EA update and hard-link
paths. The first four patches fix existing bugs in those paths, so that
anonymous files can inherit ACLs, prepare metadata and be published
correctly:

  1. ACLs must be initialized after allocating the MFT record. Otherwise,
     an inherited ACL can appear correct in memory but disappear after
     inode eviction. Anonymous creation uses the same initialization
     path as ordinary file creation.

  2. Publication through linkat() must preserve the file's atime and
     mtime. The existing hard-link path resets both; the fix updates only
     the required timestamps and marks the affected inodes dirty.

  3. Files may already have ACLs or other EAs before publication. The
     hard-link path currently leaves the new FILE_NAME's packed EA size
     at zero. Initialize it from EA_INFORMATION when adding the link.

  4. Attribute inodes initialized while the base file has zero links
     also have zero links. They are evicted at the final iput(), discarding
     dirty pages from nonresident EA writes. Synchronous nonresident
     writes keep a successful EA update readable after that cache is dropped.

These bugs also affect ordinary creation, hard links and open-unlinked
files. Keeping the fixes separate allows independent review and use
without O_TMPFILE. Patch 5 builds on them to add anonymous creation,
VFS-controlled publication and documentation.

Named-stream ioctls can create or open streams after publication, but
not while the temporary file remains unpublished.

Tested this five-patch series in QEMU with four CPUs, NTFS debug and
lockdep. Tests cover creation, publication, permissions, idmapped mounts,
direct I/O, mmap, allocation, concurrent publication and ENOSPC. Checks
after cache eviction/remount/reboot covered file contents, EA values,
access ACL readability, mode and explicitly set atime/mtime. Injected
ENOSPC at five creation/publication/open sites and checked failure
behavior and release of the recorded base MFT records. Ordinary file
operations were also exercised. Individual patch notes describe the tests.

Based on ntfs-next commit e845077350df3862c733ed10a950d49ef4d64b0c.

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                    | 123 ++++++++++++++++++++++++-----
 3 files changed, 126 insertions(+), 20 deletions(-)


base-commit: e845077350df3862c733ed10a950d49ef4d64b0c


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-10-29  1:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-27  9:35 [PATCH v1 0/5] ntfs: support O_TMPFILE Baolin Liu
2026-10-27  9:35 ` [PATCH v1 1/5] ntfs: initialize inherited ACLs after allocating the MFT record Baolin Liu
2026-10-27  9:35 ` [PATCH v1 2/5] ntfs: preserve timestamps when creating hard links Baolin Liu
2026-10-29  0:15   ` Hyunchul Lee
2026-10-29  1:44     ` wangxuewen
2026-10-29  1:49     ` liubaolin
2026-10-27  9:35 ` [PATCH v1 3/5] ntfs: initialize packed EA size " Baolin Liu
2026-10-27  9:35 ` [PATCH v1 4/5] ntfs: write unlinked file attributes before dropping their cache Baolin Liu
2026-10-27  9:35 ` [PATCH v1 5/5] ntfs: support O_TMPFILE Baolin Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®