From 545ae845f4042c107dc06727ac7e6ee82bb7c36a Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 11 Oct 2021 20:22:27 +0000 Subject: [PATCH] scst_copy_mgr: Do not suspend activity when adding a LUN to the copy manager scst_cm_update_dev() calls - scst_cm_dev_unregister(dev, false) - scst_block_dev() - scst_cm_get_lun() - scst_cm_send_init_inquiry() Due to commit 3e64094b ("scst_sysfs: Do not suspend I/O for LUN management") scst_cm_dev_unregister() and scst_cm_get_lun() can be performed safely without suspending SCSI command processing. scst_block_dev() and scst_cm_send_init_inquiry() doesn't need SCST to be suspended since scst_cm_dev_register(), which similarly calls them, doesn't need to. Signed-off-by: Chesnokov Gleb [ bvanassche: modified patch title ] git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9583 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_copy_mgr.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/scst/src/scst_copy_mgr.c b/scst/src/scst_copy_mgr.c index 8a1a3fa13..68a462ce2 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -2494,7 +2494,7 @@ out_free: goto out; } -/* scst_mutex supposed to be held and activities suspended */ +/* scst_mutex supposed to be held */ static bool scst_cm_is_lun_free(unsigned int lun) { bool res = true; @@ -2516,7 +2516,7 @@ static bool scst_cm_is_lun_free(unsigned int lun) return res; } -/* scst_mutex supposed to be held and activities suspended */ +/* scst_mutex supposed to be held */ static unsigned int scst_cm_get_lun(const struct scst_device *dev) { unsigned int res = SCST_MAX_LUN; @@ -2612,7 +2612,7 @@ out_err: goto out; } -/* scst_mutex supposed to be held and activities suspended */ +/* scst_mutex supposed to be held */ static void scst_cm_dev_unregister(struct scst_device *dev, bool del_lun) { struct scst_cm_desig *des, *t; @@ -2647,7 +2647,7 @@ out: void scst_cm_update_dev(struct scst_device *dev) { unsigned int lun; - int rc, res; + int rc; TRACE_ENTRY(); @@ -2657,9 +2657,6 @@ void scst_cm_update_dev(struct scst_device *dev) !dev->handler->auto_cm_assignment_possible) goto out; - res = scst_suspend_activity(SCST_SUSPEND_TIMEOUT_UNLIMITED); - WARN_ON_ONCE(res); - mutex_lock(&scst_mutex); scst_cm_dev_unregister(dev, false); @@ -2681,9 +2678,8 @@ void scst_cm_update_dev(struct scst_device *dev) if (rc != 0) goto out_unblock; -out_resume: +out_unlock: mutex_unlock(&scst_mutex); - scst_resume_activity(); out: TRACE_EXIT(); @@ -2693,7 +2689,7 @@ out_unblock: spin_lock_bh(&dev->dev_lock); scst_unblock_dev(dev); spin_unlock_bh(&dev->dev_lock); - goto out_resume; + goto out_unlock; } int scst_cm_on_dev_register(struct scst_device *dev) @@ -2726,7 +2722,7 @@ void scst_cm_on_dev_unregister(struct scst_device *dev) return; } -/* scst_mutex supposed to be held and activities suspended */ +/* scst_mutex supposed to be held */ int scst_cm_on_add_acg(struct scst_acg *acg) { int res = 0; @@ -2760,7 +2756,7 @@ void scst_cm_on_del_acg(struct scst_acg *acg) /* Nothing to do */ } -/* scst_mutex supposed to be held and activities suspended */ +/* scst_mutex supposed to be held */ int scst_cm_on_add_lun(struct scst_acg_dev *acg_dev, uint64_t lun, unsigned int *flags) { @@ -2788,7 +2784,7 @@ out: return res; } -/* scst_mutex supposed to be held and activities suspended */ +/* scst_mutex supposed to be held */ bool scst_cm_on_del_lun(struct scst_acg_dev *acg_dev, bool gen_report_luns_changed) { bool res = gen_report_luns_changed;