From owner-freebsd-current@FreeBSD.ORG Tue May 13 16:58:06 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4D8B837B401 for ; Tue, 13 May 2003 16:58:06 -0700 (PDT) Received: from wall.polstra.com (wall-gw.polstra.com [206.213.73.130]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0DDFE43F75 for ; Tue, 13 May 2003 16:58:05 -0700 (PDT) (envelope-from jdp@polstra.com) Received: from strings.polstra.com (strings.polstra.com [206.213.73.20]) by wall.polstra.com (8.12.3p2/8.12.3) with ESMTP id h4DNvu7b086306 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Tue, 13 May 2003 16:57:57 -0700 (PDT) (envelope-from jdp@strings.polstra.com) Received: (from jdp@localhost) by strings.polstra.com (8.12.6/8.12.6/Submit) id h4DNvumk011490; Tue, 13 May 2003 16:57:56 -0700 (PDT) (envelope-from jdp) Date: Tue, 13 May 2003 16:57:56 -0700 (PDT) Message-Id: <200305132357.h4DNvumk011490@strings.polstra.com> To: current@freebsd.org From: John Polstra In-Reply-To: <200304240156.25990.michaelnottebrock@gmx.net> References: <200304240156.25990.michaelnottebrock@gmx.net> Organization: Polstra & Co., Seattle, WA X-Spam-Status: No, hits=-25.6 required=5.0 tests=IN_REP_TO,PATCH_UNIFIED_DIFF,QUOTED_EMAIL_TEXT,REFERENCES, REPLY_WITH_QUOTES version=2.53 X-Spam-Checker-Version: SpamAssassin 2.53 (1.174.2.15-2003-03-30-exp) Subject: Re: atacontrol not reflecting disabled write cache (or rogue hdd?) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 May 2003 23:58:06 -0000 In article <200304240156.25990.michaelnottebrock@gmx.net>, Michael Nottebrock wrote: > > I've recently changed hw.ata.wc to 0 (via loader.conf.local) on two systems= > =20 > and on both systems atacontrol cap still says write cache supported & enabl= > ed=20 > (sysctl confirms the setting being 0). One system is 5.0-RELEASE, the other= > =20 > 4.8-RC. > > Is atacontrol lying or do the drives insist on write caching? Atacontrol is lying. I sent Soren a patch that fixes it a few days ago (see below). The driver is getting the status information from the drives before it has actually attached them and turned off write caching. The driver keeps that stale information and returns it when atacontrol asks for it. If you use "atacontrol reinit" on the appropriate channel, it will cause the drive status to be re-fetched and you'll then see that write caching is in fact turned off. I'll append my patch below. Be advised that it probably needs some tweaking by Soren before it's really 100% correct. The patch is relative to -stable. John Index: ata-all.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ata/ata-all.c,v retrieving revision 1.50.2.45 diff -u -r1.50.2.45 ata-all.c --- ata-all.c 12 Mar 2003 14:47:12 -0000 1.50.2.45 +++ ata-all.c 11 May 2003 17:51:24 -0000 @@ -506,6 +506,8 @@ bswap(ata_parm->serial, sizeof(ata_parm->serial)); btrim(ata_parm->serial, sizeof(ata_parm->serial)); bpack(ata_parm->serial, ata_parm->serial, sizeof(ata_parm->serial)); + if (atadev->param != NULL) + free(atadev->param, M_ATA); atadev->param = ata_parm; return 0; } @@ -550,10 +552,14 @@ for (ctlr=0; ctlrdevices & ATA_ATA_MASTER) + if (ch->devices & ATA_ATA_MASTER) { ad_attach(&ch->device[MASTER]); - if (ch->devices & ATA_ATA_SLAVE) + ata_getparam(&ch->device[MASTER], ATA_C_ATA_IDENTIFY); + } + if (ch->devices & ATA_ATA_SLAVE) { ad_attach(&ch->device[SLAVE]); + ata_getparam(&ch->device[SLAVE], ATA_C_ATA_IDENTIFY); + } } ata_raid_attach(); #endif