[PATCH v4 03/12] ntfs: discard reparse attributes when creation fails
From: Baolin Liu
Date: Sun Nov 15 2026 - 08:27:02 EST
From: Xuewen Wang <wangxuewen@xxxxxxxxxx>
Creation rollback removes the reparse index entry but leaves the
REPARSE_POINT attribute inode cached. The inode retains the old base
inode and MFT sequence number after the MFT record is freed.
When the record is reused, later index removal can use that stale
sequence number and leave reparse index entries referring to freed
records. Remove the attribute after deleting its index entry, and drop
the returned inode reference after releasing the record locks.
Fixes: af0db57d4293 ("ntfs: update inode operations")
Reviewed-by: Baolin Liu <liubaolin@xxxxxxxxxx>
Signed-off-by: Xuewen Wang <wangxuewen@xxxxxxxxxx>
---
New in v4.
Injected FIFO creation failures after ACL and FILE_NAME setup with
512-byte/4 KiB clusters. Offline checks found no leftover reparse-index
entries or allocated MFT records; space counts and retries passed.
fs/ntfs/namei.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/fs/ntfs/namei.c b/fs/ntfs/namei.c
index b46fe44b63b5..a84d7bc9bc28 100644
--- a/fs/ntfs/namei.c
+++ b/fs/ntfs/namei.c
@@ -429,6 +429,7 @@ static struct ntfs_inode *__ntfs_create(const struct mnt_idmap *idmap, struct in
struct mft_record *ni_mrec, *dni_mrec;
struct super_block *sb = dir_ni->vol->sb;
struct inode *rollback_data_vi = NULL, *rollback_sd_vi = NULL;
+ struct inode *rollback_rp_vi = NULL;
__le64 parent_mft_ref;
u64 child_mft_ref;
__le16 ea_size;
@@ -740,8 +741,13 @@ static struct ntfs_inode *__ntfs_create(const struct mnt_idmap *idmap, struct in
ntfs_error(sb, "Failed to roll back DATA attribute.\n");
}
- if (rollback_reparse)
- ntfs_delete_reparse_index(ni);
+ if (rollback_reparse) {
+ if (ntfs_delete_reparse_index(ni) < 0)
+ ntfs_error(sb, "Failed to roll back reparse index entry.");
+ if (ntfs_attr_remove(ni, AT_REPARSE_POINT, AT_UNNAMED, 0,
+ &rollback_rp_vi))
+ ntfs_error(sb, "Failed to roll back REPARSE_POINT attribute.");
+ }
/*
* Free extent MFT records (should not exist any with current
* ntfs_create implementation, but for any case if something will be
@@ -766,6 +772,8 @@ static struct ntfs_inode *__ntfs_create(const struct mnt_idmap *idmap, struct in
mutex_unlock(&dir_ni->mrec_lock);
mutex_unlock(&ni->mrec_lock);
+ if (rollback_rp_vi)
+ iput(rollback_rp_vi);
if (rollback_data_vi)
iput(rollback_data_vi);
if (rollback_sd_vi)