diff --git a/scst/src/scst_copy_mgr.c b/scst/src/scst_copy_mgr.c index 96f7ab026..64a0c0c07 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -2498,6 +2498,7 @@ out_free: goto out; } +/* scst_mutex supposed to be held and activities suspended */ static bool scst_cm_is_lun_free(unsigned int lun) { bool res = true; @@ -2519,6 +2520,7 @@ static bool scst_cm_is_lun_free(unsigned int lun) return res; } +/* scst_mutex supposed to be held and activities suspended */ static unsigned int scst_cm_get_lun(const struct scst_device *dev) { unsigned int res = SCST_MAX_LUN; @@ -2549,6 +2551,7 @@ 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; @@ -2628,6 +2631,7 @@ out_err: goto out; } +/* scst_mutex supposed to be held and activities suspended */ static void scst_cm_dev_unregister(struct scst_device *dev, bool del_lun) { int i; @@ -2709,6 +2713,7 @@ 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; @@ -2728,6 +2733,7 @@ out: return res; } +/* scst_mutex supposed to be held and activities suspended */ void scst_cm_on_dev_unregister(struct scst_device *dev) { TRACE_ENTRY(); @@ -2741,6 +2747,7 @@ void scst_cm_on_dev_unregister(struct scst_device *dev) return; } +/* scst_mutex supposed to be held and activities suspended */ int scst_cm_on_add_acg(struct scst_acg *acg) { int res = 0; @@ -2766,6 +2773,7 @@ out: return res; } +/* scst_mutex supposed to be held and activities suspended */ void scst_cm_on_del_acg(struct scst_acg *acg) { scst_assert_activity_suspended(); @@ -2773,6 +2781,7 @@ void scst_cm_on_del_acg(struct scst_acg *acg) /* Nothing to do */ } +/* scst_mutex supposed to be held and activities suspended */ int scst_cm_on_add_lun(struct scst_acg_dev *acg_dev, uint64_t lun, unsigned int *flags) { @@ -2800,6 +2809,7 @@ out: return res; } +/* scst_mutex supposed to be held and activities suspended */ bool scst_cm_on_del_lun(struct scst_acg_dev *acg_dev, bool gen_report_luns_changed) { bool res = gen_report_luns_changed; @@ -2820,6 +2830,7 @@ out: return res; } +/* scst_mutex2 supposed to be held */ static bool scst_cm_check_access_acg(const char *initiator_name, const struct scst_device *dev, const struct scst_acg *acg, bool default_acg) diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index cddb15809..98f7b13f9 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -1270,10 +1270,7 @@ static struct scst_device *__scst_lookup_device(struct scsi_device *scsidp) return NULL; } -static void scst_unregister_device(struct scsi_device *scsidp, - void (*on_free)(struct scst_device *dev, - void *arg), - void *arg) +static void scst_unregister_device(struct scsi_device *scsidp) { struct scst_device *dev; struct scst_acg_dev *acg_dev, *aa; @@ -1329,9 +1326,6 @@ static void scst_unregister_device(struct scsi_device *scsidp, scsidp->host->host_no, scsidp->channel, scsidp->id, (u64)scsidp->lun, scsidp->type); - if (on_free) - on_free(dev, arg); - scst_free_device(dev); out: @@ -2415,7 +2409,7 @@ static void scst_remove(struct device *cdev, struct class_interface *intf) if ((scsidp->host->hostt->name == NULL) || (strcmp(scsidp->host->hostt->name, SCST_LOCAL_NAME) != 0)) - scst_unregister_device(scsidp, NULL, NULL); + scst_unregister_device(scsidp); TRACE_EXIT(); return; diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index f02e75e7c..dd392d811 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -7401,7 +7401,8 @@ static int scst_mgmt_affected_cmds_done(struct scst_mgmt_cmd *mcmd) case SCST_CLEAR_TASK_SET: case SCST_PR_ABORT_ALL: case SCST_LUN_RESET: - scst_call_dev_task_mgmt_fn_done(mcmd, mcmd->mcmd_tgt_dev); + if (mcmd->mcmd_tgt_dev != NULL) + scst_call_dev_task_mgmt_fn_done(mcmd, mcmd->mcmd_tgt_dev); break; case SCST_TARGET_RESET: