linux/fs/nilfs2
Ryusuke Konishi fbb24a3a91 nilfs2: ensure proper cache clearing for gc-inodes
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>
Cc: <stable@vger.kernel.org>	[2.6.37+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-06-20 14:39:35 -07:00
..
Kconfig
Makefile
alloc.c
alloc.h
bmap.c
bmap.h
btnode.c
btnode.h
btree.c
btree.h
cpfile.c
cpfile.h
dat.c
dat.h
dir.c
direct.c
direct.h
export.h
file.c nilfs2: flush disk caches in syncing 2012-05-31 17:49:27 -07:00
gcinode.c nilfs2: ensure proper cache clearing for gc-inodes 2012-06-20 14:39:35 -07:00
ifile.c
ifile.h
inode.c
ioctl.c nilfs2: flush disk caches in syncing 2012-05-31 17:49:27 -07:00
mdt.c
mdt.h
namei.c ->encode_fh() API change 2012-05-29 23:28:33 -04:00
nilfs.h
page.c
page.h
recovery.c
segbuf.c
segbuf.h
segment.c nilfs2: ensure proper cache clearing for gc-inodes 2012-06-20 14:39:35 -07:00
segment.h
sufile.c
sufile.h
super.c
the_nilfs.c
the_nilfs.h