Re: [PATCH v3 2/3] exfat: retain the next empty directory entry hint

From: Namjae Jeon

Date: Thu Sep 10 2026 - 20:17:28 EST


> @@ -385,6 +429,8 @@ int exfat_find_empty_entry(struct inode *inode,
> inode->i_blocks += sbi->cluster_size >> 9;
> }
>
> + exfat_set_next_empty_hint(inode, p_dir, dentry, num_entries, es);
This advances hint_femp before the entry set is committed. If a later
step such as exfat_alloc_new_dir() or exfat_put_dentry_set() fails,
the slot is still empty but the hint points past it. The same applies
to the volume-label and rollback paths. Please invalidate the hint on
every post-allocation failure, or update it only after the entry is
committed.
> +
> p_dir->dir = exfat_sector_to_cluster(sbi, es->bh[0]->b_blocknr);
> p_dir->size -= dentry / sbi->dentries_per_clu;
>

> @@ -1214,6 +1267,7 @@ static int __exfat_rename(struct inode *old_parent_inode,
> ret = exfat_rename_file(new_parent_inode, &uni_name, ei);
> else
> ret = exfat_move_file(new_parent_inode, &uni_name, ei);
> + exfat_invalidate_empty_hint(old_parent_inode);
> if (!ret)
> exfat_name_filter_add(new_parent_inode, &uni_name);
If the new entry is written successfully but deleting the old entry
fails, exfat_rename_file() or exfat_move_file() returns an error and
this filter update is skipped. The new name may still exist on disk,
so a Bloom-filter miss can incorrectly return -ENOENT. Please
invalidate the destination filter on rename/move errors.

Thanks.