From: Julian Sun Date: Fri, 10 Oct 2025 09:52:57 +0000 (+0800) Subject: ext4: make error code in __ext4fs_dirhash() consistent. X-Git-Tag: v6.19-rc1~161^2~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce3236a3c7d8e048e0bcc7f445f12f911dd9dc7d;p=thirdparty%2Fkernel%2Flinux.git ext4: make error code in __ext4fs_dirhash() consistent. 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 Message-ID: <20251010095257.3008275-1-sunjunchao@bytedance.com> Signed-off-by: Theodore Ts'o --- diff --git a/fs/ext4/hash.c b/fs/ext4/hash.c index 33cd5b6b02d59..48483cd015d3c 100644 --- a/fs/ext4/hash.c +++ b/fs/ext4/hash.c @@ -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);