Btrfs: fix extent state leak on failed nodatasum reads
authorJan Schmidt <list.btrfs@jan-o-sch.net>
Wed, 4 May 2011 14:18:50 +0000 (16:18 +0200)
committerChris Mason <chris.mason@oracle.com>
Fri, 10 Jun 2011 23:00:53 +0000 (19:00 -0400)
When encountering an EIO while reading from a nodatasum extent, we
insert an error record into the inode's failure tree.
btrfs_readpage_end_io_hook returns early for nodatasum inodes. We'd
better clear the failure tree in that case, otherwise the kernel
complains about

BUG extent_state: Objects remaining on kmem_cache_close()

on rmmod.

Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/inode.c

index 02ff4a1b968b1d37900401efed53ead50bcffb85..113913ae36e0dd5f3adcd6cab7917ba51f3ea092 100644 (file)
@@ -1986,7 +1986,7 @@ static int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end,
        }
 
        if (BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM)
-               return 0;
+               goto good;
 
        if (root->root_key.objectid == BTRFS_DATA_RELOC_TREE_OBJECTID &&
            test_range_bit(io_tree, start, end, EXTENT_NODATASUM, 1, NULL)) {