]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
exfat: fix just enough dentries but allocate a new cluster to dir
authorYuezhang Mo <Yuezhang.Mo@sony.com>
Fri, 22 Nov 2024 02:50:55 +0000 (10:50 +0800)
committerNamjae Jeon <linkinjeon@kernel.org>
Wed, 5 Mar 2025 12:53:19 +0000 (21:53 +0900)
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@sony.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
fs/exfat/namei.c

index 691dd77b6ab5ff52da868dbe1e3840230aaec865..5b16181a4c2e9350ec0902a770b8efad9fef1cc8 100644 (file)
@@ -232,7 +232,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);