From owner-freebsd-scsi Sun Jul 13 17:39:59 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id RAA16520 for freebsd-scsi-outgoing; Sun, 13 Jul 1997 17:39:59 -0700 (PDT) Received: from pluto.plutotech.com (root@[206.168.67.137]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id RAA16515 for ; Sun, 13 Jul 1997 17:39:57 -0700 (PDT) Received: from narnia.plutotech.com (narnia.plutotech.com [206.168.67.130]) by pluto.plutotech.com (8.8.5/8.8.5) with ESMTP id SAA02750; Sun, 13 Jul 1997 18:37:52 -0600 (MDT) Message-Id: <199707140037.SAA02750@pluto.plutotech.com> To: dg@root.com cc: Simon Shapiro , filo@yahoo.com, freebsd-SCSI@FreeBSD.ORG Subject: Re: problems with reboot In-reply-to: Your message of "Sun, 13 Jul 1997 16:47:48 PDT." <199707132347.QAA00548@implode.root.com> Date: Sun, 13 Jul 1997 18:37:52 -0600 From: "Justin T. Gibbs" Sender: owner-freebsd-scsi@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > 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. 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. 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). >-DG > >David Greenman >Core-team/Principal Architect, The FreeBSD Project -- Justin T. Gibbs =========================================== FreeBSD: Turning PCs into workstations ===========================================