SU+J: negative used diskspace (for a while)

Hans Ottevanger hans at beastielabs.net
Fri Jun 17 15:53:09 UTC 2011


Hi,

I found a possible issue with SU+J on recent versions of -CURRENT.

After deleting a large file hierarchy (copy of /usr/src, ~1.5 Gbyte),
df reports a negative number of blocks "Used" for a while.

I am using a GENERIC kernel (r223184) on an amd64 platform. The hardware
is relatively simple: Intel DP965LT mainboard with a Q6600 CPU, 8 Gbyte
RAM and two Samsung 501LJ 500 Gbyte SATA disks. 

The issue can be demonstrated by copying /usr/src to the current directory
(cp -R /usr/src .) and running the following script to delete the copy
and print the free space at 10 second intervals:

#!/bin/sh

df .

time rm -rf src

echo 'src is gone ...'

while true
do
	df . | tail -1
	sleep 10
done

This yields the following output:

Filesystem   1K-blocks    Used     Avail Capacity  Mounted on
/dev/ada0s1g 416144900 1612066 381241242     0%    /home
       51.21 real         1.00 user        17.38 sys
src is gone ...
/dev/ada0s1g 416144900 -164692 383018000    -0%    /home
/dev/ada0s1g 416144900 -165082 383018390    -0%    /home
/dev/ada0s1g 416144900 -246852 383100160    -0%    /home
/dev/ada0s1g 416144900 -246852 383100160    -0%    /home
/dev/ada0s1g 416144900 -246852 383100160    -0%    /home
/dev/ada0s1g 416144900 -64146 382917454    -0%    /home
/dev/ada0s1g 416144900 -64146 382917454    -0%    /home
/dev/ada0s1g 416144900 -64146 382917454    -0%    /home
/dev/ada0s1g 416144900 32910 382820398     0%    /home
/dev/ada0s1g 416144900 32910 382820398     0%    /home

So it takes more than a minute before the disk space is back to "normal"
values.

After disabling journaling (tunefs -j disable) I get the following output:

Filesystem   1K-blocks    Used     Avail Capacity  Mounted on
/dev/ada0s1g 416144900 1579284 381274024     0%    /home
       35.40 real         0.96 user        13.32 sys
src is gone ...
/dev/ada0s1g 416144900  128 382853180     0%    /home
/dev/ada0s1g 416144900  128 382853180     0%    /home
/dev/ada0s1g 416144900  128 382853180     0%    /home
/dev/ada0s1g 416144900  128 382853180     0%    /home

which is as it should be.

The problem also does not occur with journaling enabled when I revert
to r222723.

Is anybody else seeing these weird phenomena?
Could this be related to the recent changes to UFS?

Kind regards,

Hans Ottevanger


More information about the freebsd-current mailing list