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 <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/427559
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
paul luse 2018-10-01 19:15:18 -04:00 committed by Jim Harris
parent 9938bfaf03
commit 9a943bf864

11
lib/bdev/crypto/vbdev_crypto.c Normal file → Executable file
View File

@ -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) {