Re: [PATCH v2] block: Keep RPM_ACTIVE in blk_pre_runtime_resume() when already active
From: Jens Axboe
Date: Wed Nov 18 2026 - 11:09:28 EST
On Wed, 04 Nov 2026 19:27:44 +0800, Stanley Jhu wrote:
> Since commit eef1d74bf88f ("PM: runtime: Only set runtime_error on
> suspend callback failures"), a failed runtime resume leaves
> dev->power.runtime_error at 0 with runtime_status set to RPM_SUSPENDED,
> so later runtime resume requests run sdev_runtime_resume() again:
>
> 1. A runtime suspend increments q->pm_only from 0 to 1 and sets
> q->rpm_status to RPM_SUSPENDED.
> 2. The first runtime resume fails in the driver callback, and
> blk_post_runtime_resume() sets q->rpm_status to RPM_ACTIVE and calls
> blk_clear_pm_only(), decrementing q->pm_only from 1 to 0 so recovery
> commands can enter the queue (intended since
> commit 6e1fcab00a23 ("scsi: block: pm: Always set request queue
> runtime active in blk_post_runtime_resume()")).
> 3. A retried runtime resume calls blk_pre_runtime_resume(), which
> overwrites q->rpm_status from RPM_ACTIVE to RPM_RESUMING, so
> blk_post_runtime_resume() sees old_status != RPM_ACTIVE and calls
> blk_clear_pm_only() a second time without a matching
> blk_set_pm_only().
> 4. q->pm_only underflows from 0 to -1 (triggering WARN_ON_ONCE in
> blk_clear_pm_only()), blocking non-PM requests in blk_queue_enter()
> and __bio_queue_enter() while the device is RPM_ACTIVE, and the next
> runtime suspend increments q->pm_only from -1 to 0, letting non-PM
> requests dispatch while RPM_SUSPENDED. This hits the UFS device
> well-known LUN by default and SCSI disks with
> manage_runtime_start_stop enabled (ATA and FireWire sbp2 defaults).
>
> [...]
Applied, thanks!
[1/1] block: Keep RPM_ACTIVE in blk_pre_runtime_resume() when already active
commit: 657d7c48b84f2ef0bf885b47cf2318823bc72970
Best regards,
--
Jens Axboe