Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3254400ybt; Mon, 29 Jun 2020 20:35:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypStCcTqG+Jg6xzuFPhJoE+/lmsgQjWpiK0p5hjbPe3KCJsTSrvw+QXhNI6s1HjN8tFkGF X-Received: by 2002:aa7:c50e:: with SMTP id o14mr21095899edq.168.1593488132265; Mon, 29 Jun 2020 20:35:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593488132; cv=none; d=google.com; s=arc-20160816; b=O0keFlPEgztuQXegh2Maa5/SRABXgDFV4pqivUGvjeiH2TRdewd92Kv/DUgD2VejoO JCtevdGFYAPeE+HRx7kd6boHo5Eudl+h7baIwV4SZMnYqnRrlmbMB4Lri+Qw4iFRJ/Bz LtRNq4tDS+UvSqe+1ntCwjbtKICKjcD9RNy2B5/qGbSaosfSwnhj7A7RjtHdthBpK56f em0G9DQFPuGkXJL4kjfiiem0tmT4fmZzK5jKtRJyXVi52DH3ts3W+su1Nz4a+jopFQ3a cLHoU2SpIY6lsI7jBPaTY+zTPpDdCdYGIL092kSjPU/ylAaftSJAJgO6YDlfunRCiWDP HyAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=TYX9fWWYxc3NtQf6c1BiLPg4Xa2kcKSBAxmy39/nMi0=; b=tkPjEOCPsHyOPaes1w4i/nPaYRBD5XScA2of7HeRdXvYoQBHIhQcFGIXsvdn/YAgi9 WYo1sLeXfOWby3blC4tcNNqlxIA1gOEIMhmaoaCjAWuskH28sg6OYAVyZTmOsYfccFw2 pghXa8DcKNCGILgUD+h0vkBL5jVVuX+s49QcJPjqb5hXomNCMH+8JioaUlmK4mUXLfnJ 1c5PG/td2EIeve6ZgW5YjXDYQiS2E7IOPWB0VHJbnIDs8FX5AxV0eFScx7dDwVUVnzjv rZMwNT6xcj5FHBkQZe4/FqROwN0/7/os8ODIZ3Fm+DTzNqInpfM6+IhfA/VdZwEv6ay4 VHuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Vx1hrdTo; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w12si970589eji.586.2020.06.29.20.35.07; Mon, 29 Jun 2020 20:35:32 -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=@gmail.com header.s=20161025 header.b=Vx1hrdTo; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729136AbgF3DcJ (ORCPT + 99 others); Mon, 29 Jun 2020 23:32:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729037AbgF3DcJ (ORCPT ); Mon, 29 Jun 2020 23:32:09 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E109CC061755; Mon, 29 Jun 2020 20:32:08 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id s10so18581644wrw.12; Mon, 29 Jun 2020 20:32:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TYX9fWWYxc3NtQf6c1BiLPg4Xa2kcKSBAxmy39/nMi0=; b=Vx1hrdTou8GBP5cH9Qk8Yg41ImlQsua559dcHHD1XFdwrfonuvDuKal95+IWgxY556 ESoIG/n7q9PhJuU5EXMuDhIcmPRRL6wnW4gTP1J5ljvtyx7LGbOUwQJh6Wgkbzv9fwho ferm6BbkAgQdPNjZF1cpvwRBf0wWN8hiVssct4aSArZHv9FF/gC3RZ3LM0mNKjoqucxK Jt5gB73pwLHU3xqfI/JLulX8C74Hziwzfv4Dd/pYx+GAxvEv51cEIufOqBq7AWcXRo0n xq94Mk9Nisy9RY1iH1OQKKrXPvkWJ+LtN+T4inkvYwpAyg5fWqrciuqFT7pdS3ldxsXU s2TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TYX9fWWYxc3NtQf6c1BiLPg4Xa2kcKSBAxmy39/nMi0=; b=BDxCgZcFE+5nzjkiojpxGTuFnthsl6lcRAi78ORKPcK/EMCDKntPKdfYE37F4hPgB4 cq/3bkAzcuKPqJHueUJfLH3W9ScXCrI3X0aSNiIq161NW4yhFGpzy3JhQ9S8OrKVOlWn x70/fSB0oXr05y/ctArLfpr3G7Vae6ZjO+btZx8uCVH1sDBC/g1TVUMDO2LX5YxO51Tp K2Z8WYokG0c8GViaYjy6XHke4C+nzT0Vh3oSa9k/botVChEWq+OHF0UhdWz6VoufUQv1 9tFZRwAuPWxyt62195zirsCxpFiMTOXzjmobl4szfDX0fy/hGpq7HOj6wkhpzSJLvQTy vSow== X-Gm-Message-State: AOAM5337vaNfC6k9gwGkF6jPu9sHxk9jqfBeezeD2VGKYTpv/pO4fGvS xdWKrv884ecJx31/9Xdya4qJ3MmSpYXn3GBfZdKNeu4S X-Received: by 2002:adf:ef89:: with SMTP id d9mr21037920wro.124.1593487927011; Mon, 29 Jun 2020 20:32:07 -0700 (PDT) MIME-Version: 1.0 References: <499138c8-b6d5-ef4a-2780-4f750ed337d3@0882a8b5-c6c3-11e9-b005-00805fc181fe> <20200623204234.GA16156@khazad-dum.debian.net> In-Reply-To: <20200623204234.GA16156@khazad-dum.debian.net> From: Ming Lei Date: Tue, 30 Jun 2020 11:31:55 +0800 Message-ID: Subject: Re: [PATCH] scsi: sd: stop SSD (non-rotational) disks before reboot To: Henrique de Moraes Holschuh Cc: Damien Le Moal , Simon Arlott , "James E.J. Bottomley" , "Martin K. Petersen" , Jonathan Corbet , Linux Kernel Mailing List , "linux-scsi@vger.kernel.org" , "linux-doc@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 24, 2020 at 5:01 AM Henrique de Moraes Holschuh wrote: > > On Thu, 18 Jun 2020, Damien Le Moal wrote: > > Are you experiencing data loss or corruption ? If yes, since a clean reboot or > > shutdown issues a synchronize cache to all devices, a corruption would mean that > > your SSD is probably not correctly processing flush cache commands. > > Cache flushes do not matter that much when SSDs and sudden power cuts > are involved. Power cuts at the wrong time harm the FLASH itself, it is > not about still-in-flight data. > > Keep in mind that SSDs do a _lot_ of background writing, and power cuts What is the __lot__ of SSD's BG writing? GC? > during a FLASH write or erase can cause from weakened cells, to much > larger damage. It is possible to harden the chip or the design against > this, but it is *expensive*. And even if warded off by hardening and no > FLASH damage happens, an erase/program cycle must be done on the whole > erase block to clean up the incomplete program cycle. It should have been SSD's(including FW) responsibility to avoid data loss when the SSD is doing its own BG writing, because power cut can happen any time from SSD's viewpoint. > > Due to this background activity, an unexpected power cut could damage > data *anywhere* in an SSD: it could hit some filesystem area that was > being scrubbed in background by the SSD, or internal SSD metadata. > > So, you want that SSD to know it must be quiescent-for-poweroff for > *real* before you allow the system to do anything that could power it > off. > > And, as I have found out the hard way years ago, you also want to give > the SSD enough *extra* time to actually quiesce, even if it claims to be > already prepared for poweroff [1]. > > When you do not follow these rules, well, excellent datacenter-class > SSDs have super-capacitor power banks that actually work. Most SSDs do > not, although they hopefully came a long way and hopefully modern SSDs > are not as easily to brick as they were reported to be three or four > years ago. I remember that DC SSDs often don't support BG GC. Thanks, Ming Lei