linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Bo <liubo2009@cn.fujitsu.com>
To: <chris.mason@fusionio.com>
Cc: <linux-btrfs@vger.kernel.org>
Subject: [PATCH 04/10 RESEND] Btrfs: avoid memory leak of extent state in error handling routine
Date: Thu, 14 Jun 2012 16:23:20 +0800	[thread overview]
Message-ID: <1339662206-5307-5-git-send-email-liubo2009@cn.fujitsu.com> (raw)
In-Reply-To: <1339662206-5307-1-git-send-email-liubo2009@cn.fujitsu.com>

We've forgotten to clear extent states in pinned tree, which will results in
space counter mismatch and memory leak:

WARNING: at fs/btrfs/extent-tree.c:7537 btrfs_free_block_groups+0x1f3/0x2e0 [btrfs]()
...
space_info 2 has 8380416 free, is not full
space_info total=12582912, used=4096, pinned=4096, reserved=0, may_use=0, readonly=4194304
btrfs state leak: start 29364224 end 29376511 state 1 in tree ffff880075f20090 refs 1
...

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
---
 fs/btrfs/disk-io.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index b99d512..1030cff 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3600,6 +3600,8 @@ void btrfs_cleanup_one_transaction(struct btrfs_transaction *cur_trans,
 
 	btrfs_destroy_marked_extents(root, &cur_trans->dirty_pages,
 				     EXTENT_DIRTY);
+	btrfs_destroy_pinned_extent(root,
+				    root->fs_info->pinned_extents);
 
 	/*
 	memset(cur_trans, 0, sizeof(*cur_trans));
-- 
1.6.5.2


  parent reply	other threads:[~2012-06-14  8:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-14  8:23 [GIT PULL][PATCH 00/10] bug-fixes and cleanups Liu Bo
2012-06-14  8:23 ` [PATCH 01/10] Btrfs: remove unused FS_NOCOMP_FL check in setflags and getflags Liu Bo
2012-06-14 10:03   ` David Sterba
2012-06-14  8:23 ` [PATCH 02/10] Btrfs: fix missing inherited flag in rename Liu Bo
2012-06-14 10:12   ` David Sterba
2012-06-14  8:23 ` [PATCH 03/10 RESEND] Btrfs: do not resize a seeding device Liu Bo
2012-06-14  8:23 ` Liu Bo [this message]
2012-06-14  8:23 ` [PATCH 05/10 RESEND] Btrfs: make sure that we've made everything in pinned tree clean Liu Bo
2012-06-14  8:23 ` [PATCH 06/10 RESEND] Btrfs: destroy the items of the delayed inodes in error handling routine Liu Bo
2012-06-14  8:23 ` [PATCH 07/10 trival] Btrfs: fix typo in btrfs_finish_ordered_io Liu Bo
2012-06-14  8:23 ` [PATCH 08/10 trival] Btrfs: fix typo in cow_file_range_async Liu Bo
2012-06-14 10:17   ` David Sterba
2012-06-14 11:11     ` Liu Bo
2012-06-14  8:23 ` [PATCH 09/10] Btrfs: update MAINTAINERS info for BTRFS FILE SYSTEM Liu Bo
2012-06-14  8:23 ` [PATCH 10/10] Btrfs: use wrapper page_offset Liu Bo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1339662206-5307-5-git-send-email-liubo2009@cn.fujitsu.com \
    --to=liubo2009@cn.fujitsu.com \
    --cc=chris.mason@fusionio.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).