scsi: spdk_scsi_lun_construct should return only new objects
This patch makes spdk_scsi_lun_construct behave as documented. spdk_scsi_lun_construct will return only newly created LUN. If LUN with that name already exists, NULL will be returned. Unit test relevant to this behaviour is now changed to show this functionality is now working. Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: I002903d6f96555c638aba3fa99cc2c2504ced603
This commit is contained in:
parent
90b0873665
commit
c210a81fd9
@ -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));
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user