linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Seewald <tseewald@gmail.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-block@vger.kernel.org, axboe@kernel.dk
Subject: Re: [Regression] [Bisected] Errors when ejecting USB storage drives since v5.10
Date: Tue, 16 Feb 2021 14:01:28 -0600	[thread overview]
Message-ID: <CAARYdbjZgwKcJgMZx_6kvVH_CeTV04u21o8WGPprTP7mPOOYYg@mail.gmail.com> (raw)
In-Reply-To: <20210216123755.GA4608@lst.de>

Hi Christoph,

Thank you for looking into this. I applied your patch to v5.11 but
unfortunately I am encountering the same errors when ejecting USB
drives.

e.g.
[   45.188575] sd 8:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_OK
driverbyte=DRIVER_SENSE cmd_age=0s
[   45.188584] sd 8:0:0:0: [sdc] tag#0 Sense Key : Not Ready [current]
[   45.188588] sd 8:0:0:0: [sdc] tag#0 Add. Sense: Medium not present
[   45.188592] sd 8:0:0:0: [sdc] tag#0 CDB: Read(10) 28 00 00 00 00 00
00 00 08 00
[   45.188594] blk_update_request: I/O error, dev sdc, sector 0 op
0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[   45.188601] Buffer I/O error on dev sdc, logical block 0, async page read

I am happy to test any patches you send my way.

Tom

On Tue, Feb 16, 2021 at 6:37 AM Christoph Hellwig <hch@lst.de> wrote:
>
> ... but you were using sd, not sr.
>
> Can you give this patch a spin?
>
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index a3d2d4bc4a3dcd..6671b4e1909777 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -2116,6 +2116,14 @@ static int sd_done(struct scsi_cmnd *SCpnt)
>                         }
>                 }
>                 break;
> +       case NOT_READY:
> +               /* Medium not present */
> +               if (SCpnt->device->removable && sshdr.asc == 0x3a00) {
> +                       req->rq_flags |= RQF_QUIET;
> +                       set_media_not_present(sdkp);
> +                       sdkp->capacity = 0;
> +               }
> +               break;
>         default:
>                 break;
>         }

  reply	other threads:[~2021-02-16 20:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-12  5:42 [Regression] [Bisected] Errors when ejecting USB storage drives since v5.10 Tom Seewald
2021-02-16 12:15 ` Christoph Hellwig
2021-02-16 12:37 ` Christoph Hellwig
2021-02-16 20:01   ` Tom Seewald [this message]
2021-02-17  2:11   ` Tom Seewald
2021-02-22 11:44     ` Christoph Hellwig
2021-02-22 18:27       ` Tom Seewald

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=CAARYdbjZgwKcJgMZx_6kvVH_CeTV04u21o8WGPprTP7mPOOYYg@mail.gmail.com \
    --to=tseewald@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).