mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Hongjie Fang <hongjiefang@asrmicro.com>,
	James.Bottomley@HansenPartnership.com,
	martin.petersen@oracle.com, jgarzik@redhat.com,
	stern@rowland.harvard.edu
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] scsi: core: pair EH runtime PM get and put
Date: Fri, 24 Jul 2026 14:18:05 -0700	[thread overview]
Message-ID: <90a7222e-6779-485c-80d1-e4b814a9ac23@acm.org> (raw)
In-Reply-To: <20260623074408.1639663-1-hongjiefang@asrmicro.com>


On 6/23/26 12:44 AM, Hongjie Fang wrote:
> @@ -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.

  reply	other threads:[~2026-07-24 21:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-23  7:44 Hongjie Fang
2026-07-24 21:18 ` Bart Van Assche [this message]
2026-07-27  2:07   ` Fang Hongjie(方洪杰)

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=90a7222e-6779-485c-80d1-e4b814a9ac23@acm.org \
    --to=bvanassche@acm.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=hongjiefang@asrmicro.com \
    --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

all inboxes | Powered by JetHome®