From patchwork Fri Nov 13 17:06:52 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 59870 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nADH6xYE019510 for ; Fri, 13 Nov 2009 17:06:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753178AbZKMRGv (ORCPT ); Fri, 13 Nov 2009 12:06:51 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754264AbZKMRGv (ORCPT ); Fri, 13 Nov 2009 12:06:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45543 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752389AbZKMRGu (ORCPT ); Fri, 13 Nov 2009 12:06:50 -0500 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nADH6rKC030277 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 13 Nov 2009 12:06:53 -0500 Received: from localhost.localdomain (vpn-9-167.rdu.redhat.com [10.11.9.167]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nADH6qfT010058; Fri, 13 Nov 2009 12:06:53 -0500 Date: Fri, 13 Nov 2009 12:06:52 -0500 From: Josef Bacik To: linux-btrfs@vger.kernel.org Cc: chris.mason@oracle.com Subject: [PATCH] Btrfs: fix possible panic on unmount Message-ID: <20091113170651.GD26371@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 2a4cdce..197bc1b 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -399,6 +399,8 @@ err: put_caching_control(caching_ctl); atomic_dec(&block_group->space_info->caching_threads); + btrfs_put_block_group(block_group); + return 0; } @@ -439,6 +441,7 @@ static int cache_block_group(struct btrfs_block_group_cache *cache) up_write(&fs_info->extent_commit_sem); atomic_inc(&cache->space_info->caching_threads); + atomic_inc(&cache->count); tsk = kthread_run(caching_kthread, cache, "btrfs-cache-%llu\n", cache->key.objectid);