]> Gentwo Git Trees - linux/.git/commitdiff
ext4: make error code in __ext4fs_dirhash() consistent.
authorJulian Sun <sunjunchao@bytedance.com>
Fri, 10 Oct 2025 09:52:57 +0000 (17:52 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 6 Nov 2025 15:32:33 +0000 (10:32 -0500)
Currently __ext4fs_dirhash() returns -1 (-EPERM) if fscrypt doesn't
have encryption key, which may confuse users. Make the error code here
consistent with existing error code.

Signed-off-by: Julian Sun <sunjunchao@bytedance.com>
Message-ID: <20251010095257.3008275-1-sunjunchao@bytedance.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/hash.c

index 33cd5b6b02d59fb749844fe481022f5f44244bb6..48483cd015d3c70d44ba26fa09a0d1619d03f1dd 100644 (file)
@@ -268,7 +268,7 @@ static int __ext4fs_dirhash(const struct inode *dir, const char *name, int len,
                        combined_hash = fscrypt_fname_siphash(dir, &qname);
                } else {
                        ext4_warning_inode(dir, "Siphash requires key");
-                       return -1;
+                       return -EINVAL;
                }
 
                hash = (__u32)(combined_hash >> 32);