FAILED: patch "[PATCH] btrfs: return error pointer from alloc_test_extent_buffer" failed to apply to 4.19-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From b6293c821ea8fa2a631a2112cd86cd435effeb8b Mon Sep 17 00:00:00 2001
From: Dan Carpenter <[email protected]>
Date: Tue, 3 Dec 2019 14:24:58 +0300
Subject: [PATCH] btrfs: return error pointer from alloc_test_extent_buffer
Callers of alloc_test_extent_buffer have not correctly interpreted the return value as error pointer, as alloc_test_extent_buffer should behave as alloc_extent_buffer. The self-tests were unaffected but btrfs_find_create_tree_block could call both functions and that would cause problems up in the call chain.
fs/btrfs/extent_io.c +4 -2
@@ -5074,12 +5074,14 @@ struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info,return eb; eb =alloc_dummy_extent_buffer (fs_info, start);if (!eb) -return NULL ; +return ERR_PTR (-ENOMEM ); eb->fs_info = fs_info; again: ret =radix_tree_preload (GFP_NOFS ); -if (ret) +if (ret) { + exists =ERR_PTR (ret); goto free_eb; + }spin_lock (&fs_info->buffer_lock); ret =radix_tree_insert (&fs_info->buffer_radix, start >>PAGE_SHIFT , eb);
fs/btrfs/tests/free-space-tree-tests.c +2 -2
@@ -452,9 +452,9 @@ static int run_test(test_func_t test_func, int bitmaps, u32 sectorsize, root->fs_info->tree_root = root; root->node =alloc_test_extent_buffer (root->fs_info, nodesize); -if (!root->node) { +if (IS_ERR (root->node)) {test_std_err (TEST_ALLOC_EXTENT_BUFFER ); - ret = -ENOMEM ; + ret =PTR_ERR (root->node); goto out; }btrfs_set_header_level (root->node,0 );
fs/btrfs/tests/qgroup-tests.c +2 -2
@@ -484,9 +484,9 @@ int btrfs_test_qgroups(u32 sectorsize, u32 nodesize)* *cough*backref walking code*cough* */ root->node =alloc_test_extent_buffer (root->fs_info, nodesize); -if (!root->node) { +if (IS_ERR (root->node)) {test_err ("couldn't allocate dummy buffer" ); - ret = -ENOMEM ; + ret =PTR_ERR (root->node); goto out; }btrfs_set_header_level (root->node,0 );
Sasha Levin
maintainerQuoted 23 lines · On Mon, Dec 23, 2019 at 12:12:39PM -0500, [email protected] wrote:
The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From
b6293c821ea8fa2a631a2112cd86cd435effeb8bMon Sep 17 00:00:00 2001
From: Dan Carpenter <[email protected]>
Date: Tue, 3 Dec 2019 14:24:58 +0300
Subject: [PATCH] btrfs: return error pointer fromalloc_test_extent_bufferCallers of
alloc_test_extent_bufferhave not correctly interpreted the return value as error pointer, asalloc_test_extent_buffershould behave asalloc_extent_buffer. The self-tests were unaffected butbtrfs_find_create_tree_blockcould call both functions and that would cause problems up in the call chain.
Quoted 5 lines
Fixes faa2dbf004e8 ("Btrfs: add sanity tests for new qgroup accounting code")CC [email protected] # 4.4+Signed-off-by Dan Carpenter <[email protected]>Reviewed-by David Sterba <[email protected]>Signed-off-by David Sterba <[email protected]>
Few conflicts on the backport mostly due to message formatting (such as 9e3d9f8462ef ("btrfs: tests: use standard error message after extent buffer allocation failure") ). I've fixed them up and queued for 4.19-4.4.
Signature · 2 lines
Thanks, Sasha