From: Hyunchul Lee <hyc.lee@gmail.com>
To: Xuewen Wang <wangxuewen_ky@163.com>
Cc: linkinjeon@kernel.org, ntfs@lists.linux.dev,
linux-kernel@vger.kernel.org, Xuewen Wang <wangxuewen@kylinos.cn>
Subject: Re: [PATCH v5 11/31] ntfs: handle source record removal failure during attribute moves
Date: Mon, 9 Nov 2026 11:31:57 +0900 [thread overview]
Message-ID: <avEwnT6CAgeCj2oo@hyunchul-PC02> (raw)
In-Reply-To: <20261102073532.98873-12-wangxuewen_ky@163.com>
On Mon, Nov 02, 2026 at 03:35:12PM +0800, Xuewen Wang wrote:
> From: Xuewen Wang <wangxuewen@kylinos.cn>
>
> ntfs_attr_record_move_to() ignores failure to remove the source attribute
> after copying it. It can update the attribute-list reference and report
> success with both copies present.
>
> Check removal before changing the list entry. On failure, attempt to
> remove the destination copy, mark its record dirty and unmap it, leaving
> the list pointing to the source. Report destination cleanup failure
> separately.
>
> Shrinking a record to zero needs no extra space, so failure indicates
> inconsistent record accounting. Return and report EFSCORRUPTED even if
> cleanup also fails.
>
> Fixes: 495e90fa3348 ("ntfs: update attrib operations")
This patch has the Fixes tag, but it calls
ntfs_report_file_metadata_error(), which is introduced in patch 3.
If this patch is backported to a stable tree with patch 3, it could fail
to build.
> Signed-off-by: Xuewen Wang <wangxuewen@kylinos.cn>
> ---
> fs/ntfs/attrib.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
> index 5af8ac41af17..f1c99e0d8dca 100644
> --- a/fs/ntfs/attrib.c
> +++ b/fs/ntfs/attrib.c
> @@ -3578,7 +3578,17 @@ int ntfs_attr_record_move_to(struct ntfs_attr_search_ctx *ctx, struct ntfs_inode
> nctx->attr->instance = nctx->mrec->next_attr_instance;
> nctx->mrec->next_attr_instance =
> cpu_to_le16((le16_to_cpu(nctx->mrec->next_attr_instance) + 1) & 0xffff);
> - ntfs_attr_record_resize(ctx->mrec, a, 0);
> + err = ntfs_attr_record_resize(ctx->mrec, a, 0);
> + if (err) {
> + err = -EFSCORRUPTED;
> + ntfs_report_file_metadata_error(VFS_I(ni), -EFSCORRUPTED);
> + if (ntfs_attr_record_resize(ni_mrec, nctx->attr, 0))
> + ntfs_report_file_metadata_error(VFS_I(ni),
> + -EFSCORRUPTED);
> + mark_mft_record_dirty(ni);
> + unmap_mft_record(ni);
> + goto put_err_out;
> + }
> mark_mft_record_dirty(ctx->ntfs_ino);
> mark_mft_record_dirty(ni);
>
>
>
--
Thanks,
Hyunchul
next prev parent reply other threads:[~2026-11-09 2:32 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 7:35 [PATCH v5 00/31] ntfs: report metadata errors and shutdown through FAN_FS_ERROR Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 01/31] ntfs: propagate mapping-pairs update errors from inode writeback Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 02/31] ntfs: preserve cluster-free counts in attribute cleanup Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 03/31] ntfs: add filesystem metadata error reporting helpers Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 04/31] ntfs: preserve attribute search context initialization errors Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 05/31] ntfs: report boot geometry and MFT bootstrap errors Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 06/31] ntfs: report required system file and volume metadata errors Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 07/31] ntfs: report logfile metadata and emptying errors Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 08/31] ntfs: report runlist and cluster allocation metadata errors Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 09/31] ntfs: report iomap corruption and preserve buffered read errors Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 10/31] ntfs: report LZNT1 and WOF compressed stream errors Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 11/31] ntfs: handle source record removal failure during attribute moves Xuewen Wang
2026-11-09 2:31 ` Hyunchul Lee [this message]
2026-11-02 7:35 ` [PATCH v5 12/31] ntfs: report attribute lookup and validation errors Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 13/31] ntfs: report attribute record update and cleanup failures Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 14/31] ntfs: report attribute list update and recovery failures Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 15/31] ntfs: report attribute conversion and mapping update failures Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 16/31] ntfs: report attribute resize and relocation recovery failures Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 17/31] ntfs: report incomplete attribute range updates Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 18/31] ntfs: report inode metadata and eviction cleanup errors Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 19/31] ntfs: report index validation and block I/O errors Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 20/31] ntfs: preserve index traversal errors and directory retries Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 21/31] ntfs: report directory lookup and metadata corruption Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 22/31] ntfs: report index update and recovery failures Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 23/31] ntfs: report namespace and file recovery errors Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 24/31] ntfs: serialize and report export parent reconstruction errors Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 25/31] ntfs: report MFT record validation and lifecycle errors Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 26/31] ntfs: report MFT bitmap and data growth recovery failures Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 27/31] ntfs: report MFT writeback errors to fsnotify Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 28/31] ntfs: report EA metadata and restoration errors Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 29/31] ntfs: report named stream metadata and recovery errors Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 30/31] ntfs: report reparse and object ID metadata errors Xuewen Wang
2026-11-02 7:35 ` [PATCH v5 31/31] ntfs: report each shutdown transition once Xuewen Wang
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=avEwnT6CAgeCj2oo@hyunchul-PC02 \
--to=hyc.lee@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ntfs@lists.linux.dev \
--cc=wangxuewen@kylinos.cn \
--cc=wangxuewen_ky@163.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®