panic() design question

David I. Dalva dave at tis.com
Fri Aug 24 07:25:56 AEST 1990


Hi Wizards, I have a question regarding the implementation of panic()
in the UNIX kernel (both BSD and SYSV kernels are equivalent).

The code goes something like this:

	panic(s)
		char *s;
	{
		printf("%s\n", s);
		if (firsttime) {
			firsttime = FALSE;
			sync();
		}
		halt();
	}

Why is it that panic calls sync() (or update()) before the system is
halted, when data structures may be messed up causing further damage to
the filesystem?  I believe fsck should be able to recover to the most
recent sync().

I am experiencing a problem where the sync() itself is panicking
(recursively) messing up the filesystem further.  Taking the sync()
out greatly reduces filesystem damage.

Dave Dalva
Trusted Information Systems, Inc.
Glenwood, MD  21738
(301) 854-6889



More information about the Comp.unix.wizards mailing list