mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/6] ntfs: synchronize the in-memory size handling
@ 2026-11-25  7:35 Hongling Zeng
  2026-11-25  7:35 ` [PATCH 1/6] ntfs: mark the record dirtied by a resident write at iomap begin Hongling Zeng
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Hongling Zeng @ 2026-11-25  7:35 UTC (permalink / raw)
  To: linkinjeon, hyc.lee, liubaolin12138
  Cc: ntfs, linux-kernel, zhongling0719, Hongling Zeng

The in-memory size fields of an ntfs inode - data_size,
initialized_size, allocated_size and the compressed size - are
meant to be protected by size_lock, but the iomap readers and the
runtime writers reach them without the lock in several paths, and
the mmap write fault path extends initialized_size without the MFT
record lock every other caller of ntfs_attr_set_initialized_size()
holds.

The first two patches fix bugs found while auditing those paths: a
resident write whose data can land in an extent record that is
never marked dirty, and a failed write that leaves the attribute
extended. The remaining four close the races: the iomap paths
take a coherent snapshot of initialized_size, the writers publish
the sizes under size_lock, the fault path is serialized with the
MFT record lock, and the mmap prepare path reads initialized_size
under the size lock.

Compile-tested on x86_64.

Hongling Zeng (6):
  ntfs: mark the record dirtied by a resident write at iomap begin
  ntfs: roll back the size update when the attribute lookup fails
  ntfs: read initialized_size under size_lock in the iomap paths
  ntfs: update the in-memory sizes under the size lock
  ntfs: serialize the mmap write fault initialized size update
  ntfs: read initialized_size under size_lock in the mmap prepare path

 fs/ntfs/attrib.c | 49 ++++++++++++++++++++++++++---
 fs/ntfs/file.c   | 11 ++++++-
 fs/ntfs/inode.c  | 82 ++++++++++++++++++++++++++++++++++++++++++------
 fs/ntfs/iomap.c  | 74 ++++++++++++++++++++++++++++++++++---------
 4 files changed, 186 insertions(+), 30 deletions(-)

-- 
2.25.1


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

end of thread, other threads:[~2026-11-25 14:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25  7:35 [PATCH 0/6] ntfs: synchronize the in-memory size handling Hongling Zeng
2026-11-25  7:35 ` [PATCH 1/6] ntfs: mark the record dirtied by a resident write at iomap begin Hongling Zeng
2026-11-25  7:35 ` [PATCH 2/6] ntfs: roll back the size update when the attribute lookup fails Hongling Zeng
2026-11-25 14:05   ` liubaolin
2026-11-25  7:35 ` [PATCH 3/6] ntfs: read initialized_size under size_lock in the iomap paths Hongling Zeng
2026-11-25 14:07   ` liubaolin
2026-11-25  7:35 ` [PATCH 4/6] ntfs: update the in-memory sizes under the size lock Hongling Zeng
2026-11-25 14:08   ` liubaolin
2026-11-25  7:35 ` [PATCH 5/6] ntfs: serialize the mmap write fault initialized size update Hongling Zeng
2026-11-25 14:08   ` liubaolin
2026-11-25  7:35 ` [PATCH 6/6] ntfs: read initialized_size under size_lock in the mmap prepare path Hongling Zeng
2026-11-25 14:08   ` liubaolin

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®