lkml.org 
[lkml]   [2019]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRE: scsi_set_medium_removal timeout issue
On Tue, 4 Dec 2018, Alan Stern wrote:

> On Thu, 29 Nov 2018, Zengtao (B) wrote:
>
> > Ping?
> >
> > >-----Original Message-----
> > >From: Alan Stern [mailto:stern@rowland.harvard.edu]
> > >Sent: Wednesday, November 14, 2018 11:35 PM
> > >To: Martin Petersen <martin.petersen@oracle.com>; Zengtao (B)
> > ><prime.zeng@hisilicon.com>
> > >Cc: jejb@linux.vnet.ibm.com; gregkh@linuxfoundation.org;
> > >linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org;
> > >linux-usb@vger.kernel.org; usb-storage@lists.one-eyed-alien.net
> > >Subject: RE: scsi_set_medium_removal timeout issue
> > >
> > >On Wed, 14 Nov 2018, Zengtao (B) wrote:
> > >
> > >> I just enabled the scsi log in the middle of the umount operation,
> > >> otherwise I can't reproduce the issue when the scsi log is enabled.
> > >>
> > >> >from the beginning. In any case, it wasn't what I wanted. I asked
> > >> >you to post the dmesg log, not the SCSI log.
> > >>
> > >> Please refer to the new attachment for dmesg log.
> > >
> > >Heh, yes, I see now.
> > >
> > >Martin, shouldn't sd_release() call sd_sync_cache() in the same way that
> > >sd_shutdown() does, before it calls scsi_set_medium_removal()?
> > >
> > >Alan Stern
>
> I don't know if this is the right thing to do, but you can try out the
> following patch to see if it helps.
>
> Alan Stern
>
>
>
> Index: usb-4.x/drivers/scsi/sd.c
> ===================================================================
> --- usb-4.x.orig/drivers/scsi/sd.c
> +++ usb-4.x/drivers/scsi/sd.c
> @@ -113,6 +113,7 @@ static void sd_shutdown(struct device *)
> static int sd_suspend_system(struct device *);
> static int sd_suspend_runtime(struct device *);
> static int sd_resume(struct device *);
> +static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr);
> static void sd_rescan(struct device *);
> static int sd_init_command(struct scsi_cmnd *SCpnt);
> static void sd_uninit_command(struct scsi_cmnd *SCpnt);
> @@ -1393,8 +1394,14 @@ static void sd_release(struct gendisk *d
> SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_release\n"));
>
> if (atomic_dec_return(&sdkp->openers) == 0 && sdev->removable) {
> - if (scsi_block_when_processing_errors(sdev))
> + if (scsi_block_when_processing_errors(sdev)) {
> + if (sdkp->WCE && sdkp->media_present) {
> + sd_printk(KERN_NOTICE, sdkp,
> + "Synchronizing SCSI cache\n");
> + sd_sync_cache(sdkp, NULL);
> + }
> scsi_set_medium_removal(sdev, SCSI_REMOVAL_ALLOW);
> + }
> }
>
> /*

Zengtao, did you ever try out this patch? Did it fix your problem?

Alan Stern

\
 
 \ /
  Last update: 2019-04-01 22:27    [W:0.058 / U:1.468 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site