From 26d7fd0e3a4ca8940b57e3a419e8cb819d91c0b3 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 10 Mar 2019 01:10:11 +0000 Subject: [PATCH] scst: Do not suspend SCSI command processing when adding a device Since the only global data structure that is modified by the code that adds a device (scst_dev_list) is consistently protected by scst_mutex, suspending command processing when adding a device is not necessary. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8025 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_copy_mgr.c | 4 ---- scst/src/scst_lib.c | 6 +++--- scst/src/scst_main.c | 5 ----- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/scst/src/scst_copy_mgr.c b/scst/src/scst_copy_mgr.c index 5d3d3cb47..90eb25a7a 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -2547,7 +2547,6 @@ out: return res; } -/* scst_mutex supposed to be held and activities suspended */ static int scst_cm_dev_register(struct scst_device *dev, uint64_t lun) { int res, i; @@ -2556,7 +2555,6 @@ static int scst_cm_dev_register(struct scst_device *dev, uint64_t lun) TRACE_ENTRY(); - scst_assert_activity_suspended(); lockdep_assert_held(&scst_mutex); TRACE_DBG("dev %s, LUN %ld", dev->virt_name, (unsigned long)lun); @@ -2709,14 +2707,12 @@ out_unblock: goto out_resume; } -/* scst_mutex supposed to be held and activities suspended */ int scst_cm_on_dev_register(struct scst_device *dev) { int res = 0; TRACE_ENTRY(); - scst_assert_activity_suspended(); lockdep_assert_held(&scst_mutex); if (!scst_auto_cm_assignment || !dev->handler->auto_cm_assignment_possible) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 877b4e893..d726c84e7 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -4181,15 +4181,15 @@ static int scst_dif_none_type1(struct scst_cmd *cmd); #define scst_dif_none_type1 scst_dif_none #endif -/* Called under scst_mutex and suspended activity */ -int scst_alloc_device(gfp_t gfp_mask, int nodeid, - struct scst_device **out_dev) +int scst_alloc_device(gfp_t gfp_mask, int nodeid, struct scst_device **out_dev) { struct scst_device *dev; int res = 0; TRACE_ENTRY(); + lockdep_assert_held(&scst_mutex); + dev = kmem_cache_alloc_node(scst_dev_cachep, gfp_mask, nodeid); if (dev == NULL) { PRINT_ERROR("%s", "Allocation of scst_device failed"); diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 1abab803c..2c662ae8f 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -1347,10 +1347,6 @@ int scst_register_virtual_device_node(struct scst_dev_type *dev_handler, if (res != 0) goto out; - res = scst_suspend_activity(SCST_SUSPEND_TIMEOUT_USER); - if (res != 0) - goto out; - res = mutex_lock_interruptible(&scst_mutex); if (res != 0) goto out_resume; @@ -1419,7 +1415,6 @@ int scst_register_virtual_device_node(struct scst_dev_type *dev_handler, goto out_unreg; mutex_unlock(&scst_mutex); - scst_resume_activity(); res = dev->virt_id;