lkml.org 
[lkml]   [2020]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] scsi: sd: add runtime pm to open / release
On Sun, Aug 09, 2020 at 11:20:22AM +0200, Martin Kepplinger wrote:
> Hey Alan, I'm really glad for that, I suspected some of this but I have
> little experience in scsi/block layers, so that is super helpful.
>
> I'd appreciate an opinion on the below workaround that *seems* to work
> now (let's see, I had thought so before :)
>
> Whether or not this helps to find a real solution, let's see. But
> integration of such a flag in the error handling paths is what's
> interesting for now:
>
>
> --- a/drivers/scsi/scsi_error.c
> +++ b/drivers/scsi/scsi_error.c
> @@ -565,6 +565,17 @@ int scsi_check_sense(struct scsi_cmnd *scmd)
> return NEEDS_RETRY;
> }
> }
> + if (scmd->device->expecting_media_change) {
> + if (sshdr.asc == 0x28 && sshdr.ascq == 0x00) {
> + /* clear expecting_media_change in
> + * scsi_noretry_cmd() because we need
> + * to override possible "failfast" overrides
> + * that block readahead can cause.
> + */
> + return NEEDS_RETRY;

This is a somewhat fragile approach. You don't know for certain that
scsi_noretry_cmd will be called. Also, scsi_noretry_cmd can be called
from other places.

It would be better to clear the expecting_media_change flag just before
returning from scsi_decide_disposition. That way its use is localized
to one routine, not spread out between two.

Alan Stern

\
 
 \ /
  Last update: 2020-08-09 17:27    [W:0.081 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site