From owner-freebsd-current@FreeBSD.ORG Tue May 20 08:55:24 2003 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 2094037B401; Tue, 20 May 2003 08:55:24 -0700 (PDT) Received: from stork.mail.pas.earthlink.net (stork.mail.pas.earthlink.net [207.217.120.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id 827CD43F85; Tue, 20 May 2003 08:55:23 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from user-38ldvdp.dialup.mindspring.com ([209.86.253.185] helo=mindspring.com) by stork.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 19I9SR-0003uF-00; Tue, 20 May 2003 08:55:20 -0700 Message-ID: <3ECA4F9D.26DFA3DE@mindspring.com> Date: Tue, 20 May 2003 08:54:05 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: "Daniel C. Sobral" References: <3ECA15DB.7020107@tcoip.com.br> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a43bb2e5b5e6f76c449828893495abcde23ca473d225a0f487350badd9bab72f9c350badd9bab72f9c cc: CURRENT cc: mckusick@FreeBSD.ORG Subject: Re: panic: lockmgr: locking against myself 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: Tue, 20 May 2003 15:55:24 -0000 "Daniel C. Sobral" wrote: > This is an easily reproducable panic. Whenever my system panics for some > reason, that panic will follow during the background fsck afterwards. > > I'm inclined to disable background fsck, only that would be just masking > the problem, not solving it. I *thought* this had been solved. :-( No. I suggested a counter to force a FG fsck; someone claimed it was already implemented, I looked, it wasn't, and it would take a superblock change (you would need a new "don't care about mismatch" region; wish people had put in the space reservation API I had suggested, when they were rewriting UFS to UFS2...). > When this stuff happens, I always boot single user and run fsck by hand, > so I can't see how it could be inconsistent state left by an early panic > _during_ a background fsck. If you crash with unwritten buffers because write caching is enabled on an ATA drive, or you end up trashing a few sectors or a track because of a genuine power loss, or because your ACPI settings don't delay "shutdown -p" until after a drive flush so that the write cache is guaranteed to be syned to disk, soft updates will not guarantee drive consistency (it's kind of hard to do if your power is off). In that case, the FS can have data structures SPAM'med by the poor design, and the only way to recover is a full fsck. The basic assumptions with the BG fsck is that the only thing that could be SPAM'med is the cylinder group bitmaps... and in the above cases, that's not true. Any panic you get will *usually* be the result of taking the snapshot for the BG fsck, or as a result of mounting and using the disk as if it were safe to do, when it's not. If you can adjust your ACPI settings to ensure that the power doesn't actually go off until the disks write cache is flushed, and verify that there is a request being posted for the write cache to be flushed prior to a power-down or sleep event, then that should "resolve" your problem, unless you are getting a genuine external power failure. Really, the correct thing to do is set a counter in the FS superblock at clean shutdown (e.g. a "tunefs" option would do the trick), and decrement it each time you start a BG fsck. When it gets to 0, you force a full fsck instead. Basically, this would mean you panic at most 3 times before the FG fsck takes over and cleans up the BG fsck-unrecoverable problem for you. Short of writing that code, your only chance is to keep the data on the disk from being bogofied in the first place (per avoiding the situations in the first paragraph, above). -- Terry