From: liubaolin <liubaolin12138@163.com>
To: Hongling Zeng <zenghongling@kylinos.cn>,
linkinjeon@kernel.org, hyc.lee@gmail.com
Cc: ntfs@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 0/6] ntfs: synchronize the in-memory size handling
Date: Sun, 6 Dec 2026 10:53:52 +0800 [thread overview]
Message-ID: <fbb93b2d-960c-4759-aebd-1265e4338974@163.com> (raw)
In-Reply-To: <20261202054112.1138977-1-zenghongling@kylinos.cn>
在 2026/12/2 13:41, 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.
>
> This series is based on ntfs-next.
>
> Compile-tested on x86_64.
>
> Changes in v6:
>
> - 1/6: trim the comments (Hyunchul Lee).
>
> - 2/6: snapshot the old allocation only for a non-resident attribute;
> a resident allocated_size counts bytes, not clusters. The whole
> series carries Hyunchul's reviewed-by.
>
> Changes in v5:
>
> - 0002: roll the sizes back with __ntfs_attr_truncate_vfs() and
> ntfs_attr_set_data_size(): only the clusters the failed write
> allocated are freed, the allocation that predates the write is
> preserved (Hyunchul Lee).
>
> - 0001: carry the inode of the record the lookup found in
> iomap->private, and mark that record dirty in iomap_end, after
> the data is copied, so a write that failed before copying
> anything leaves an unchanged record alone. Point the Fixes tag
> at 5aec1efb11ab, the commit that dropped the extent record
> dirtying (Hyunchul Lee).
>
> - Trim the comments across the series (Hyunchul Lee).
>
> Changes in v4:
>
> - 0002: leave the folios beyond the old EOF in place when rolling
> back an internal attribute: its callers hold the base mft record
> lock there, which the folio locks of truncate_setsize() would
> invert against. Recompute the modified flag after the rollback,
> so a failed write the rollback restored completely does not
> update the base file times of a named stream.
>
> Changes in v3:
>
> - Rebased onto the rewritten ntfs-next tip.
>
> - 0004: merge the i_size_write() upstream added to
> ntfs_ir_reparent(), kept outside size_lock like the other
> i_size_write() calls.
>
> Changes in v2:
>
> - 0002: defer the non-resident rollback to
> ntfs_inode_attr_pwrite(), which truncates without mrec_lock held,
> avoiding a deadlock with writeback.
>
> - 0003: reuse the first initialized_size snapshot in the length
> adjustment, and take size_lock in ntfs_iomap_read_end_io()
> (Hyunchul Lee).
>
> - 0004: hold size_lock across the index root size updates in
> ntfs_ir_reparent().
>
> Hongling Zeng (6):
> ntfs: mark the record dirtied by a resident write in iomap_end
> 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/aops.c | 3 +
> fs/ntfs/attrib.c | 49 ++++++++++++++--
> fs/ntfs/file.c | 11 +++-
> fs/ntfs/index.c | 5 ++
> fs/ntfs/inode.c | 143 ++++++++++++++++++++++++++++++++++++++++++-----
> fs/ntfs/iomap.c | 67 +++++++++++++++++-----
> 6 files changed, 244 insertions(+), 34 deletions(-)
>
This series looks good to me. Thanks for the work.
Reviewed-by: Baolin Liu <liubaolin@kylinos.cn>
prev parent reply other threads:[~2026-12-06 2:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 5:41 Hongling Zeng
2026-12-02 5:41 ` [PATCH v6 1/6] ntfs: mark the record dirtied by a resident write in iomap_end Hongling Zeng
2026-12-02 5:41 ` [PATCH v6 2/6] ntfs: roll back the size update when the attribute lookup fails Hongling Zeng
2026-12-03 2:38 ` kernel test robot
2026-12-05 13:38 ` kernel test robot
2026-12-06 2:41 ` liubaolin
2026-12-02 5:41 ` [PATCH v6 3/6] ntfs: read initialized_size under size_lock in the iomap paths Hongling Zeng
2026-12-02 5:41 ` [PATCH v6 4/6] ntfs: update the in-memory sizes under the size lock Hongling Zeng
2026-12-02 5:41 ` [PATCH v6 5/6] ntfs: serialize the mmap write fault initialized size update Hongling Zeng
2026-12-02 5:41 ` [PATCH v6 6/6] ntfs: read initialized_size under size_lock in the mmap prepare path Hongling Zeng
2026-12-06 2:53 ` liubaolin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fbb93b2d-960c-4759-aebd-1265e4338974@163.com \
--to=liubaolin12138@163.com \
--cc=hyc.lee@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ntfs@lists.linux.dev \
--cc=zenghongling@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®