Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp634093yba; Mon, 1 Apr 2019 13:29:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZDa0bbOZ5HaKVfop/ms9rJEtLc8Ipqxlc0LQEuOTZ8mhCTGozIbXZmgnuTuIC/Cme3rA4 X-Received: by 2002:aa7:8282:: with SMTP id s2mr46560984pfm.7.1554150558740; Mon, 01 Apr 2019 13:29:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554150558; cv=none; d=google.com; s=arc-20160816; b=dAAgX7tIwXOf7no2sire52f5qfyi5+OZKgXbeh6/jKI0srDeXGWRCI3V9rXj6gYArn ofG6nLvV2iM3EI1bPwR01Gvn2dQ5aMVHoOxBGUjUiA79qEWjZN+VLSUBl97qEFbk0/x2 KD+kWnbTud9UVsq92gbJsUOK1Z3i5VEej2yybdcYvO8hoNEy+hrsJsvPZSeNrBkoxj8o HeyBXwhzNbs6v/mtJB8K6Rqu4bmiHGrJKFMyooVB+/EJNleow8bmIHzq5PCi2edExJX5 ty7C/FBxrIQYPaMhKRBH2lbIYIFcNnCt+HS9shiRCAERLp/VLH6NpKu6UlvL60ztd95M XCbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=ALKsZI8r3xroZh8DN5nhPlvBKsnjiy+Odtq2bOOjLFU=; b=allRRVbj76r1VUysiKdD5tZFuFBrdC8DAFZ3Urr9pxF8f6Ncopvp3T4pKWZTq0RiaB wxr+Gsp5XpatFBMMJO60JFHy8e0UU1yn4U0SjNYjBOxyMOYh8znj6lBbLq9d42EAGfJF T5ZvpE/q5VMyg+xfHaCzB+UwYshNM6uoUjP3ico0j8I8SHH136aldvRBtAgSvrRBc21l Kz97gTMYyziSglXlRZmNoxv7woZXYAvUIbs+YmyhMkasTqyooC6IRe8y0+r+fqG213fh bChFNWumxwV5VgVmTdKpGH1YMipSH73C8Ln4JigFTnseqEOHhXI3LYh9eIncmUeE9P5v nnlQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m3si9225057pgq.343.2019.04.01.13.28.50; Mon, 01 Apr 2019 13:29:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726836AbfDAU1u (ORCPT + 99 others); Mon, 1 Apr 2019 16:27:50 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:45174 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726628AbfDAU1u (ORCPT ); Mon, 1 Apr 2019 16:27:50 -0400 Received: (qmail 8885 invoked by uid 2102); 1 Apr 2019 16:27:49 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 1 Apr 2019 16:27:49 -0400 Date: Mon, 1 Apr 2019 16:27:49 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: "Zengtao (B)" cc: Martin Petersen , "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 In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ; Zengtao (B) > > > > > >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