From owner-freebsd-scsi@FreeBSD.ORG Fri Feb 2 18:58:06 2007 Return-Path: X-Original-To: scsi@freebsd.org Delivered-To: freebsd-scsi@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E153516A406; Fri, 2 Feb 2007 18:58:06 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.freebsd.org (Postfix) with ESMTP id 869A813C467; Fri, 2 Feb 2007 18:58:04 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from phobos.samsco.home (phobos.samsco.home [192.168.254.11]) (authenticated bits=0) by pooker.samsco.org (8.13.4/8.13.4) with ESMTP id l12Ivwk7004541; Fri, 2 Feb 2007 11:58:03 -0700 (MST) (envelope-from scottl@samsco.org) Message-ID: <45C389A6.1080606@samsco.org> Date: Fri, 02 Feb 2007 11:57:42 -0700 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.2pre) Gecko/20070111 SeaMonkey/1.1 MIME-Version: 1.0 To: mjacob@freebsd.org References: <20070123173026.E692416A4CD@hub.freebsd.org> <45B65710.4060607@root.org> <20070123105009.G41619@ns1.feral.com> <45B67401.9070102@samsco.org> <20070201150111.B77236@ns1.feral.com> <45C27965.1010803@samsco.org> <45C2E7DB.30204@root.org> <20070202080329.L17850@ns1.feral.com> In-Reply-To: <20070202080329.L17850@ns1.feral.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (pooker.samsco.org [168.103.85.57]); Fri, 02 Feb 2007 11:58:03 -0700 (MST) X-Spam-Status: No, score=-1.4 required=3.8 tests=ALL_TRUSTED autolearn=failed version=3.1.1 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on pooker.samsco.org Cc: scsi@freebsd.org, Nate Lawson Subject: Re: cvs commit: src/sys/cam/scsi scsi_da.c X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2007 18:58:07 -0000 mjacob@freebsd.org wrote: > >> I think Windows actually never runs SYNC_CACHE unless you select >> "detach device". > > Maybe for pluggable devices, but otherwise Windows uses SYNC_CACHE and > FUA quite freely (and correctly). > > I'm uncomfortable with the notion that there is uncommitted data present > in a device after a close that can be lost due to power lossage (or > unpluggage). From a user application or filesystem point of view, this > is an axiom violation that no OS should ever allow. > > From a silly semantic point of view to get around this, we should still > support and require SYNC_CACHE on close except where devices don't > support it (and any device that hangs on a SYNC_CACHE doesn't support > it- period). The problem is that we don't know if the device will misbehave until it does, and then we don't know if we can reliably recover it. > On detach, devices that still need to have data commited > via an opcode that looks remarkably like SYNC_CACHE can and should have > that happen- with all the infrastructure changes that go along with > allowing devices to be detached (w/o complaint) with a live command. What instigates this problem is that the GEOM layer will open the device, read a few sectors, close it, then do that again a few more times, long before the user tries to mount/unmount it. It's the whole GEOM-taste thing where it tries to essentially auto-probe the storage. When we unconditionally send a SYNC_CACHE in daclose(), the misbehaving device is dead long before the user has a chance to do anything. One hack might be to track if any write command were done while the device was open, and only issue the SYNC_CACHE if so. Since the GEOM tasting will only read, it'll pass this test and avoid the problem. Scott