hammer_alloc_data panic

Matthew Dillon dillon at apollo.backplane.com
Tue Jul 15 15:10:05 PDT 2008


    Ok, Gergo and I have been working through the two issues he reported
    and with kind access to his machine I have figured out what is going
    on.  I am going to post this to the thread so we have a record of it,
    because it is quite interesting.

    Gergo found two problems:

    (1) 'hammer reblock' can lose track of space reservations and cause
	hammer_alloc_data() to run out of space on the media and panic.

	I hope to fix this today.  At worst we want the reblocker to
	return an error if there is insufficient free space on the disk
	to reblock it, not panic the machine :-).

	I have found that 'dd' can do the same thing.  It is the same bug.

    (2) On his small 14G test partition, using nohistory, it turns out
	that a huge amount of fragmentation can build up if the partition
	is not reblocked.  I aint talking 10% here, I'm talking 65%
	fragmentation or worse.  The 14G partition only had 5G worth
	of files on it but it was 99% full, with only 300MB free in df.

	It was so fragmented that trying to reblock it using the default
	fill level (aka 'hammer reblock /home') failed because there was
	not enough media space free to reblock into.

	This is really a documentation issue.  HAMMER partitions must be
	reblocked occassionally, preferably via cron and preferably before
	you actually run out of disk space. 

    
    It is possible to reblock when the media is highly fragmented.  You do
    it by telling hammer to only reblock nearly-empty blocks first, in
    order to get them freed up and available for reuse as quickly as possible.
    This is done by specifying a <fill_percentage> argument.

    For example, this command will only reblock blocks that are 5% full
    (and hence 95% empty):

	hammer reblock /home 5

    It works because it doesn't cost much to move the small amounts of data
    out of those highly fragmented blocks and thus be able to free the blocks.
    You then increase the fill percentage until you have freed enough space
    to do the remainder with no limitations:

	hammer reblock /home 25
	hammer reblock /home 50
	hammer reblock /home 75
	hammer reblock /home 90
	hammer reblock /home
	whew...

    It's a bit complex so what I am going to do is add some foot-shooting
    protection to the 'hammer reblock' utility and maybe also have it
    print out a warning, a reminder, if you attempt to reblock a hammer
    partition that is too full.

					-Matt





More information about the Bugs mailing list