[PATCH] fix overflow in inode.c

From: Rik van Riel
Date: Fri Feb 17 2006 - 16:01:31 EST


The following patch fixes an overflow in inode.c. This overflow can
cause a system to stop reclaiming inodes, with a large amount of memory
and zillions of inodes. This has caused systems to run out of low
memory in real world situations.

Thanks go out to Larry Woodman, as well as the unnamed customer who
first tracked this problem down. You know who you are.


Signed-off-by: Rik van Riel <riel@xxxxxxxxxx>
Signed-off-by: Larry Woodman <lwoodman@xxxxxxxxxx>

--- linux-2.4.32/fs/inode.c.overflow 2006-02-17 15:55:16.000000000 -0500
+++ linux-2.4.32/fs/inode.c 2006-02-17 15:56:37.000000000 -0500
@@ -854,8 +854,8 @@ void prune_icache(int goal)
*/
if (goal <= 0)
return;
- if (inodes_stat.nr_unused * sizeof(struct inode) * 10 <
- freeable_lowmem() * PAGE_SIZE)
+ if (inodes_stat.nr_unused <
+ (freeable_lowmem() * PAGE_SIZE) / (sizeof(struct inode) * 10))
return;

wakeup_bdflush();
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/