From patchwork Thu Jun 23 19:54:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 913742 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5NJtdX8001086 for ; Thu, 23 Jun 2011 19:55:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933781Ab1FWTzg (ORCPT ); Thu, 23 Jun 2011 15:55:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29450 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933615Ab1FWTzf (ORCPT ); Thu, 23 Jun 2011 15:55:35 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p5NJtZHo026943 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 23 Jun 2011 15:55:35 -0400 Received: from prometheus.lab.eng.rdu.redhat.com (prometheus.lab.eng.rdu.redhat.com [10.10.9.73]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p5NJtZnV020942 for ; Thu, 23 Jun 2011 15:55:35 -0400 From: Josef Bacik To: linux-btrfs@vger.kernel.org Subject: [PATCH] Btrfs: make sure to update total_bitmaps when freeing cache V2 Date: Thu, 23 Jun 2011 15:54:26 -0400 Message-Id: <1308858866-24124-1-git-send-email-josef@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 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 (demeter2.kernel.org [140.211.167.43]); Thu, 23 Jun 2011 19:55:39 +0000 (UTC) A user reported this bug again where we have more bitmaps than we are supposed to. This is because we failed to load the free space cache, but don't update the ctl->total_bitmaps counter when we remove entries from the tree. This patch fixes this problem and we should be good to go again. Thanks, Signed-off-by: Josef Bacik --- V1->V2: made the patch actually correct fs/btrfs/free-space-cache.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 3c1a047..e7987f9 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -1843,7 +1843,11 @@ void __btrfs_remove_free_space_cache_locked(struct btrfs_free_space_ctl *ctl) while ((node = rb_last(&ctl->free_space_offset)) != NULL) { info = rb_entry(node, struct btrfs_free_space, offset_index); unlink_free_space(ctl, info); - kfree(info->bitmap); + if (info->bitmap) { + kfree(info->bitmap); + ctl->total_bitmaps--; + ctl->op->recalc_thresholds(ctl); + } kmem_cache_free(btrfs_free_space_cachep, info); if (need_resched()) { spin_unlock(&ctl->tree_lock);