Re: [PATCH v2] exfat: clean up new entry on add entry failure
From: Namjae Jeon
Date: Wed Jul 29 2026 - 05:23:24 EST
On Wed, Jul 29, 2026 at 11:26 AM Yichong Chen <chenyichong@xxxxxxxxxxxxx> wrote:
>
> exfat_add_entry() initializes a new directory entry set before writing it
> with exfat_put_dentry_set(). If the write fails, mkdir/create returns an
> error but a partially written entry may be left behind.
>
> For non-zero-size directories, the failure also happens after a cluster
> has been allocated for the new directory. Clean up the new entry
> best-effort, and free the newly allocated directory cluster only when the
> cleanup writeback succeeds. This avoids freeing a cluster that may still
> be referenced by an on-disk entry if the cleanup fails.
>
> Signed-off-by: Yichong Chen <chenyichong@xxxxxxxxxxxxx>
Applied it to #dev.
Thanks!