From owner-freebsd-scsi Mon Jul 14 19:54:47 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id TAA00801 for freebsd-scsi-outgoing; Mon, 14 Jul 1997 19:54:47 -0700 (PDT) Received: from sendero-ppp.i-connect.net (sendero-ppp.i-Connect.Net [206.190.143.100]) by hub.freebsd.org (8.8.5/8.8.5) with SMTP id TAA00796 for ; Mon, 14 Jul 1997 19:54:37 -0700 (PDT) Received: (qmail 5687 invoked by uid 1000); 15 Jul 1997 02:54:39 -0000 Message-ID: X-Mailer: XFMail 1.1 [p0] on FreeBSD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <199707140037.SAA02750@pluto.plutotech.com> Date: Sun, 13 Jul 1997 20:34:18 -0700 (PDT) Organization: Atlas Telecom From: Simon Shapiro To: "Justin T. Gibbs" Subject: Re: problems with reboot Cc: freebsd-SCSI@FreeBSD.ORG, filo@yahoo.com, dg@root.com Sender: owner-freebsd-scsi@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Hi Justin T. Gibbs; On 14-Jul-97 you wrote: > > The shutdown code waits for all buffers to be flushed, but the code > has no > >way of knowing if the controller actually committed the data to disk. If > a > >disk controller indicates I/O completion/success before the data is > actually > >written to disk, then it seems to me that forcing the cache flush would > be > a controller specific operation. Yes? > > In this case, the DPT emulates "a giant disk" and responds to the same > commands that disks do. Lots of disks return successful completion > status on I/O that is still in there cache. So, even if there wasn't > a controller cache to worry about, you'd still want to ensure that the > cache on the disks is flushed before turning off the system. That's > why the SCSI spec gives you the synchronize cache command. We should > be issueing this on final close to all disks (the new CAM code does) > which will handle normal disks as well as RAID controllers like the DPT > that emulate disks. So, no controller specific operation is needed. Most disks we are dealing with have one megabyte of memory on the drive. I would classify DPT's response to (and the existance of) ``...MEDIA REMOVAL..' to luck more than anything else. To comply with MEDIA REMOVAL command, a device must flush his caches. But justin's choice is the correct one. > It turns out that the DPT also flushes it's cache on the "allow > media removal command" which the current code does on final close, > but I don't think that we should assume that this works in all > cases. Using that command on a device that doesn't report itself > as removable is also a little bogus. It is a questionable practie to use MEDIA REMOVAL and correct to use FLUSH CACHE. My first reaction to FreeBSD use of MEDIA REMOVAL was: ``Huh?''. turns out to be a good thing :-) BTW, FreeBSD today, issues TEST DEVICE READY before an INQUIRY in conjunction with the PREVENT MEDIA REMOVAL upon open. This is fine except it is backwards to the standard. Especially where SCSI I devices are concerned. For example, it will promptly hang most CD-R devices when you ask them to do TEST READY on LUN other than zero. Disabling LUN handling works but akin to remove an infected organ. It sure cures the infection but can leave you physically chalenged. > As David F. has pointed out, the last close is happening and we are > waiting for it to complete, the only problem is that the timeout is > much too short for the "prevent/allow media removal" command. The > CAM code does some handwavy calculation based on the size of the > target disk so that if you have a multi-gigabyte "emulated disk", > the timeout will be larger than for a 4gig "normal disk". It uses > an explicit sync cache command though while keeping the media locking > command timeouts short (the unlock happens after the sync cache). The DPT driver logic for timeout is based on the caseload in the controller. It is just as hand waving and just as prone to failure. My opinion on timeouts is that they should do what we do today; Provide the HBA with a value and let it decide what to do with it. Simon