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 20:11:07 -0600	[thread overview]
Message-ID: <CAARYdbiDzi_WcNGe4GkWjtTXeNOV7pZCLiJFk4r+Np_Je+2aZw@mail.gmail.com> (raw)
In-Reply-To: <20210216123755.GA4608@lst.de>

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;
>         }

After reading the asc/ascq assignments from t10.org, I think it should
be "sshdr.asc == 0x3a" rather than "sshdr.asc == 0x3a00". With that
change to your above patch, I am seeing different output after
ejecting USB drives.

[   45.027823] sd 8:0:0:0: [sdc] tag#0 device offline or changed
[   45.027832] blk_update_request: I/O error, dev sdc, sector 0 op
0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[   45.027871] sd 8:0:0:0: [sdc] tag#0 device offline or changed
[   45.027875] blk_update_request: I/O error, dev sdc, sector 0 op
0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[   45.027885] ldm_validate_partition_table(): Disk read failed.
[   45.027902] sd 8:0:0:0: [sdc] tag#0 device offline or changed
[   45.027905] blk_update_request: I/O error, dev sdc, sector 0 op
0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[   45.027928] sd 8:0:0:0: [sdc] tag#0 device offline or changed
[   45.027931] blk_update_request: I/O error, dev sdc, sector 0 op
0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[   45.027953] sd 8:0:0:0: [sdc] tag#0 device offline or changed
[   45.027956] blk_update_request: I/O error, dev sdc, sector 0 op
0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[   45.028103] sd 8:0:0:0: [sdc] tag#0 device offline or changed
[   45.028106] blk_update_request: I/O error, dev sdc, sector 0 op
0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[   45.028113] Dev sdc: unable to read RDB block 0
[   45.028124] sd 8:0:0:0: [sdc] tag#0 device offline or changed
[   45.028126] blk_update_request: I/O error, dev sdc, sector 0 op
0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[   45.028140] sd 8:0:0:0: [sdc] tag#0 device offline or changed
[   45.028142] blk_update_request: I/O error, dev sdc, sector 0 op
0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[   45.028148]  sdc: unable to read partition table
[   45.029893] sdc: detected capacity change from 0 to 30595072

  parent reply	other threads:[~2021-02-17  2:12 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
2021-02-17  2:11   ` Tom Seewald [this message]
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=CAARYdbiDzi_WcNGe4GkWjtTXeNOV7pZCLiJFk4r+Np_Je+2aZw@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).