>There've been troubles (particularly in the logging system) where
>deleting a file, creating a new one, and then crashing before the
>directory updates themselves get out to disk causes havoc such as you
>describe.
>
>Search the bug database.  In any event, Casper's right.  It's possible
>to make applications that can deal with system halts at any point, and
>still keep the data self-consistent.  That some applications don't get
>it right doesn't mean that none can do it.

And there was buggy code in Solaris; e.g., this code in drvsubr.c
which manipulates some of the /etc/*_* files:

    340         /* Make sure that the file is on disk */
    341         if (fflush(newfp) != 0 || fsync(fileno(newfp)) != 0)
    342                 status = ERROR;
    343         else
    344                 rv = NOERR;
    345 
    346         (void) fclose(newfp);


used to look like this:

        (void) fsync(fileno(newfp));
        (void) fclose(newfp);


Considering that most of these files are less than 8K in size, no output
was ever written before the fsync().

So no surprise that some files in /etc sometimes turned up with bogus 
content.

Casper


Reply via email to