Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 May 2003 16:57:56 -0700 (PDT)
From:      John Polstra <jdp@polstra.com>
To:        current@freebsd.org
Subject:   Re: atacontrol not reflecting disabled write cache (or rogue hdd?)
Message-ID:  <200305132357.h4DNvumk011490@strings.polstra.com>
In-Reply-To: <200304240156.25990.michaelnottebrock@gmx.net>
References:  <200304240156.25990.michaelnottebrock@gmx.net>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <200304240156.25990.michaelnottebrock@gmx.net>,
Michael Nottebrock  <michaelnottebrock@gmx.net> 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; ctlr<devclass_get_maxunit(ata_devclass); ctlr++) {
 	if (!(ch = devclass_get_softc(ata_devclass, ctlr)))
 	    continue;
-	if (ch->devices & 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305132357.h4DNvumk011490>