From 9a943bf8649cea87fc7a3987b2c50c46b6d72141 Mon Sep 17 00:00:00 2001 From: paul luse Date: Mon, 1 Oct 2018 19:15:18 -0400 Subject: [PATCH] crypto: don't stop the examine process because of a claim error In the crypto examine function we first try to claim the bdev that's presented. If the claim fails, we were returning immediately which was incorrect because the examine function needs to look at the entire global list of vbdevs. The scenario that caught this was testing a duplicate underlying bdev name in the conf file. In that case, before this fix, the claim on the first crypto bdev worked but on the second it failed so the bdev layer never added the good one to its global list so on exit it would try to remove the crypto vbdev from the list but it was never added (because it gets added when registered which we were bailing so soon before that it never happened). Addresses github #448. Change-Id: I4e9ff9649101eb7caccfb33c2d1961921909555a Signed-off-by: paul luse Reviewed-on: https://review.gerrithub.io/427559 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- lib/bdev/crypto/vbdev_crypto.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) mode change 100644 => 100755 lib/bdev/crypto/vbdev_crypto.c diff --git a/lib/bdev/crypto/vbdev_crypto.c b/lib/bdev/crypto/vbdev_crypto.c old mode 100644 new mode 100755 index 506ccf87a..d75ecf35c --- a/lib/bdev/crypto/vbdev_crypto.c +++ b/lib/bdev/crypto/vbdev_crypto.c @@ -1129,7 +1129,7 @@ create_crypto_disk(const char *bdev_name, const char *vbdev_name, bdev = spdk_bdev_get_by_name(bdev_name); rc = vbdev_crypto_insert_name(bdev_name, vbdev_name, crypto_pmd, key); - if (rc != 0) { + if (rc) { return rc; } @@ -1139,13 +1139,11 @@ create_crypto_disk(const char *bdev_name, const char *vbdev_name, rc = vbdev_crypto_claim(bdev); if (rc) { - SPDK_ERRLOG("Error claiming bdev\n"); return rc; } rc = vbdev_crypto_init_crypto_drivers(); if (rc) { - SPDK_ERRLOG("Error setting up crypto devices\n"); return rc; } @@ -1484,12 +1482,7 @@ vbdev_crypto_examine(struct spdk_bdev *bdev) struct vbdev_crypto *crypto_bdev, *tmp; int rc; - rc = vbdev_crypto_claim(bdev); - if (rc) { - SPDK_ERRLOG("could not claim bdev\n"); - spdk_bdev_module_examine_done(&crypto_if); - return; - } + vbdev_crypto_claim(bdev); TAILQ_FOREACH_SAFE(crypto_bdev, &g_vbdev_crypto, link, tmp) { if (strcmp(crypto_bdev->base_bdev->name, bdev->name) == 0) {