Slab memory leak in JFFS2 filesystems

Johns Daniel johns.daniel at gmail.com
Thu Feb 24 19:41:20 EST 2011


I have discovered a kernel memory leak associated with JFFS2
filesystems. I have verified the leak in kernels 2.6.28 and 2.6.36 on
a Freescale PowerPC board using this script:

while :; do FN=$(mktemp /jffs2fs/TMP.XXXXXXXX); \
   cat /proc/slabinfo |grep "dentry\|size-64 "; sleep 1; /bin/rm $FN; done

The "dentry" and "size-64" slabs grow continuously with this script --
and the memory is not reclaimed even after the script is stopped.

Basically, JFFS2 does not do a complete slab cleanup when a file is
deleted. If the old filename is reused, you don't notice the leak
because it is very small. However, if you use a new filename each
time, the memory leak is pretty obvious.

Is this a JFFS2 feature or is this a bug?
If it is a bug, does anybody have a fix for it?

-- Johns



More information about the linux-mtd mailing list