From 9cd57cf50f611c4fe064c55b9319b7a69c9a4a9a Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 20 Apr 2016 02:48:28 +0000 Subject: [PATCH 1/8] Cleanup git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6860 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- usr/fileio/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/fileio/Makefile b/usr/fileio/Makefile index 6705f3496..231d2d81e 100644 --- a/usr/fileio/Makefile +++ b/usr/fileio/Makefile @@ -1,5 +1,5 @@ # -# SCSI target mid-level makefile +# Fileio_tgt user space dev handler make file # # Copyright (C) 2007 - 2016 Vladislav Bolkhovitin # Copyright (C) 2007 - 2016 SanDisk Corporation From 7219595e5cf7a130189c16165b0f205b12e30a52 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 20 Apr 2016 03:17:16 +0000 Subject: [PATCH 2/8] iscsi-scst: fix 2 minor main Makefile issues 1. Fix build of progs and mods targets, if iscsi_scst_itf_ver.h does not exist 2. Fix small race for parallel build of "all" target, when iscsi_scst_itf_ver.h not yet built, when progs or mods target need it git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6861 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iscsi-scst/Makefile b/iscsi-scst/Makefile index d1969de05..745cad781 100644 --- a/iscsi-scst/Makefile +++ b/iscsi-scst/Makefile @@ -50,7 +50,7 @@ endif INSTALL_DIR := $(INSTALL_MOD_PATH)/lib/modules/$(KVER)/extra INFINIBAND_ENABLED := $(shell if grep -q '^CONFIG_INFINIBAND=[my]$$' $(KDIR)/.config; then echo true; else echo false; fi) -all: include/iscsi_scst_itf_ver.h progs mods +all: progs mods ISER_SYMVERS:=$(KMOD)/Module.symvers OFED_CFLAGS:= @@ -103,7 +103,7 @@ endif CREATE_CQ_FLAG = $(shell $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/conftest/create_cq PRE_CFLAGS="$(OFED_CFLAGS) -Werror" >/dev/null 2>&1 && echo -DIB_CREATE_CQ_HAS_INIT_ATTR) PRE_CFLAGS=$(OFED_CFLAGS) $(CREATE_CQ_FLAG) -DOFED_FLAVOR=$(OFED_FLAVOR) -mods: Modules.symvers Module.symvers +mods: include/iscsi_scst_itf_ver.h Modules.symvers Module.symvers $(MAKE) -C $(KDIR) SCST_INC_DIR=$(SCST_INC_DIR) SUBDIRS=$(KMOD) modules if $(INFINIBAND_ENABLED); then \ echo " Building against $(OFED_FLAVOR) InfiniBand kernel headers."; \ @@ -112,7 +112,7 @@ mods: Modules.symvers Module.symvers KBUILD_EXTRA_SYMBOLS=$(ISER_SYMVERS) modules; \ fi -progs: +progs: include/iscsi_scst_itf_ver.h $(MAKE) -C usr SCST_INC_DIR=$(SCST_INC_DIR) include/iscsi_scst_itf_ver.h: include/iscsi_scst.h From 9ead865f6a14079affc090f7fe4ebeed8fafca20 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 20 Apr 2016 03:44:21 +0000 Subject: [PATCH 3/8] Cleanup git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6862 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_lib.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 973c7f1f1..f40661b6a 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -4527,10 +4527,7 @@ out: return res; } -/* - * Either add or replace a LUN. The repl_gen_ua argument controls whether or - * not a unit attention is triggered if LUN reassignment is performed. - */ +/* Either add or replace a LUN according to flags argument */ int scst_acg_repl_lun(struct scst_acg *acg, struct kobject *parent, struct scst_device *dev, uint64_t lun, unsigned int flags) From fb0ad0b8cd854585f7362ce023209dbd0f1477e7 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 20 Apr 2016 04:00:00 +0000 Subject: [PATCH 4/8] scst_user: improve backward compatibility with handlers relying on obsolete SCST_USER_UNREGISTER_DEVICE call git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6863 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_user.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index dc2e7e7a3..33a2cc7ed 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -3533,9 +3533,23 @@ out_put: static int dev_user_unregister_dev(struct file *file) { + struct scst_user_dev *dev; + int res; + + dev = file->private_data; + res = dev_user_check_reg(dev); + if (unlikely(res != 0)) + goto out; + PRINT_WARNING("SCST_USER_UNREGISTER_DEVICE is obsolete and NOOP. " "Closing fd should be used instead."); - return 0; + + /* For backward compatibility unblock possibly blocked sync threads */ + dev->blocking = 0; + wake_up_all(&dev->udev_cmd_threads.cmd_list_waitQ); + +out: + return res; } static int dev_user_flush_cache(struct file *file) From fae8fb74b0e8e06d15432a9165a302baa1895fad Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 20 Apr 2016 04:21:59 +0000 Subject: [PATCH 5/8] scst: cleanups and clarifications git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6864 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/scst.h | 8 ++++++-- scst/src/dev_handlers/scst_vdisk.c | 7 +++++++ scst/src/scst_tg.c | 7 ++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/scst/include/scst.h b/scst/include/scst.h index c1dffdd98..31e78d323 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -1453,7 +1453,9 @@ struct scst_dev_type { * be started. Can be used to close open file handlers, which might * prevent the state switch. * - * Called under scst_dg_mutex and no activities on the dev handler level. + * Called under scst_dg_mutex and no activities on the dev handler level + * (for implicit ALUA case supposed to be done by the user space via + * "block" sysfs attribute as described in the README). * * OPTIONAL */ @@ -1465,7 +1467,9 @@ struct scst_dev_type { * be finished. Can be used to (re)open file handlers closed in * on_alua_state_change_start(). * - * Called under scst_dg_mutex and no activities on the dev handler level. + * Called under scst_dg_mutex and no activities on the dev handler level + * (for implicit ALUA case supposed to be done by the user space via + * "block" sysfs attribute as described in the README). * * OPTIONAL */ diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 380e1729a..892cae1d9 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -145,6 +145,13 @@ static struct scst_trace_log vdisk_local_trace_tbl[] = { struct scst_vdisk_dev { uint64_t nblocks; + + /* + * Not protected, because assignments to aligned 64-bit integers are + * atomic. At worst, accesses to it should be covered by ACCESS_ONCE(), + * but not sure if that is really needed, so would prefer to keep it + * away from the fast path. + */ loff_t file_size; /* in bytes */ /* diff --git a/scst/src/scst_tg.c b/scst/src/scst_tg.c index b8cc4456c..cb65574eb 100644 --- a/scst/src/scst_tg.c +++ b/scst/src/scst_tg.c @@ -954,7 +954,8 @@ out_fail: * group @tg->dg. */ static void __scst_tg_set_state(struct scst_target_group *tg, - enum scst_tg_state state) + enum scst_tg_state state, + bool call_on_alua_state_change) { struct scst_dg_dev *dg_dev; struct scst_device *dev; @@ -1018,7 +1019,7 @@ int scst_tg_set_state(struct scst_target_group *tg, enum scst_tg_state state) if (res) goto out; - __scst_tg_set_state(tg, state); + __scst_tg_set_state(tg, state, true); mutex_unlock(&scst_dg_mutex); out: @@ -1325,7 +1326,7 @@ static void __scst_dg_remove(struct scst_dev_group *dg) list_del(&dg->entry); scst_dg_sysfs_del(dg); list_for_each_entry(tg, &dg->tg_list, entry) - __scst_tg_set_state(tg, SCST_TG_STATE_OPTIMIZED); + __scst_tg_set_state(tg, SCST_TG_STATE_OPTIMIZED, false); while (!list_empty(&dg->dev_list)) { dgdev = list_first_entry(&dg->dev_list, struct scst_dg_dev, entry); From fce796459633d56b5f0235936d83c2fa053ebbff Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 20 Apr 2016 04:29:34 +0000 Subject: [PATCH 6/8] scst: decrease severity of "Copy Manager already registered" message, because it is harmless git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6865 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_copy_mgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scst/src/scst_copy_mgr.c b/scst/src/scst_copy_mgr.c index 80ca7e8cb..f2b7eb476 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -2535,7 +2535,7 @@ static int scst_cm_dev_register(struct scst_device *dev, uint64_t lun) list_for_each_entry(tgt_dev, head, sess_tgt_dev_list_entry) { if (tgt_dev->dev == dev) { - PRINT_ERROR("Copy Manager already registered " + TRACE_DBG("Copy Manager already registered " "device %s", dev->virt_name); res = -EEXIST; goto out; From 10f01feb982ef35fc0905fb1d2d18f4bd9a37331 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 20 Apr 2016 04:34:43 +0000 Subject: [PATCH 7/8] Follow-up for the previous commit git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6866 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_copy_mgr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scst/src/scst_copy_mgr.c b/scst/src/scst_copy_mgr.c index f2b7eb476..62fdb781a 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -2535,9 +2535,13 @@ static int scst_cm_dev_register(struct scst_device *dev, uint64_t lun) list_for_each_entry(tgt_dev, head, sess_tgt_dev_list_entry) { if (tgt_dev->dev == dev) { + /* + * It's OK, because the copy manager could + * auto register some devices + */ TRACE_DBG("Copy Manager already registered " "device %s", dev->virt_name); - res = -EEXIST; + res = 0; goto out; } } From f97c54e690f6ca5d4b086cd5b526dc010a329399 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 20 Apr 2016 04:52:58 +0000 Subject: [PATCH 8/8] scstadmin: prevent saving statistical dif_checks_failed attribute From Marc Smith git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6867 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scstadmin/scstadmin.sysfs/scstadmin | 1 + 1 file changed, 1 insertion(+) diff --git a/scstadmin/scstadmin.sysfs/scstadmin b/scstadmin/scstadmin.sysfs/scstadmin index b6bac0e8d..e65ce3fc8 100755 --- a/scstadmin/scstadmin.sysfs/scstadmin +++ b/scstadmin/scstadmin.sysfs/scstadmin @@ -1499,6 +1499,7 @@ sub serializeNkAttr { || defined($attr_filter) && defined($$attr_filter{$attribute})) && !defined($$attributes{$attribute}->{'keys'}) + && $attribute ne 'dif_checks_failed' && $attribute ne 'enabled' && $attribute ne 'hw_target') { my $value = $$attributes{$attribute}->{'value'};