From owner-freebsd-drivers@FreeBSD.ORG Tue Nov 19 19:36:41 2013 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F025E77F for ; Tue, 19 Nov 2013 19:36:41 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B6BFA26A1 for ; Tue, 19 Nov 2013 19:36:41 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id rAJJaeEp067201 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 19 Nov 2013 11:36:40 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id rAJJaeTO067200; Tue, 19 Nov 2013 11:36:40 -0800 (PST) (envelope-from jmg) Date: Tue, 19 Nov 2013 11:36:40 -0800 From: John-Mark Gurney To: Jay Elliott Subject: Re: usage of the standby immediate command in the ATA driver Message-ID: <20131119193640.GF2279@funkthat.com> Mail-Followup-To: Jay Elliott , "freebsd-drivers@freebsd.org" References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Tue, 19 Nov 2013 11:36:41 -0800 (PST) Cc: "freebsd-drivers@freebsd.org" X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2013 19:36:42 -0000 Jay Elliott wrote this message on Tue, Nov 19, 2013 at 19:20 +0000: > Hi freebsd-drivers, > > I'm looking into some issues regarding filesystem corruption with my employer's FreeBSD6-based kernel. We've consulted with the vendor that supplies our SSDs, and they've told us to make sure that our ATA driver is sending the ATA_STANDBY_IMMEDIATE command to the drive during shutdown after sending the ATA_FLUSHCACHE command. I've looked into the FreeBSD9.2-version of the ata driver to see if this behavior has been changed, but as far as I can tell it also does not send the ATA_STANDBY_IMMEDATE command from ad_shutdown. It shouldn't be necessary... The FLUSHCACHE command is documented as (from T13/1532D Volume 1 Revision 4 Page 111, section 6.13.8): This command is used by the host to request the device to flush the write cache. If there is data in the write cache, that data shall be written to the media. The BSY bit shall remain set to one until all data has been successfully written or an error occurs. If your SSD isn't writing out all the data upon completion of the _FLUSHCACHE command, you will also run into issues w/ file system corruption if/when your server looses power at the wrong moment... this would be especially bad for ZFS... An issue w/ issuing the STANDBY IMMEDIATE command is that not all drives support it, so we'd have to add the code to detect if a drive supports it before it's use... Also, it's only description in the specification is: This command causes the device to immediately enter the Standby mode. STANDBY IMMEDIATE says nothing about making sure data is on stable storage or anything... I'd recommend you tell your SSD vendor to fix their firmware or switch to a different vendor... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."