Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1185498ybg; Wed, 29 Jul 2020 07:55:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQlcDwKhCj9qxEdgAp2b9b/2uo17Np4YVjgovSbxWpp//OC0YCSjoNMD67cv6Be39v35jW X-Received: by 2002:a17:907:444c:: with SMTP id on20mr29770624ejb.77.1596034536726; Wed, 29 Jul 2020 07:55:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596034536; cv=none; d=google.com; s=arc-20160816; b=u7XMqZvCqBAaB3d+WMEE8hL+FNoYQf3wVDP9Nr+4WTyLpfd000RgB3veN0o3mzgjgB eQvDOXLMN2vmi06Emb8rRRF3fCK/mNEYHMlv4K4WfWQA5snQhR9wyOG8coLqFmbSCMJh cvLvAYGCjhq+cNPaWCRjTS4nm+iI2XRyZzcc6EP1WLBGzPklywGsxtib0Y5et01ne00Q ln/rPq4mlKzCDkvOQkmsFR355HcbrZ8bRbXjTiWTbHz1nKPLTDTNuYsCwF9tRFgd5oxW m3i8RTG2QJvbCRmvWiVEL5Asm8+leUxWaU4DcFECkW7AO4nlsJJOJScVYaNH+dUOo5on eTSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature:dkim-signature; bh=riVlc/F2XNerYOFp6OYRHphtsG0/Z8RAAw9StPiFgvg=; b=zXCzIlnblIXzOgYjLaJOx8EG+s/wWfnBsWiC5h2KBmlugbC7VIF0ga2E3yDi/oXJqL 9Pk2j2C9en4OtP7fYnwGGpB3lR2WA1Jvgw913BFa2rjBX+yGJi1+3LGddy+i2xCFeo8v 5PAbQR4iTboOBa1kCphb93rIsLyL0Qz3ApRaKkz1cjPHmhoOsEGpmEllaoFK80zm7qqn /ObZ8REtioIKfF8uv3ie54hsq9DtGlA0OgEk3Fq+9g9kzyucXpo7kXkweAIargNLv0ED JgTisK8UKcocm32vu4hVipgTyvWyjBsMNzbu+iZ22djY6h7Hqv0kXSHT0Gq4Unwtk3RV U+tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=KaxddRhc; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=KaxddRhc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f1si1411814edc.157.2020.07.29.07.55.13; Wed, 29 Jul 2020 07:55:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=KaxddRhc; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=KaxddRhc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727033AbgG2Oxz (ORCPT + 99 others); Wed, 29 Jul 2020 10:53:55 -0400 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:34296 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726476AbgG2Oxz (ORCPT ); Wed, 29 Jul 2020 10:53:55 -0400 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id 705CC8EE207; Wed, 29 Jul 2020 07:53:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1596034434; bh=52QMwb7Jds0gQp46DIWjlg4uzDKqmp0+MN9kfbsWbYw=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=KaxddRhcrEATgtc3+DrhSJ4n0NFDWD+jQycTwDg09AbWbe/mSXbaq8HlO1hL4TQYm j8w03aVpW523vOV84ICUC+NZOgQV30n9x3L90GaIc52gNGLdqlPwddRqMGEeIPwX4K dw5s6o3o+2E3141yBGgNBZfVMHMkNxcOJaEnVwCk= Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oXOLaPWPO5AT; Wed, 29 Jul 2020 07:53:54 -0700 (PDT) Received: from [153.66.254.194] (unknown [50.35.76.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id C87708EE100; Wed, 29 Jul 2020 07:53:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1596034434; bh=52QMwb7Jds0gQp46DIWjlg4uzDKqmp0+MN9kfbsWbYw=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=KaxddRhcrEATgtc3+DrhSJ4n0NFDWD+jQycTwDg09AbWbe/mSXbaq8HlO1hL4TQYm j8w03aVpW523vOV84ICUC+NZOgQV30n9x3L90GaIc52gNGLdqlPwddRqMGEeIPwX4K dw5s6o3o+2E3141yBGgNBZfVMHMkNxcOJaEnVwCk= Message-ID: <1596034432.4356.19.camel@HansenPartnership.com> Subject: Re: [PATCH] scsi: sd: add runtime pm to open / release From: James Bottomley To: Alan Stern , Martin Kepplinger Cc: Bart Van Assche , Can Guo , martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@puri.sm Date: Wed, 29 Jul 2020 07:53:52 -0700 In-Reply-To: <1596033995.4356.15.camel@linux.ibm.com> References: <20200706164135.GE704149@rowland.harvard.edu> <20200728200243.GA1511887@rowland.harvard.edu> <20200729143213.GC1530967@rowland.harvard.edu> <1596033995.4356.15.camel@linux.ibm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2020-07-29 at 07:46 -0700, James Bottomley wrote: > On Wed, 2020-07-29 at 10:32 -0400, Alan Stern wrote: > > On Wed, Jul 29, 2020 at 04:12:22PM +0200, Martin Kepplinger wrote: > > > On 28.07.20 22:02, Alan Stern wrote: > > > > On Tue, Jul 28, 2020 at 09:02:44AM +0200, Martin Kepplinger > > > > wrote: > > > > > Hi Alan, > > > > > > > > > > Any API cleanup is of course welcome. I just wanted to remind > > > > > you that the underlying problem: broken block device runtime > > > > > pm. Your initial proposed fix "almost" did it and mounting > > > > > works but during file access, it still just looks like a > > > > > runtime_resume is missing somewhere. > > > > > > > > Well, I have tested that proposed fix several times, and on my > > > > system it's working perfectly. When I stop accessing a drive > > > > it autosuspends, and when I access it again it gets resumed and > > > > works -- as you would expect. > > > > > > that's weird. when I mount, everything looks good, "sda1". But as > > > soon as I cd to the mountpoint and do "ls" (on another SD card > > > "ls" works but actual file reading leads to the exact same > > > errors), I get: > > > > > > [ 77.474632] sd 0:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: > > > hostbyte=0x00 driverbyte=0x08 cmd_age=0s > > > [ 77.474647] sd 0:0:0:0: [sda] tag#0 Sense Key : 0x6 [current] > > > [ 77.474655] sd 0:0:0:0: [sda] tag#0 ASC=0x28 ASCQ=0x0 > > > [ 77.474667] sd 0:0:0:0: [sda] tag#0 CDB: opcode=0x28 28 00 00 > > > 00 60 40 00 00 01 00 > > > > This error report comes from the SCSI layer, not the block layer. > > That sense code means "NOT READY TO READY CHANGE, MEDIUM MAY HAVE > CHANGED" so it sounds like it something we should be > ignoring. Usually this signals a problem, like you changed the > medium manually (ejected the CD). But in this case you can tell us > to expect this by setting > > sdev->expecting_cc_ua > > And we'll retry. I think you need to set this on all resumed > devices. Actually, it's not quite that easy, we filter out this ASC/ASCQ combination from the check because we should never ignore medium might have changed events on running devices. We could ignore it if we had a flag to say the power has been yanked (perhaps an additional sdev flag you set on resume) but we would still miss the case where you really had powered off the drive and then changed the media ... if you can regard this as the user's problem, then we might have a solution. James