From patchwork Wed May 4 14:18:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Schmidt X-Patchwork-Id: 753892 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p44EIsa4024538 for ; Wed, 4 May 2011 14:18:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753480Ab1EDOSw (ORCPT ); Wed, 4 May 2011 10:18:52 -0400 Received: from mort.rzone.de ([81.169.144.234]:45274 "EHLO mort.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753167Ab1EDOSw (ORCPT ); Wed, 4 May 2011 10:18:52 -0400 Received: from gargravarr.store (gargravarr.store [192.168.42.236]) by mort.rzone.de (Postfix) with ESMTP id 0857AF8A; Wed, 4 May 2011 16:18:51 +0200 (MEST) Received: by gargravarr.store (Postfix, from userid 32566) id 640E744DC9; Wed, 4 May 2011 16:18:50 +0200 (CEST) From: Jan Schmidt To: chris.mason@oracle.com, linux-btrfs@vger.kernel.org Subject: [PATCH] Btrfs: fix extent state leak on failed nodatasum reads Date: Wed, 4 May 2011 16:18:50 +0200 Message-Id: <1304518730-13909-1-git-send-email-list.btrfs@jan-o-sch.net> X-Mailer: git-send-email 1.7.3.4 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 04 May 2011 14:18:55 +0000 (UTC) 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 --- fs/btrfs/inode.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 870869a..9444551 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1970,7 +1970,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)) {