Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: "Fang Hongjie(方洪杰)" <hongjiefang@asrmicro.com>
To: Bart Van Assche <bvanassche@acm.org>,
	"James.Bottomley@HansenPartnership.com"
	<James.Bottomley@HansenPartnership.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"jgarzik@redhat.com" <jgarzik@redhat.com>,
	"stern@rowland.harvard.edu" <stern@rowland.harvard.edu>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v1] scsi: core: pair EH runtime PM get and put
Date: Mon, 27 Jul 2026 02:07:37 +0000	[thread overview]
Message-ID: <3dab88746c6a445e9b134a71fb93b418@exch02.asrmicro.com> (raw)
In-Reply-To: <90a7222e-6779-485c-80d1-e4b814a9ac23@acm.org>



> > @@ -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.

      reply	other threads:[~2026-07-27  2:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-23  7:44 [PATCH v1] scsi: core: pair EH runtime PM get and put Hongjie Fang
2026-06-23  8:05 ` sashiko-bot
2026-07-24 21:18 ` Bart Van Assche
2026-07-27  2:07   ` Fang Hongjie(方洪杰) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3dab88746c6a445e9b134a71fb93b418@exch02.asrmicro.com \
    --to=hongjiefang@asrmicro.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=bvanassche@acm.org \
    --cc=jgarzik@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox