OSDN Git Service

[PATCH] fix overflow in inode.c
authorRik van Riel <riel@redhat.com>
Fri, 17 Feb 2006 21:03:32 +0000 (16:03 -0500)
committerMarcelo Tosatti <marcelo@dmt.cnet>
Fri, 17 Feb 2006 19:39:25 +0000 (13:39 -0600)
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@redhat.com>
Signed-off-by: Larry Woodman <lwoodman@redhat.com>
fs/inode.c

index 1b3f24b..5ec83f6 100644 (file)
@@ -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();