]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
nilfs2: ensure proper cache clearing for gc-inodes
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Wed, 20 Jun 2012 19:52:57 +0000 (12:52 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 4 Jul 2012 04:44:10 +0000 (05:44 +0100)
commita49f6b0bcf088e45cd2ea691ff575132cb3dbb3a
tree72e207e740f4dc0ab343dabe64540376960cece4
parentdcad89e6e4107f5639141ef4e9b25263438ed8b3
nilfs2: ensure proper cache clearing for gc-inodes

commit fbb24a3a915f105016f1c828476be11aceac8504 upstream.

A gc-inode is a pseudo inode used to buffer the blocks to be moved by
garbage collection.

Block caches of gc-inodes must be cleared every time a garbage collection
function (nilfs_clean_segments) completes.  Otherwise, stale blocks
buffered in the caches may be wrongly reused in successive calls of the GC
function.

For user files, this is not a problem because their gc-inodes are
distinguished by a checkpoint number as well as an inode number.  They
never buffer different blocks if either an inode number, a checkpoint
number, or a block offset differs.

However, gc-inodes of sufile, cpfile and DAT file can store different data
for the same block offset.  Thus, the nilfs_clean_segments function can
move incorrect block for these meta-data files if an old block is cached.
I found this is really causing meta-data corruption in nilfs.

This fixes the issue by ensuring cache clear of gc-inodes and resolves
reported GC problems including checkpoint file corruption, b-tree
corruption, and the following warning during GC.

  nilfs_palloc_freev: entry number 307234 already freed.
  ...

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Tested-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/nilfs2/gcinode.c
fs/nilfs2/segment.c