diff --git a/lib/scsi/lun.c b/lib/scsi/lun.c index d382af448..9de263afa 100644 --- a/lib/scsi/lun.c +++ b/lib/scsi/lun.c @@ -280,7 +280,8 @@ spdk_scsi_lun_construct(const char *name, struct spdk_bdev *bdev) lun = spdk_lun_db_get_lun(name, 0); if (lun) { - return lun; + SPDK_ERRLOG("LUN %s already created\n", lun->name); + return NULL; } lun = calloc(1, sizeof(*lun)); diff --git a/test/lib/scsi/lun/lun_ut.c b/test/lib/scsi/lun/lun_ut.c index 7af3212ec..388fa234d 100644 --- a/test/lib/scsi/lun/lun_ut.c +++ b/test/lib/scsi/lun/lun_ut.c @@ -621,7 +621,7 @@ lun_construct_same_same_twice(void) lun2 = spdk_scsi_lun_construct("lun0", &bdev2); /* Fails to construct the same lun on another bdev and returns NULL */ - CU_ASSERT(lun2 != NULL); /* lun2 should be NULL, this shows it is not currently working */ + CU_ASSERT(lun2 == NULL); lun_destruct(lun);