Commit 4c79d556 authored by Mike Snitzer's avatar Mike Snitzer

dm vdo: fix how dm_kcopyd_client_create() failure is checked

dm_kcopyd_client_create() returns an ERR_PTR so its return must be
checked with IS_ERR().
Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
Signed-off-by: default avatarChung Chung <cchung@redhat.com>
Signed-off-by: default avatarMatthew Sakai <msakai@redhat.com>
parent 9165dac8
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/device-mapper.h> #include <linux/device-mapper.h>
#include <linux/err.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
...@@ -1683,8 +1684,11 @@ static int grow_layout(struct vdo *vdo, block_count_t old_size, block_count_t ne ...@@ -1683,8 +1684,11 @@ static int grow_layout(struct vdo *vdo, block_count_t old_size, block_count_t ne
/* Make a copy completion if there isn't one */ /* Make a copy completion if there isn't one */
if (vdo->partition_copier == NULL) { if (vdo->partition_copier == NULL) {
vdo->partition_copier = dm_kcopyd_client_create(NULL); vdo->partition_copier = dm_kcopyd_client_create(NULL);
if (vdo->partition_copier == NULL) if (IS_ERR(vdo->partition_copier)) {
return -ENOMEM; result = PTR_ERR(vdo->partition_copier);
vdo->partition_copier = NULL;
return result;
}
} }
/* Free any unused preparation. */ /* Free any unused preparation. */
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <linux/atomic.h> #include <linux/atomic.h>
#include <linux/bio.h> #include <linux/bio.h>
#include <linux/err.h>
#include <linux/log2.h> #include <linux/log2.h>
#include <linux/min_heap.h> #include <linux/min_heap.h>
#include <linux/minmax.h> #include <linux/minmax.h>
...@@ -3445,8 +3446,10 @@ static void initiate_load(struct admin_state *state) ...@@ -3445,8 +3446,10 @@ static void initiate_load(struct admin_state *state)
handle_operation_error, handle_operation_error,
allocator->thread_id, NULL); allocator->thread_id, NULL);
allocator->eraser = dm_kcopyd_client_create(NULL); allocator->eraser = dm_kcopyd_client_create(NULL);
if (allocator->eraser == NULL) { if (IS_ERR(allocator->eraser)) {
vdo_fail_completion(&allocator->completion, -ENOMEM); vdo_fail_completion(&allocator->completion,
PTR_ERR(allocator->eraser));
allocator->eraser = NULL;
return; return;
} }
allocator->slabs_to_erase = get_slab_iterator(allocator); allocator->slabs_to_erase = get_slab_iterator(allocator);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment