From: Namjae Jeon <linkinjeon@kernel.org>
To: Zhan Xusheng <zhanxusheng1024@gmail.com>
Cc: hyc.lee@gmail.com, ernest.borowski.git@proton.me,
liubaolin12138@163.com, ntfs@lists.linux.dev,
linux-kernel@vger.kernel.org, zhanxusheng@xiaomi.com,
stable@vger.kernel.org
Subject: Re: [PATCH v12] ntfs: trim the sizes after a short write
Date: Tue, 1 Dec 2026 18:34:22 +0900 [thread overview]
Message-ID: <CAKYAXd9r35AogmMA9ZWcssffXOtgXgufiCsKJ4d4M+5ASuZkUw@mail.gmail.com> (raw)
In-Reply-To: <20261127031053.3695758-1-zhanxusheng1024@gmail.com>
On Fri, Nov 27, 2026 at 12:11 PM Zhan Xusheng <zhanxusheng1024@gmail.com> wrote:
>
> From: Zhan Xusheng <zhanxusheng@xiaomi.com>
>
> ntfs_file_write_iter() moves the data size and, for a non-resident
> uncompressed file, the initialized size to pos + count before the copy.
> __ntfs_extend_initialized_size() only zeroes [old initialized size, pos),
> so the range [pos, pos + count) is initialized only by the copy itself.
> When iomap_file_buffered_write() copies less than count, it returns a
> positive short count and the error rollback at out: does not run. The
> file keeps the size pos + count, and [pos + ret, pos + count) reads back
> whatever the freed clusters held before, also after a remount. A local
> user can read the old contents of freed clusters this way.
>
> Run the existing rollback for a short write as well, and roll the data
> size back to the end of what was written, keeping the clusters that were
> allocated on disk before the write, such as space reserved with
> FALLOC_FL_KEEP_SIZE. Keep the initialized size, as a page fault through
> a shared mapping may rely on it while the write is stalled on its
> source, and zero what the write did not reach, up to the end of the
> block holding pos + count. Only if that fails, take the initialized
> size back to where the zeroing started, if it is above that. A writer
> killed during the copy also leaves a short write, but iomap_zero_range()
> then fails with -EINTR, so zero from a worker when a fatal signal is
> pending.
>
> An asynchronous direct write that fails after submitting bios returns
> -EIOCBQUEUED, and the rollback does not run for it either. Wait for a
> direct write that moves the initialized size, and fail a non-blocking
> one with -EAGAIN so that it is retried blocking, as ext4 does.
>
> Fixes: b041ca562526 ("ntfs: update iomap and address space operations")
> Cc: stable@vger.kernel.org
> Co-developed-by: Ernest Borowski <ernest.borowski.git@proton.me>
> Signed-off-by: Ernest Borowski <ernest.borowski.git@proton.me>
> Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com>
Applied it to #ntfs-next.
Thanks!
next prev parent reply other threads:[~2026-12-01 9:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 3:10 Zhan Xusheng
2026-11-27 3:58 ` liubaolin
2026-12-01 0:35 ` Hyunchul Lee
2026-12-01 9:34 ` Namjae Jeon [this message]
2026-12-03 13:39 ` [syzbot ci] " syzbot ci
2026-12-03 21:54 ` Namjae Jeon
2026-12-03 21:55 ` syzbot ci
2026-12-04 2:02 ` 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=CAKYAXd9r35AogmMA9ZWcssffXOtgXgufiCsKJ4d4M+5ASuZkUw@mail.gmail.com \
--to=linkinjeon@kernel.org \
--cc=ernest.borowski.git@proton.me \
--cc=hyc.lee@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liubaolin12138@163.com \
--cc=ntfs@lists.linux.dev \
--cc=stable@vger.kernel.org \
--cc=zhanxusheng1024@gmail.com \
--cc=zhanxusheng@xiaomi.com \
/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®