From: David Sterba <dsterba@suse.cz>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.cz>
Subject: [PATCH 6/6] btrfs: send: remove BUG_ON from name_cache_delete
Date: Mon, 3 Feb 2014 19:24:40 +0100 [thread overview]
Message-ID: <53d81c36c0cffde8dd11199986eebae576a0f6be.1391447200.git.dsterba@suse.cz> (raw)
In-Reply-To: <cover.1391447200.git.dsterba@suse.cz>
If cleaning the name cache fails, we could try to proceed at the cost of
some memory leak. This is not expected to happen often.
Signed-off-by: David Sterba <dsterba@suse.cz>
---
fs/btrfs/send.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index b0bf4ff40b5b..7b17b778eaf7 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1849,13 +1849,20 @@ static void name_cache_delete(struct send_ctx *sctx,
nce_head = radix_tree_lookup(&sctx->name_cache,
(unsigned long)nce->ino);
- BUG_ON(!nce_head);
+ if (!nce_head) {
+ btrfs_err(sctx->send_root->fs_info,
+ "name_cache_delete lookup failed ino %llu cache size %d, leaking memory",
+ nce->ino, sctx->name_cache_size);
+ }
list_del(&nce->radix_list);
list_del(&nce->list);
sctx->name_cache_size--;
- if (list_empty(nce_head)) {
+ /*
+ * We may not get to the final release of nce_head if the lookup fails
+ */
+ if (nce_head && list_empty(nce_head)) {
radix_tree_delete(&sctx->name_cache, (unsigned long)nce->ino);
kfree(nce_head);
}
--
1.7.9
prev parent reply other threads:[~2014-02-03 18:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-03 18:21 [PATCH 0/6] Btrfs send updates - reduce memory consumption David Sterba
2014-02-03 18:23 ` [PATCH 1/6] btrfs: send: remove prepared member from fs_path David Sterba
2014-02-03 18:23 ` [PATCH 2/6] btrfs: send: remove virtual_mem " David Sterba
2014-02-03 18:23 ` [PATCH 3/6] btrfs: send: squeeze bitfilelds in fs_path David Sterba
2014-02-03 18:23 ` [PATCH 4/6] btrfs: send: lower memory requirements in common case David Sterba
2014-02-03 18:24 ` [PATCH 5/6] btrfs: send: remove BUG from process_all_refs David Sterba
2014-02-03 18:24 ` David Sterba [this message]
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=53d81c36c0cffde8dd11199986eebae576a0f6be.1391447200.git.dsterba@suse.cz \
--to=dsterba@suse.cz \
--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).