From df8d3d223a51f3ff72b43117c2f93781aeef69cf Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 19 Aug 2021 04:11:11 +0000 Subject: [PATCH 1/3] Debian: Fix Makefile syntax for 'make dpkg' git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9490 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- debian/rules | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/debian/rules b/debian/rules index c473fc9c8..0efc12da5 100755 --- a/debian/rules +++ b/debian/rules @@ -39,7 +39,8 @@ build: [ -n "$(QLA_INI_DIR)" ] && \ make 2release && \ export BUILD_2X_MODULE=y && \ - export CONFIG_SCSI_QLA_FC=y CONFIG_SCSI_QLA2XXX_TARGET=y && \ + export CONFIG_SCSI_QLA_FC=y && \ + export CONFIG_SCSI_QLA2XXX_TARGET=y && \ for d in $(SUBDIRS); do $(MAKE) -C $$d; done && \ { \ echo dkms.conf && \ @@ -59,7 +60,8 @@ install: export PREFIX=/usr && \ export DESTDIR="$(DESTDIR)" && \ export BUILD_2X_MODULE=y && \ - export CONFIG_SCSI_QLA_FC=y CONFIG_SCSI_QLA2XXX_TARGET=y && \ + export CONFIG_SCSI_QLA_FC=y && \ + export CONFIG_SCSI_QLA2XXX_TARGET=y && \ for d in $(SUBDIRS); do \ if [ $$d = scst ]; then \ { $(MAKE) -C $$d install || break; } \ From 6691b60c3983179194cabcd2539f7277e5dd417d Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 19 Aug 2021 04:12:36 +0000 Subject: [PATCH 2/3] scst: Fix copy manager LUN assignment for auto_cm_assignment=0 The INQUIRY command sent by the copy manager can only succeed if the LUN it is submitted to exists before the INQUIRY command is sent. Hence this patch that swaps the order of the scst_cm_on_add_lun() and scst_alloc_add_tgt_dev() calls in scst_acg_add_lun(). This patch prevents that the INQUIRY commands submitted by the copy manager fail as follows: Not supported dev type 7f, ignoring Reported-by: Eitan Cohen git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9491 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_lib.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 9010e1c78..3020bd570 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -4541,12 +4541,6 @@ int scst_acg_add_lun(struct scst_acg *acg, struct kobject *parent, list_add_tail(&acg_dev->acg_dev_list_entry, &acg->acg_dev_list); list_add_tail(&acg_dev->dev_acg_dev_list_entry, &dev->dev_acg_dev_list); - if (!(flags & SCST_ADD_LUN_CM)) { - res = scst_cm_on_add_lun(acg_dev, lun, &flags); - if (res != 0) - goto out_free; - } - list_for_each_entry(sess, &acg->acg_sess_list, acg_sess_list_entry) { res = scst_alloc_add_tgt_dev(sess, acg_dev, &tgt_dev); if (res == -EPERM) @@ -4558,6 +4552,12 @@ int scst_acg_add_lun(struct scst_acg *acg, struct kobject *parent, &tmp_tgt_dev_list); } + if (!(flags & SCST_ADD_LUN_CM)) { + res = scst_cm_on_add_lun(acg_dev, lun, &flags); + if (res != 0) + goto out_free; + } + res = scst_acg_dev_sysfs_create(acg_dev, parent); if (res != 0) goto out_on_del; From c11f216fedaa292567732adcd8a70ab231858e01 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 19 Aug 2021 04:15:16 +0000 Subject: [PATCH 3/3] scst_copy_mgr: Fix support for auto_cm_assignment=0 Only check whether a LUN has already been registered with the copy manager for the auto_cm_assignment=1 case since with auto CM assignment disabled scst_cm_dev_register() is called after the LUN has been registered. Reported-by: Eitan Cohen git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9492 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_copy_mgr.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scst/src/scst_copy_mgr.c b/scst/src/scst_copy_mgr.c index fd1f35e62..c21a83e32 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -2559,14 +2559,14 @@ static int scst_cm_dev_register(struct scst_device *dev, uint64_t lun) TRACE_DBG("dev %s, LUN %ld", dev->virt_name, (unsigned long)lun); - if (scst_cm_get_lun(dev) != SCST_MAX_LUN) { - TRACE_DBG("Copy Manager already registered device %s", - dev->virt_name); - res = 0; - goto out; - } - if (lun == SCST_MAX_LUN) { + if (scst_cm_get_lun(dev) != SCST_MAX_LUN) { + TRACE_DBG("Copy Manager already registered device %s", + dev->virt_name); + res = 0; + goto out; + } + add_lun = true; while (1) { lun = scst_cm_next_lun++;