Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2244826ybt; Sun, 28 Jun 2020 12:44:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBXXJhGMy+6FSZZ2DjUsW2+p5X3SkjkFgw2xfJQM79XmUqUjYYgYLZ5crQ17To4WxOJzX9 X-Received: by 2002:a17:906:3958:: with SMTP id g24mr10780868eje.26.1593373488770; Sun, 28 Jun 2020 12:44:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593373488; cv=none; d=google.com; s=arc-20160816; b=K5fpiQr19L3Jb7yveGq2E1FPpah89+NVrf+HU2R93vx7GLJNfuJH9Btd4VyGHZdO7s yBXFGIxIl5eWxfLQ3p1xCVGc9xaJv+26FD8yvZnvtxy/fkFTcbmPf8YmofYDcZjyjCgd tKt0xbBOuosfo+fsmVm9qamPdf7zmKKL6Y8sSACJ/5QsNr6RnsZCmm0fPfneVIBRW81J dU6Zjov0TPnL5PFmoYdII1NdB4RMyXMmq3SHrj/8mT9IwkoF3ojSCnIzkJgkUIoQB8xD jd0Q64A25MtG6Tgy5i1+neT0CuzOYbo2ZZs3fYFDabTmC0YsZdiw7xooxJ445sdizXWE Hhgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=FGcZt/6GMkSRNLSDs9gB3jrYVai8Gb9IKiujRYjF0bo=; b=AfcAhXTOpLvwqhyAPC5TLcaBfm1Q+2Z8mY+HOBJCJM3SIrNTe6ND0/Smqtwhyay8z0 lVx9phnPf7YQOdhKeHnmyy9GBMXF5/4DQgDZ2ac2BWjv1zNpSsUdwUDcx300ygy/OCkO 9j+xxk8HqV3RF0rCejbCrCxusXNTPp2JpGDdaLPohMJLQud4Mx6XEt7h5D0zS7rIPSMh sMYTLILN8Riy7svHyoelKIWJ83+lpcUrYlHNAuI7ySqFTvba3t9fcyeFM4R+HV/F5+pw KpxFji31TNN+ykqBPorbdRoZAcym46/0YTp0oh2+n5H/GnWvl9n+EmSn5N7Mi2DiHNgj VYeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hmh.eng.br header.s=fm3 header.b=c2KxKieR; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=LtENHqXH; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i3si9960318ejk.97.2020.06.28.12.44.23; Sun, 28 Jun 2020 12:44:48 -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=pass header.i=@hmh.eng.br header.s=fm3 header.b=c2KxKieR; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=LtENHqXH; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726738AbgF1TmK (ORCPT + 99 others); Sun, 28 Jun 2020 15:42:10 -0400 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:51397 "EHLO wout4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726691AbgF1TmJ (ORCPT ); Sun, 28 Jun 2020 15:42:09 -0400 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 33EEC422; Sun, 28 Jun 2020 15:42:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Sun, 28 Jun 2020 15:42:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hmh.eng.br; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=FGcZt/6GMkSRNLSDs9gB3jrYVai 8Gb9IKiujRYjF0bo=; b=c2KxKieRlGyL4lugZMvSumbQer6ZcVGoY79mqdNktlP EA9BS4lrBMXff3UF+drQ+OKGnoCo0m9lYl0kfQJ8brNc9y1NLUt7Sc/k6Hl11j5j H5Dex58q7zc4fLbVGq4/ldslSivmEeyVJITyjwR4HzxHL/h4Op8hUBbczmjzExFg V1DfXIHjUbqwGb25JRvUrUc1CJYlxt4kCmIBHGF0dgJLxXqQ/gmGv0lnvh6SzMHm s9NUcgmq2xrto0VOi+FjXxdgqC6yfXd/JaNhLl9Dk+czRikuzvV4R5PyxqooAsGV F9uhg2zT6OoPq4M8eBQgJZg/klXeTVnzXqGuml13vEw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=FGcZt/ 6GMkSRNLSDs9gB3jrYVai8Gb9IKiujRYjF0bo=; b=LtENHqXHroWzaMwe02bbjT Z6UDKOvW5rVJIcgJCqq4VH+n5M8CBpc3hcfPxwj/lXCQ15bEgarufzWB1LXOY0zS niUYegZl1lhSw1yk/TqnV1RW/jdmZErLF96dqHqxExJgMiYq39NRT2rd9T8p5Ttg Ff2JfTol87jVxtdvSfCtNdKNs/LX4ja4pHlM7Xm8hJhgIo8LA8ETwx0VlMEtSkmM 5tIrwa57zXiVr5aPUUwUrKk48NmUf/ZMmAOBYSS0Zpwt5k45tafSY/KkJWEIVvBo 9guG52VaZnrQzNi4mswQIPQ5KThcfBy8vWc3x3oBPa5Jv2hRGO6nqGPKzzuofChA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudeliedgudegvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggujggfsehttddttddtredvnecuhfhrohhmpefjvghn rhhiqhhuvgcuuggvucfoohhrrggvshcujfholhhstghhuhhhuceohhhmhheshhhmhhdrvg hnghdrsghrqeenucggtffrrghtthgvrhhnpedtfeefvdffkeevjeeuffdvvdevveetjefg vdfhffeuteefvdevgeeuueejtddutdenucffohhmrghinheplhhkmhhlrdhorhhgnecukf hppedujeejrdduleegrdejrdefvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgr mhepmhgrihhlfhhrohhmpehhmhhhsehhmhhhrdgvnhhgrdgsrh X-ME-Proxy: Received: from khazad-dum.debian.net (unknown [177.194.7.32]) by mail.messagingengine.com (Postfix) with ESMTPA id A45713280059; Sun, 28 Jun 2020 15:42:06 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by localhost.khazad-dum.debian.net (Postfix) with ESMTP id E20FA340015F; Sun, 28 Jun 2020 16:42:04 -0300 (-03) X-Virus-Scanned: Debian amavisd-new at khazad-dum.debian.net Received: from khazad-dum.debian.net ([127.0.0.1]) by localhost (khazad-dum2.khazad-dum.debian.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id dA65gXlKiPuD; Sun, 28 Jun 2020 16:42:03 -0300 (-03) Received: by khazad-dum.debian.net (Postfix, from userid 1000) id F130E3400159; Sun, 28 Jun 2020 16:42:02 -0300 (-03) Date: Sun, 28 Jun 2020 16:42:02 -0300 From: Henrique de Moraes Holschuh To: Simon Arlott Cc: Damien Le Moal , "James E.J. Bottomley" , "Martin K. Petersen" , Jonathan Corbet , Linux Kernel Mailing List , "linux-scsi@vger.kernel.org" , "linux-doc@vger.kernel.org" Subject: Re: [PATCH] scsi: sd: stop SSD (non-rotational) disks before reboot Message-ID: <20200628194202.GA9252@khazad-dum.debian.net> References: <499138c8-b6d5-ef4a-2780-4f750ed337d3@0882a8b5-c6c3-11e9-b005-00805fc181fe> <20200623204234.GA16156@khazad-dum.debian.net> <4e9c7e62-b1e4-80b0-8e22-9d57d3431f37@0882a8b5-c6c3-11e9-b005-00805fc181fe> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4e9c7e62-b1e4-80b0-8e22-9d57d3431f37@0882a8b5-c6c3-11e9-b005-00805fc181fe> X-GPG-Fingerprint1: 4096R/0x0BD9E81139CB4807: C467 A717 507B BAFE D3C1 6092 0BD9 E811 39CB 4807 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 28 Jun 2020, Simon Arlott wrote: > On 23/06/2020 21:42, Henrique de Moraes Holschuh wrote: > > [1] I have long lost the will and energy to pursue this, so *this* is a > > throw-away anecdote for anyone that cares: I reported here a few years > > ago that many models of *SATA* based SSDs from Crucial/Micron, Samsung > > and Intel were complaining (through their SMART attributes) that Linux > > was causing unsafe shutdowns. > > > > https://lkml.org/lkml/2017/4/10/1181 > > > > TL;DR: wait one *extra* second after the SSD acknowleged the STOP > > command as complete before you trust the SSD device is safe to be > > powered down (i.e. before reboot, suspend, poweroff/shutdown, and device > > removal/detach). This worked around the issue for every vendor and > > model of SSD we tested. > > Looking through that thread, it looks like a simple 1 second delay on > shutdown/reboot patch hasn't been proposed yet? It should work, yes. And it likely would help with whatever $RANDOM other hardware that has the same issues but has no way to make itself noticed, so *I* would appreciate it as something I could tell the kernel to *always* do. But for "sd" devices, it would be likely more complete to also ensure the delay for device removal (not just on reboot and power off). > In my case none of the SSDs are recording unexpected power loss if they > are stopped before the reboot, but the reboot won't necessarily be > instantaneous after the last stop command returns. Yes, it is a race. If either the SSD happens to need less "extra" time, or the computer takes a bit longer to reboot/power off, all is well. Otherwise, the SSD loses the race, and gets powered down at an inappropriate time. -- Henrique Holschuh