bdev/passthru: check early for duplicate passthru bdev names
The bdev layer will sort of check this when we try to register the bdev, but it's better to catch this much earlier. That way we catch it when the name gets inserted into the list, rather than when the base bdev appears. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I846cb138fa848078d2c76356273870c607d79548 Reviewed-on: https://review.gerrithub.io/432602 Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
bd02b6ab4e
commit
0d8783cabc
@ -378,6 +378,13 @@ vbdev_passthru_insert_name(const char *bdev_name, const char *vbdev_name)
|
||||
{
|
||||
struct bdev_names *name;
|
||||
|
||||
TAILQ_FOREACH(name, &g_bdev_names, link) {
|
||||
if (strcmp(vbdev_name, name->vbdev_name) == 0) {
|
||||
SPDK_ERRLOG("passthru bdev %s already exists\n", vbdev_name);
|
||||
return -EEXIST;
|
||||
}
|
||||
}
|
||||
|
||||
name = calloc(1, sizeof(struct bdev_names));
|
||||
if (!name) {
|
||||
SPDK_ERRLOG("could not allocate bdev_names\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user