diff mbox

Btrfs: add missing free_extent_buffer

Message ID 1432545400-31871-1-git-send-email-bo.li.liu@oracle.com (mailing list archive)
State Superseded
Headers show

Commit Message

Liu Bo May 25, 2015, 9:16 a.m. UTC
read_tree_block may take a reference on the 'eb', a following
free_extent_buffer is necessary.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 fs/btrfs/extent-tree.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Sterba May 25, 2015, 12:31 p.m. UTC | #1
On Mon, May 25, 2015 at 05:16:40PM +0800, Liu Bo wrote:
> read_tree_block may take a reference on the 'eb', a following
> free_extent_buffer is necessary.
> 
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>

Reviewed-by: David Sterba <dsterba@suse.cz>

And I've spotted one more in btrfs_read_tree_root and 2 other
where it was not outright obvious from the code logic.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Sterba May 25, 2015, 12:33 p.m. UTC | #2
On Mon, May 25, 2015 at 02:31:56PM +0200, David Sterba wrote:
> On Mon, May 25, 2015 at 05:16:40PM +0800, Liu Bo wrote:
> > read_tree_block may take a reference on the 'eb', a following
> > free_extent_buffer is necessary.
> > 
> > Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> 
> Reviewed-by: David Sterba <dsterba@suse.cz>
> 
> And I've spotted one more in btrfs_read_tree_root and 2 other
> where it was not outright obvious from the code logic.

Ok, it's addressed in the following patches.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 8b353ad..bb8a221 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -7649,6 +7649,7 @@  walk_down:
 			eb = read_tree_block(root, child_bytenr, child_gen);
 			if (!eb || !extent_buffer_uptodate(eb)) {
 				ret = -EIO;
+				free_extent_buffer(eb);
 				goto out;
 			}