Re: [PATCH] block: Fix bug in runtime-resume handling

Bart Van Assche
2020-08-30T00:38:55Z

On 2020-08-29 11:56, Alan Stern wrote:
> A third possibility is the approach I outlined before, adding a
> BLK_MQ_REQ_PM flag. But to avoid the deadlock you pointed out, I would
> make blk_queue_enter smarter about whether to postpone a request. The
> logic would go like this:
>
> If !blk_queue_pm_only:
> Allow
> If !BLK_MQ_REQ_PREEMPT:
> Postpone
> If q->rpm_status is RPM_ACTIVE:
> Allow
> If !BLK_MQ_REQ_PM:
> Postpone
> If q->rpm_status is RPM_SUSPENDED:
> Postpone
> Else:
> Allow
>
> The assumption here is that the PREEMPT flag is set whenever the PM flag
> is.

Hi Alan,

Although interesting, these solutions sound like workarounds to me. How
about fixing the root cause by modifying the SCSI DV implementation such
that it doesn't use scsi_device_quiesce() anymore()? That change would
allow to remove BLK_MQ_REQ_PREEMPT / RQF_PREEMPT from the block layer and
move these flags into the SCSI and IDE code.

Thanks,

Bart.