Re: [Regression] [Bisected] Errors when ejecting USB storage drives since v5.10

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 16, 2021 at 6:37 AM Christoph Hellwig <hch@xxxxxx> 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



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux