This is a note to let you know that I've just added the patch titled exfat: fix just enough dentries but allocate a new cluster to dir to the 6.13-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: exfat-fix-just-enough-dentries-but-allocate-a-new-cl.patch and it can be found in the queue-6.13 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 4cca8401e41774d3e64a945e1fa16bcc19d915d4 Author: Yuezhang Mo <Yuezhang.Mo@xxxxxxxx> Date: Fri Nov 22 10:50:55 2024 +0800 exfat: fix just enough dentries but allocate a new cluster to dir [ Upstream commit 6697f819a10b238ccf01998c3f203d65d8374696 ] This commit fixes the condition for allocating cluster to parent directory to avoid allocating new cluster to parent directory when there are just enough empty directory entries at the end of the parent directory. Fixes: af02c72d0b62 ("exfat: convert exfat_find_empty_entry() to use dentry cache") Signed-off-by: Yuezhang Mo <Yuezhang.Mo@xxxxxxxx> Signed-off-by: Namjae Jeon <linkinjeon@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index 099f806450721..9996ca61c85b7 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -237,7 +237,7 @@ static int exfat_search_empty_slot(struct super_block *sb, dentry = 0; } - while (dentry + num_entries < total_entries && + while (dentry + num_entries <= total_entries && clu.dir != EXFAT_EOF_CLUSTER) { i = dentry & (dentries_per_clu - 1);