Re: [PATCH] exfat: free directory cluster when zeroing fails
From: Namjae Jeon
Date: Sun Nov 29 2026 - 01:43:10 EST
> @@ -345,8 +345,11 @@ int exfat_find_empty_entry(struct inode *inode,
> if (ret)
> return ret;
>
> - if (exfat_zeroed_cluster(inode, clu.dir))
> - return -EIO;
> + ret = exfat_zeroed_cluster(inode, clu.dir);
> + if (ret) {
> + exfat_free_cluster(inode, &clu);
If clu.flags is ALLOC_FAT_CHAIN, exfat_free_cluster() follows the FAT
to EOF. We need to set clu.flags to ALLOC_NO_FAT_CHAIN before calling
exfat_free_cluster().
> + return ret;
This also propagates -ENOMEM from exfat_zeroed_cluster(). Please drop
the /* -EIO or -ENOSPC */ comments at the exfat_find_empty_entry()
call sites in exfat_add_entry(), exfat_rename_file(), and
exfat_move_file() or leave the existing -EIO return here.
> + }
>
> if (ei->start_clu == EXFAT_EOF_CLUSTER) {
> ei->start_clu = clu.dir;
>
> base-commit: 36edb65f309977762fc001c17dcab748bad4b7c1