From: dd <zhongling0719@126.com>
To: "Hyunchul Lee" <hyc.lee@gmail.com>
Cc: "Hongling Zeng" <zenghongling@kylinos.cn>,
linkinjeon@kernel.org, liubaolin12138@163.com,
ntfs@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re:Re: Re: [PATCH 1/6] ntfs: mark the record dirtied by a resident write at iomap begin
Date: Tue, 1 Dec 2026 15:46:34 +0800 (CST) [thread overview]
Message-ID: <70c84537.5c60.1a23091db30.Coremail.zhongling0719@126.com> (raw)
In-Reply-To: <aw5K0_-WbAcR09dq@hyunchul-PC02>
At 2026-12-01 12:19:31, "Hyunchul Lee" <hyc.lee@gmail.com> wrote:
>On Thu, Nov 26, 2026 at 05:31:35PM +0800, dd wrote:
>>
>>
>>
>>
>> At 2026-11-26 16:45:06, "Hyunchul Lee" <hyc.lee@gmail.com> wrote:
>> >Hi Hongling,
>> >
>> >>
>> >> + /*
>> >> + * The record holding a resident attribute can be an extent record.
>> >> + * Mark the record the lookup found dirty here, while the search
>> >> + * context still points at it. The writeout of the record cannot
>> >> + * overtake the inline copy: it is serialized by the mrec_lock held
>> >> + * until iomap_end.
>> >> + */
>> >> + mark_mft_record_dirty(ctx->ntfs_ino);
>> >> +
>> >
>> >If the write fails before the data is copied into the resident
>> >attribute, the MFT record is still marked dirty and may be written back
>> >even if its contents have not changed.
>> >
>>
>> That can happen, but it is harmless. The mark only sets I_DIRTY_DATASYNC
>> on the base vfs inode (__mark_mft_record_dirty()), and the record is
>> written out by __ntfs_write_inode(), which takes the base mrec_lock
>> before touching any record. The write path holds that lock until
>> iomap_end, so the writeback cannot see the record mid-copy: in the
>> failed-write case it writes one record with unchanged contents, in a
>> write that is already failing. The base record already gets the same
>> treatment: ntfs_write_iomap_end_resident() marks it dirty regardless of
>> how much was copied.
>>
>> Deferring the mark to iomap_end would have to carry the inode of the
>> record there: begin releases the search context before returning, and
>> iomap_end only sees the base inode.
>>
>> Thanks for the review.
>
>What I am concerned about is the writeback of an unchanged extent record
>on the failure path. mark_mft_record_dirty() sets NI_Dirty before any
>data has been copied.
>
You are right, and my previous reply answered a different question:
the spurious writeback of an unchanged record is worth avoiding by
itself, race or no race.
>I also think carrying the extent record inode is not difficult.>iomap_begin() can store it in iomap->private.
>
Agreed. v5 does that: iomap_end() marks the extent record dirty only
after bytes are copied into it. The base record is still marked
unconditionally, since the write's timestamp update modifies it.
Thanks.>>
>> --
>> Hongling
>> >> a = ctx->attr;
>> >> /* The total length of the attribute value. */
>> >> attr_len = le32_to_cpu(a->data.resident.value_length);
>> >> --
>> >> 2.25.1
>> >>
>> >
>> >--
>> >Thanks,
>> >Hyunchul
>
>--
>Thanks,
>Hyunchul
next prev parent reply other threads:[~2026-12-01 7:46 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
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-26 8:45 ` Hyunchul Lee
2026-11-26 9:31 ` dd
2026-12-01 4:19 ` Hyunchul Lee
2026-12-01 7:46 ` dd [this message]
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-26 6:34 ` dd
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-26 8:45 ` Hyunchul Lee
2026-11-26 9:34 ` dd
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
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=70c84537.5c60.1a23091db30.Coremail.zhongling0719@126.com \
--to=zhongling0719@126.com \
--cc=hyc.lee@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liubaolin12138@163.com \
--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®