RE: [PATCH v1] scsi: core: pair EH runtime PM get and put

From: Fang Hongjie(方洪杰)

Date: Sun Jul 26 2026 - 22:29:34 EST




> > @@ -2383,12 +2384,16 @@ int scsi_error_handler(void *data)
> > * what we need to do to get it up and online again (if we
> can).
> > * If we fail, we end up taking the thing offline.
> > */
> > - if (!shost->eh_noresume &&
> scsi_autopm_get_host(shost) != 0) {
> > - SCSI_LOG_ERROR_RECOVERY(1,
> > - shost_printk(KERN_ERR, shost,
> > - "scsi_eh_%d: unable to
> autoresume\n",
> > - shost->host_no));
> > - continue;
> > + autopm_put = false;
> > + if (!shost->eh_noresume) {
> > + if (scsi_autopm_get_host(shost) != 0) {
> > + SCSI_LOG_ERROR_RECOVERY(1,
> > + shost_printk(KERN_ERR, shost,
> > + "scsi_eh_%d: unable to
> autoresume\n",
> > + shost->host_no));
> > + continue;
> > + }
> > + autopm_put = true;
> > }
> >
> > if (shost->transportt->eh_strategy_handler)
> > @@ -2407,7 +2412,7 @@ int scsi_error_handler(void *data)
> > * which are still online.
> > */
> > scsi_restart_operations(shost);
> > - if (!shost->eh_noresume)
> > + if (autopm_put)
> > scsi_autopm_put_host(shost);
> > }
> > __set_current_state(TASK_RUNNING);
>
> Please capture the value of shost->eh_noresume in a local variable such
> that concurrent changes of shost->eh_noresume can't break the above
> code.


Thanks Bart. I will update the patch to snapshot shost->eh_noresume once
per EH iteration and use that value for both the get and put decisions.


>
> Thanks,
>
> Bart.