From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH 5/5] btrfs: do not leak reloc root if we fail to read the fs root
Date: Fri, 6 Dec 2019 09:37:18 -0500 [thread overview]
Message-ID: <20191206143718.167998-6-josef@toxicpanda.com> (raw)
In-Reply-To: <20191206143718.167998-1-josef@toxicpanda.com>
If we fail to read the fs root corresponding with a reloc root we'll
just break out and free the reloc roots. But we remove our current
reloc_root from this list higher up, which means we'll leak this
reloc_root. Fix this by adding ourselves back to the reloc_roots list
so we are properly cleaned up.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
fs/btrfs/relocation.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index a857fc8271d2..c5fcddad1c15 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -4554,6 +4554,7 @@ int btrfs_recover_relocation(struct btrfs_root *root)
fs_root = read_fs_root(fs_info, reloc_root->root_key.offset);
if (IS_ERR(fs_root)) {
err = PTR_ERR(fs_root);
+ list_add_tail(&reloc_root->root_list, &reloc_roots);
goto out_free;
}
--
2.23.0
next prev parent reply other threads:[~2019-12-06 14:37 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-06 14:37 [PATCH 0/5] Various fixes Josef Bacik
2019-12-06 14:37 ` [PATCH 1/5] btrfs: drop log root for dropped roots Josef Bacik
2019-12-06 15:02 ` Filipe Manana
2019-12-06 15:03 ` Nikolay Borisov
2019-12-09 17:39 ` David Sterba
2019-12-10 20:05 ` Josef Bacik
2019-12-10 21:19 ` Nikolay Borisov
2019-12-10 21:28 ` Josef Bacik
2019-12-13 15:17 ` David Sterba
2019-12-06 14:37 ` [PATCH 2/5] btrfs: don't BUG_ON in create_subvol Josef Bacik
2019-12-06 15:03 ` Filipe Manana
2019-12-09 10:49 ` Johannes Thumshirn
2019-12-06 14:37 ` [PATCH 3/5] btrfs: handle ENOENT in btrfs_uuid_tree_iterate Josef Bacik
2019-12-06 15:13 ` Filipe Manana
2019-12-06 15:17 ` Josef Bacik
2019-12-06 16:39 ` [PATCH 3/5][v2] " Josef Bacik
2019-12-06 16:46 ` Filipe Manana
2019-12-09 10:52 ` Johannes Thumshirn
2019-12-06 14:37 ` [PATCH 4/5] btrfs: skip log replay on orphaned roots Josef Bacik
2019-12-06 15:23 ` Filipe Manana
2019-12-06 14:37 ` Josef Bacik [this message]
2019-12-06 15:24 ` [PATCH 5/5] btrfs: do not leak reloc root if we fail to read the fs root Filipe Manana
2019-12-09 10:58 ` Johannes Thumshirn
2019-12-09 18:16 ` [PATCH 0/5] Various fixes David Sterba
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=20191206143718.167998-6-josef@toxicpanda.com \
--to=josef@toxicpanda.com \
--cc=kernel-team@fb.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