From owner-freebsd-current Fri Dec 6 12: 0:18 2002 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 4B03A37B401 for ; Fri, 6 Dec 2002 12:00:15 -0800 (PST) Received: from beastie.mckusick.com (beastie.mckusick.com [209.31.233.184]) by mx1.FreeBSD.org (Postfix) with ESMTP id 911FE43EC5 for ; Fri, 6 Dec 2002 12:00:14 -0800 (PST) (envelope-from mckusick@beastie.mckusick.com) Received: from beastie.mckusick.com (localhost [127.0.0.1]) by beastie.mckusick.com (8.12.3/8.12.3) with ESMTP id gB6K0659093727; Fri, 6 Dec 2002 12:00:06 -0800 (PST) (envelope-from mckusick@beastie.mckusick.com) Message-Id: <200212062000.gB6K0659093727@beastie.mckusick.com> To: Archie Cobbs Subject: Re: backgroud fsck is still locking up system (fwd) Cc: Dan Nelson , freebsd-current@FreeBSD.ORG In-Reply-To: Your message of "Fri, 06 Dec 2002 11:28:52 PST." <200212061928.gB6JSqn0065389@arch20m.dellroad.org> Date: Fri, 06 Dec 2002 12:00:06 -0800 From: Kirk McKusick Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG The loss of files under soft updates is possible if your editor fails to fsync the new file before unlinking the old file. The `vi' editor always does an `fsync' after writing the new copy and before removing the old copy. I have not checked with other editors such as emacs to see if they properly use fsync. Note that there is also a vulnerability without soft updates, it is just that the window of vulnerability is shorter. So, editors should always do fsync's, it is just more critical if you are using soft updates (or journalling for that matter). The main reason for not using soft updates on the root filesystem was because of the delay between removing files and having the space show up. The result was that world installs on the root filesystem often failed if the root was nearly full (as is so often the case). That problem has now been fixed in 5.0 with a callback to soft updates if a filesystem full error is about to be generated. When called back, soft updates expedites the freeing of space so that the new allocation can succeed. So, the primary reason for not using soft updates on the root is now fixed. If however, mainline editors are not doing fsync's, then there is still a good reason not to use soft updates on the root filesystem. Kirk McKusick =-=-=-=-= From: Archie Cobbs Subject: Re: backgroud fsck is still locking up system (fwd) In-Reply-To: <20021206191024.GA1646@dan.emsphone.com> To: Dan Nelson Date: Fri, 6 Dec 2002 11:28:52 -0800 (PST) CC: mckusick@beastie.mckusick.com, freebsd-current@FreeBSD.ORG X-ASK-Info: Whitelist match Dan Nelson wrote: > > Why does softupdates not get enabled on / , by default on the > > install? > > Softupdates updates on-disk structures in the background, and > background fsck cannot relink unreferenced files into lost+found, so > you run the risk of losing both the original and backup copies of > important files in case of a sudden reboot. Imagine you edited > /etc/rc.conf, saved it, and 5 seconds later the system panic'ed. > Because the default metadata flush time is 28 seconds, there's a pretty > good chance that neither the new file or the original is in /etc after > a reboot. I got bit by this three times before I learned my lesson. I I don't understand this.. presumably vi updates the file contents by opening and writing into the file; why would this cause the file's directory entry to disappear? On the other hand, if you do "mv rc.conf.new rc.conf" then you are supposedly guaranteed that the file exists in some form; see rename(2). In any case, you seem to be implying that with respect to modifying files just before a system crash: (a) Softupdates is more 'dangerous' than non-softupdates (b) Background fsck is more 'dangerous' than normal fsck Is this really true? I thought if anything the reverse of (a) would be true. -Archie __________________________________________________________________________ Archie Cobbs * Packet Design * http://www.packetdesign.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message