From owner-freebsd-current@FreeBSD.ORG Wed Oct 20 17:09:14 2004 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 E0EEF16A4CE for ; Wed, 20 Oct 2004 17:09:14 +0000 (GMT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 41F0C43D3F for ; Wed, 20 Oct 2004 17:09:14 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.11/8.12.11) id i9KH8m8B095609; Wed, 20 Oct 2004 12:08:48 -0500 (CDT) (envelope-from dan) Date: Wed, 20 Oct 2004 12:08:48 -0500 From: Dan Nelson To: Alexander Leidinger Message-ID: <20041020170848.GA11073@dan.emsphone.com> References: <417538B9.7070001@club-internet.fr> <41755FAF.8080300@colleduc.ee> <53515.208.4.77.15.1098213002.squirrel@208.4.77.15> <20041019202047.GB83510@dan.emsphone.com> <1098276238.41765d8ebfc0b@netchild.homeip.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1098276238.41765d8ebfc0b@netchild.homeip.net> X-OS: FreeBSD 5.3-BETA7 X-message-flag: Outlook Error User-Agent: Mutt/1.5.6i cc: Ryan Sommers cc: "Jean-S~A\(c\)bastien P~A\(c\)dron" cc: Kalev Lember cc: freebsd-current@freebsd.org Subject: Re: Read-only ReiserFS support for FreeBSD 5.x 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: Wed, 20 Oct 2004 17:09:15 -0000 In the last episode (Oct 20), Alexander Leidinger said: > Zitat von Dan Nelson : > > Journalled filesystems may guarantee that the filesystem will be > > consistent to a particular point in time, so if your editor updates > > (for example) rc.conf by creating a new copy named rc.conf.new, > > deleting rc.conf, then renaming the copy to rc.conf, you are > > guaranteed that either rc.conf or rc.conf.new will be in the > > filessytem after a crash. With softupdates, you may lose both > > files. I don't know if current journalled fses actually journal > > all writes like this (as opposed to just journalling what the OS > > decides to flush out of its cache), but they are much less likely > > to lose files the way softupdates can. > > Sorry, this isn't true. Renaming a directory entry is an atomar > operation. Not only "man 2 rename" tells you about it, the > softupdates algorithm guarantees this too. If you move/rename an > entry into another directory, you may have both entries with the same > content, but you won't loose both. Yes, the rename itself is an atomic operation, but that doesn't help you if SU has commited the "delete rc.conf" step but has not yet committed the "write data for rc.conf.new" step. SU doesn't guarantee that its updates will be done in chronological order, just that at no point will the filesystem be inconsistent. The best solution is to fsync rc.conf.new before unlinking rc.conf to guarantee that it has been committed to disk. Note that /usr/bin/install has the same issues (and forcing a sync in there would really slow it down). I've lost so many files due to this that I run with kern.{meta,dir,file}delay set to {5,6,7} to make the window as small as possible while still giving me good performance. -- Dan Nelson dnelson@allantgroup.com