[Ocfs2-tools-devel] A patch for fsck.ocfs2 of ocfs2-tools: verfity_chain_alloc.patch

tao.ma tao.ma at oracle.com
Fri Oct 20 00:06:02 PDT 2006


When there is some circumstance that the next_free_rec of global_bitmap 
inode corrupts, it will make the fsck.ocfs2 loop forever.

The wrong scenario happens like this:
1. The original thing is:
 Group Chain: 0   Parent Inode: 15  Generation: 1801711723
        ##   Block#            Total    Used     Free     Contig   Size
        0    4                 7680     7680     0        0        960
        1    1566720           7680     1        7679     7679     960
        2    3133440           7680     1        7679     7679     960
        3    4700160           7680     1        7679     7679     960
        4    6266880           7680     1        7679     7679     960
        5    7833600           7680     1        7679     7679     960
        6    9400320           7680     1        7679     7679     960

        Group Chain: 1   Parent Inode: 15  Generation: 1801711723
        ##   Block#            Total    Used     Free     Contig   Size
        0    30720             7680     7680     0        0        960
        1    1597440           7680     1        7679     7679     960
        2    3164160           7680     1        7679     7679     960
        3    4730880           7680     1        7679     7679     960
        4    6297600           7680     1        7679     7679     960
        5    7864320           7680     1        7679     7679     960
        6    9431040           7680     1        7679     7679     960

2. The next_free_rec crashes to a wrong value, let's say, 1 for example.
3. Run fsck.ocfs2.
1) In function verify_chain_alloc, only chain 0 will be checked.  For 
chain 1, nothing happens. But acutually there is a chain.
2) In function verify_bitmap_descs, many 'GROUP_EXPECTED_DESC' error 
happens, and they are added to the chain. Please note that at this time, 
the old chain will link together. The chain 1 now looks like:
Group Chain: 1   Parent Inode: 15  Generation: 1801711723
        ##   Block#            Total    Used     Free     Contig   Size
        0    9431040           7680     1        7679     7679     960
        1    7864320           7680     1        7679     7679     960
        2    6297600           7680     1        7679     7679     960
        3    4730880           7680     1        7679     7679     960
        4    3164160           7680     1        7679     7679     960
        5    1597440           7680     1        7679     7679     960
        6    30720             7680     7680     0        0        960
        7    30720             7680     7680     0        0        960
        8    30720             7680     7680     0        0        960
        9    30720             7680     7680     0        0        960
        10   30720             7680     7680     0        0        960

4. When fsck.ocfs2 run again, it loops forever.

Solution: Clean the unused chain. So the old chain will be removed and 
they will added automatically in verify_bitmap_descs.
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: verify_chain_alloc.patch
Type: text/x-patch
Size: 739 bytes
Desc: not available
Url : http://oss.oracle.com/pipermail/ocfs2-tools-devel/attachments/20061020/754821e5/verify_chain_alloc.bin


More information about the Ocfs2-tools-devel mailing list