Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Jun 2011 11:42:26 -0700
From:      Kirk McKusick <mckusick@mckusick.com>
To:        Hans Ottevanger <hans@beastielabs.net>
Cc:        freebsd-fs@freebsd.org, Jeff Roberson <jroberson@chesapeake.net>
Subject:   Re: SU+J: negative used diskspace (for a while) 
Message-ID:  <201106171842.p5HIgQjn018296@chez.mckusick.com>
In-Reply-To: <20110617153415.GA92803@testsoekris.hotsoft.nl> 

next in thread | previous in thread | raw e-mail | index | archive | help
> Date: Fri, 17 Jun 2011 17:34:15 +0200
> From: Hans Ottevanger <hans@beastielabs.net>
> To: freebsd-current@freebsd.org
> Subject: SU+J: negative used diskspace (for a while)
> 
> 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

We used to account for deleted blocks at the instant that they were
removed. This accounting was rather complex, so as part of doing
SU+J, Jeff simplified it. Under the simplification, the removal is
not accounted for until part way through the removal process. The
result is that you now get these false negative block counts until
the blocks have been partially reclaimed. If this behavior causes
enough trouble, Jeff might be convinced that the more accurate block
accounting is necessary.

	Kirk McKusick



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106171842.p5HIgQjn018296>