Commit 8215c0ac authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

scsi: spdk_scsi_dev_add_lun() checks if lun_id is less than max by itself



This is an effort to remove the dependency on the macro constant
SPDK_SCSI_DEV_MAX_LUN from lib/iscsi.

Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ieeff4136b16cc6bfa92614248f150bc9dfe3dc74
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9609


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarGangCao <gang.cao@intel.com>
parent f61d81e4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1283,8 +1283,8 @@ iscsi_tgt_node_add_lun(struct spdk_iscsi_tgt_node *target,
		return -1;
	}

	if (lun_id < -1 || lun_id >= SPDK_SCSI_DEV_MAX_LUN) {
		SPDK_ERRLOG("Specified LUN ID (%d) is invalid\n", lun_id);
	if (lun_id < -1) {
		SPDK_ERRLOG("Specified LUN ID (%d) is negative\n", lun_id);
		return -1;
	}

+5 −0
Original line number Diff line number Diff line
@@ -153,6 +153,11 @@ spdk_scsi_dev_add_lun_ext(struct spdk_scsi_dev *dev, const char *bdev_name, int
{
	struct spdk_scsi_lun *lun;

	if (lun_id >= SPDK_SCSI_DEV_MAX_LUN) {
		SPDK_ERRLOG("LUN ID %d is more than the maximum.\n", lun_id);
		return -1;
	}

	/* Search the lowest free LUN ID if LUN ID is default */
	if (lun_id == -1) {
		lun_id = scsi_dev_find_lowest_free_lun_id(dev);