On Wed, 2019-01-16 at 08:35 +0100, Hannes Reinecke wrote:
> If the device is _not_ removable we should not start the event
> poller as the media will not go away. Having the event poller running
> will block the open() call as it will try to flush outstanding events,
> which it can't if the device is in state 'BLOCKED'. So the open() call
> will be stalled until the device state changed, which might be quite
> some time depending on the transport.
> 
> Signed-off-by: Hannes Reinecke <h...@suse.com>
> ---
>  drivers/scsi/sd.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index a1a44f52e0e8..521f0a384446 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -1539,6 +1539,9 @@ static unsigned int sd_check_events(struct gendisk 
> *disk, unsigned int clearing)
>               return 0;
>  
>       sdp = sdkp->device;
> +     if (!sdp->removable)
> +             return 0;
> +
>       SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_check_events\n"));
>  
>       /*

Hi Hannes,

Although this patch looks fine to me, wouldn't it be a better approach to
cause the events checker not to submit any SCSI commands to blocked devices?
That approach should improve the sd behavior for both removable and
non-removable devices.

Thanks,

Bart.

Reply via email to