On 11/14/2011 04:50 PM, Alessandro Salvatori wrote:
> Hello,
>
> by creating and immediately deleting entries in a non-empty folder
> on a jfs filesystem, it seems like one can leak filesystem space, that
> will only be recovered when that folder becomes completely empty. To
> see this for yourself, please delete the dummy_file created at the
> beginning of this test script.
Yeah, it is working as designed, although I regret the design decision I
made so long ago.
In order to resume a directory traversal while the directory is changing
(typically doing rm -rf on a large directory), I had to add a persistent
cookie to each directory entry and a method to find the entry from the
cookie. (NFS required that it be persistent even if the server reboots.)
I created a table separate from the b-tree, which is the primary data
structure for the directory. New directory entries append to this table,
and slots for deleted entries are not reused. The table is deleted if
the very last entry is deleted from a directory, but is never shrunk.
Doing something about this was always on my to-do list, but I haven't
put much time into JFS the past few years and nothing got done. Maybe
I'll find some time to play around with it or someone else might want to
take a crack at it. I'll gladly review and accept patches. :-)
Thanks,
Shaggy
> I was able to reproduce this on both Linux 2.6.34.1 and 3.1.0. I am
> attaching a super-slim xz archive of the filesystem, as well as the
> test script you may want to give a try in order to reproduce the
> issue.
>
> thank you!
> -Alessandro-
> Here i am, A young man,
> A crashing computer program,
> Here is a pen, write out my name...
>
> (from: The Servant - Orchestra)
>
> localhost mnt # cat test.sh
> #!/bin/sh
>
> name=${1:-jfs}
> kind=${2:-jfs}
> dd if=/dev/zero of="${name}.${kind}" bs=1M count=16 &>/dev/null
> mkdir -p "${name}"
> mkfs.${kind} "${name}.${kind}"
> mount -o loop -t ${kind} "${name}.${kind}" "${name}"
> cd "${name}"
> touch dummy_file
> while true
> do
> count=0
> while true
> do
> touch ${count}
> sync; sync
> unlink ${count}
> count=$((count+1))
> perc=$((count%512))
> if [ $perc -eq 511 ]
> then
> df -a . | grep -v '^Filesystem'
> ls -altrd .
> df -i . | grep -v '^Filesystem'
> break
> fi
> done
> sync
> done
> localhost mnt # chmod +x test.sh
> localhost mnt # ./test.sh c
> mkfs.jfs version 1.1.15, 04-Mar-2011
> Warning! All data on device c.jfs will be lost!
>
> Continue? (Y/N) y
>
>
> Format completed successfully.
>
> 16384 kilobytes total disk space.
> /dev/loop2 15152 140 15012 1% /mnt/c
> drwxr-xr-x 2 root root 4096 Nov 14 14:33 .
> /dev/loop2 30048 6 30042 1% /mnt/c
> /dev/loop2 15152 144 15008 1% /mnt/c
> drwxr-xr-x 2 root root 8192 Nov 14 14:34 .
> /dev/loop2 30048 6 30042 1% /mnt/c
> /dev/loop2 15152 148 15004 1% /mnt/c
> drwxr-xr-x 2 root root 12288 Nov 14 14:34 .
> /dev/loop2 30016 6 30010 1% /mnt/c
> /dev/loop2 15152 152 15000 2% /mnt/c
> drwxr-xr-x 2 root root 16384 Nov 14 14:35 .
> /dev/loop2 30016 6 30010 1% /mnt/c
> /dev/loop2 15152 160 14992 2% /mnt/c
> drwxr-xr-x 2 root root 20480 Nov 14 14:35 .
> /dev/loop2 30016 6 30010 1% /mnt/c
> /dev/loop2 15152 164 14988 2% /mnt/c
> drwxr-xr-x 2 root root 24576 Nov 14 14:35 .
> /dev/loop2 29984 6 29978 1% /mnt/c
> /dev/loop2 15152 168 14984 2% /mnt/c
> drwxr-xr-x 2 root root 28672 Nov 14 14:36 .
> /dev/loop2 29984 6 29978 1% /mnt/c
> /dev/loop2 15152 172 14980 2% /mnt/c
> drwxr-xr-x 2 root root 32768 Nov 14 14:36 .
> /dev/loop2 29984 6 29978 1% /mnt/c
> /dev/loop2 15152 176 14976 2% /mnt/c
> drwxr-xr-x 2 root root 36864 Nov 14 14:37 .
> /dev/loop2 29984 6 29978 1% /mnt/c
> /dev/loop2 15152 180 14972 2% /mnt/c
> drwxr-xr-x 2 root root 40960 Nov 14 14:37 .
> /dev/loop2 29952 6 29946 1% /mnt/c
> /dev/loop2 15152 184 14968 2% /mnt/c
> drwxr-xr-x 2 root root 45056 Nov 14 14:38 .
> /dev/loop2 29952 6 29946 1% /mnt/c
> /dev/loop2 15152 188 14964 2% /mnt/c
> drwxr-xr-x 2 root root 49152 Nov 14 14:38 .
> /dev/loop2 29952 6 29946 1% /mnt/c
> /dev/loop2 15152 192 14960 2% /mnt/c
> drwxr-xr-x 2 root root 53248 Nov 14 14:38 .
> /dev/loop2 29952 6 29946 1% /mnt/c
> /dev/loop2 15152 196 14956 2% /mnt/c
> drwxr-xr-x 2 root root 57344 Nov 14 14:39 .
> /dev/loop2 29920 6 29914 1% /mnt/c
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Jfs-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jfs-discussion