From 9f7075ea8d0635e8d0a219a66a8ce9057c590b2c Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Mon, 19 Aug 2019 07:59:50 -0400 Subject: [PATCH] bdev: fix error path for allocating qos paramters Every exit path in spdk_bdev_set_qos_rate_limits() should go through _spdk_bdev_set_qos_limit_done() as soon as ctx is allocated and qos_mod_in_progress set to true. This patch fixes one path were it did not occur. With this change qos_mod_in_progress is set to false, when failure in allocating qos parameters occurs. Signed-off-by: Tomasz Zawadzki Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465659 (master) (cherry picked from commit cfc0fbf11e5f38a76b0e7112c9bd2d507d123279) Change-Id: I04a45dfdcde9160fd2701b44f5fde26fb0245177 Signed-off-by: Tomasz Zawadzki Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467138 Reviewed-by: Jim Harris Reviewed-by: Ben Walker Tested-by: SPDK CI Jenkins --- lib/bdev/bdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index 3d7481d20..ed4e8aabc 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -4779,8 +4779,7 @@ spdk_bdev_set_qos_rate_limits(struct spdk_bdev *bdev, uint64_t *limits, if (!bdev->internal.qos) { pthread_mutex_unlock(&bdev->internal.mutex); SPDK_ERRLOG("Unable to allocate memory for QoS tracking\n"); - free(ctx); - cb_fn(cb_arg, -ENOMEM); + _spdk_bdev_set_qos_limit_done(ctx, -ENOMEM); return; } }