From 383ceb0a8ecf6c7b94954c1ff90ae4cd81e22cce Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Sat, 13 May 2017 03:30:07 +0000 Subject: [PATCH] scst: add module parameter to control the copy manager auto assignment Reported-By: Guru Prasad Suggested-By: Sebastian Herbszt git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7174 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/README | 10 ++++++++++ scst/README_in-tree | 10 ++++++++++ scst/src/scst_copy_mgr.c | 2 +- scst/src/scst_main.c | 4 ++++ scst/src/scst_priv.h | 1 + 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/scst/README b/scst/README index dcc60a67e..fe90af02e 100644 --- a/scst/README +++ b/scst/README @@ -398,6 +398,16 @@ Module scst supports the following parameters: to be consumed by all SCSI commands of a device at any given time. By default, it is approximately 2/5 of scst_max_cmd_mem. + - auto_cm_assignment - enables the copy managers auto registration. + If a device is not registered in the copy manager, it can not be + source or target of EXTENDED COPY commands. Enabled by default. + Disable, if you want to manually control the copy manager + registration or need to change a device, e.g. a DM cache device, with + SCST LUN on top of it to avoid extra reference the copy manager holds + on this device. In the later case you can also remove this reference + by manually deleting the corresponding copy manager LUN via sysfs interface + (/sys/kernel/scst_tgt/targets/copy_manager/copy_manager_tgt/luns/mgmt). + SCST sysfs interface -------------------- diff --git a/scst/README_in-tree b/scst/README_in-tree index 0b0731710..494c5a8b0 100644 --- a/scst/README_in-tree +++ b/scst/README_in-tree @@ -268,6 +268,16 @@ Module scst supports the following parameters: consumed by the SCST commands for data buffers at any given time. By default it is approximately TotalMem/4. + - auto_cm_assignment - enables the copy managers auto registration. + If a device is not registered in the copy manager, it can not be + source or target of EXTENDED COPY commands. Enabled by default. + Disable, if you want to manually control the copy manager + registration or need to change a device, e.g. a DM cache device, with + SCST LUN on top of it to avoid extra reference the copy manager holds + on this device. In the later case you can also remove this reference + by manually deleting the corresponding copy manager LUN via sysfs interface + (/sys/kernel/scst_tgt/targets/copy_manager/copy_manager_tgt/luns/mgmt). + SCST sysfs interface -------------------- diff --git a/scst/src/scst_copy_mgr.c b/scst/src/scst_copy_mgr.c index 4310c4ed1..d7206f43d 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -2709,7 +2709,7 @@ int scst_cm_on_dev_register(struct scst_device *dev) scst_assert_activity_suspended(); lockdep_assert_held(&scst_mutex); - if (!dev->handler->auto_cm_assignment_possible) + if (!scst_auto_cm_assignment || !dev->handler->auto_cm_assignment_possible) goto out; res = scst_cm_dev_register(dev, SCST_MAX_LUN); diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 8d672b79b..1440bc4b1 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -175,6 +175,7 @@ cpumask_t default_cpu_mask; static unsigned int scst_max_cmd_mem; unsigned int scst_max_dev_cmd_mem; int scst_forcibly_close_sessions; +int scst_auto_cm_assignment = true; module_param_named(scst_threads, scst_threads, int, S_IRUGO); MODULE_PARM_DESC(scst_threads, "SCSI target threads count"); @@ -193,6 +194,9 @@ MODULE_PARM_DESC(forcibly_close_sessions, "If enabled, close the sessions associated with an access control group (ACG)" " when an ACG is deleted via sysfs instead of returning -EBUSY"); +module_param_named(auto_cm_assignment, scst_auto_cm_assignment, int, + S_IWUSR | S_IRUGO); +MODULE_PARM_DESC(auto_cm_assignment, "Enables the copy managers auto registration"); struct scst_dev_type scst_null_devtype = { .name = "none", diff --git a/scst/src/scst_priv.h b/scst/src/scst_priv.h index 12698cbce..c3cb2fb33 100644 --- a/scst/src/scst_priv.h +++ b/scst/src/scst_priv.h @@ -151,6 +151,7 @@ extern int scst_threads; extern unsigned int scst_max_dev_cmd_mem; extern int scst_forcibly_close_sessions; +extern int scst_auto_cm_assignment; extern mempool_t *scst_mgmt_mempool; extern mempool_t *scst_mgmt_stub_mempool;