Re: [PATCH v2] scsi: core: pair EH runtime PM get and put

From: Alan Stern

Date: Tue Jul 28 2026 - 11:30:49 EST


On Tue, Jul 28, 2026 at 02:22:29AM +0000, Fang Hongjie(方洪杰) wrote:
> Thanks Alan.
> I agree that a plain local variable is not enough for a compiler-level
> snapshot.
> There is one extra detail here: shost->eh_noresume is currently a
> bitfield:
> unsigned eh_noresume:1;
> so READ_ONCE(shost->eh_noresume) cannot be used directly because
> READ_ONCE() takes the address of its argument.
>
> My plan for v3 is to first make eh_noresume a regular bool, then use
> READ_ONCE() in scsi_error_handler() to snapshot it once per EH iteration.
> I will also use WRITE_ONCE() for the writer that changes eh_noresume while
> SCSI EH may observe it.
>
> Does this approach look reasonable to you?

That should be fine.

Alan Stern