Btrfs: Verify checksums on tree blocks found without read_tree_block
authorChris Mason <chris.mason@oracle.com>
Tue, 1 Apr 2008 17:48:14 +0000 (13:48 -0400)
committerChris Mason <chris.mason@oracle.com>
Thu, 25 Sep 2008 15:04:01 +0000 (11:04 -0400)
commit0999df54f850fe1aba29b10d5c869493af107478
treec67e0ca38e89d0872f6246093d962ce598b49ec7
parentecbe2402cb4e4e7413544dc392c1a78d0f290292
Btrfs: Verify checksums on tree blocks found without read_tree_block

Checksums were only verified by btrfs_read_tree_block, which meant the
functions to probe the page cache for blocks were not validating checksums.
Normally this is fine because the buffers will only be in cache if they
have already been validated.

But, there is a window while the buffer is being read from disk where
it could be up to date in the cache but not yet verified.  This patch
makes sure all buffers go through checksum verification before they
are used.

This is safer, and it prevents modification of buffers before they go
through the csum code.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/ctree.c
fs/btrfs/disk-io.c
fs/btrfs/disk-io.h
fs/btrfs/extent-tree.c
fs/btrfs/tree-defrag.c