diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 69df8513e..017538c2a 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -8061,6 +8061,17 @@ void scst_process_reset(struct scst_device *dev, uint8_t sense_buffer[SCST_STANDARD_SENSE_LEN]; int sl = scst_set_sense(sense_buffer, sizeof(sense_buffer), dev->d_sense, SCST_LOAD_SENSE(scst_sense_reset_UA)); + /* + * Potentially, setting UA here, when the aborted commands are + * still running, can lead to a situation that one of them could + * take it, then that would be detected and the UA requeued. + * But, meanwhile, one or more subsequent, i.e. not aborted, + * commands can "leak" executed normally. So, as result, the + * UA would be delivered one or more commands "later". However, + * that should be OK, because, if multiple commands are being + * executed in parallel, you can't control exact order of UA + * delivery anyway. + */ scst_dev_check_set_local_UA(dev, exclude_cmd, sense_buffer, sl); } diff --git a/scst/src/scst_pres.c b/scst/src/scst_pres.c index 48c246d3d..ee0727184 100644 --- a/scst/src/scst_pres.c +++ b/scst/src/scst_pres.c @@ -565,6 +565,27 @@ static void scst_pr_abort_reg(struct scst_device *dev, */ PRINT_ERROR("SCST_PR_ABORT_ALL failed %d (sess %p)", rc, sess); + goto out; + } + + if ((reg->tgt_dev != pr_cmd->tgt_dev) && !dev->tas) { + uint8_t sense_buffer[SCST_STANDARD_SENSE_LEN]; + int sl; + sl = scst_set_sense(sense_buffer, sizeof(sense_buffer), + dev->d_sense, + SCST_LOAD_SENSE(scst_sense_cleared_by_another_ini_UA)); + /* + * Potentially, setting UA here, when the aborted commands are + * still running, can lead to a situation that one of them could + * take it, then that would be detected and the UA requeued. + * But, meanwhile, one or more subsequent, i.e. not aborted, + * commands can "leak" executed normally. So, as result, the + * UA would be delivered one or more commands "later". However, + * that should be OK, because, if multiple commands are being + * executed in parallel, you can't control exact order of UA + * delivery anyway. + */ + scst_check_set_UA(reg->tgt_dev, sense_buffer, sl, 0); } out: diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 407681a90..83b4ef0f6 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -5687,6 +5687,18 @@ static int scst_clear_task_set(struct scst_mgmt_cmd *mcmd) list_for_each_entry(tgt_dev, &UA_tgt_devs, extra_tgt_dev_list_entry) { + /* + * Potentially, setting UA here, when the aborted + * commands are still running, can lead to a situation + * that one of them could take it, then that would be + * detected and the UA requeued. But, meanwhile, one or + * more subsequent, i.e. not aborted, commands can + * "leak" executed normally. So, as result, the + * UA would be delivered one or more commands "later". + * However, that should be OK, because, if multiple + * commands are being executed in parallel, you can't + * control exact order of UA delivery anyway. + */ scst_check_set_UA(tgt_dev, sense_buffer, sl, 0); } }