vfs: fix panic in __d_lookup() with high dentry hashtable counts

When the number of dentry cache hash table entries gets too high
(2147483648 entries), as happens by default on a 16TB system, use of a
signed integer in the dcache_init() initialization loop prevents the
dentry_hashtable from getting initialized, causing a panic in
__d_lookup().  Fix this in dcache_init() and similar areas.

Signed-off-by: Dimitri Sivanich <sivanich@sgi.com>
Acked-by: David S. Miller <davem@davemloft.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Dimitri Sivanich 2012-02-08 12:39:07 -08:00 committed by Al Viro
parent 1d6f209786
commit 074b85175a
5 changed files with 14 additions and 12 deletions

View file

@ -1651,7 +1651,7 @@ __setup("ihash_entries=", set_ihash_entries);
*/
void __init inode_init_early(void)
{
int loop;
unsigned int loop;
/* If hashes are distributed across NUMA nodes, defer
* hash allocation until vmalloc space is available.
@ -1669,13 +1669,13 @@ void __init inode_init_early(void)
&i_hash_mask,
0);
for (loop = 0; loop < (1 << i_hash_shift); loop++)
for (loop = 0; loop < (1U << i_hash_shift); loop++)
INIT_HLIST_HEAD(&inode_hashtable[loop]);
}
void __init inode_init(void)
{
int loop;
unsigned int loop;
/* inode slab cache */
inode_cachep = kmem_cache_create("inode_cache",
@ -1699,7 +1699,7 @@ void __init inode_init(void)
&i_hash_mask,
0);
for (loop = 0; loop < (1 << i_hash_shift); loop++)
for (loop = 0; loop < (1U << i_hash_shift); loop++)
INIT_HLIST_HEAD(&inode_hashtable[loop]);
}