Subject: Re: updating, build and install order
To: NetBSD-current Discussion List <current-users@netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: current-users
Date: 06/21/2003 14:32:14
[ On Saturday, June 21, 2003 at 18:48:06 (+0700), Robert Elz wrote: ]
> Subject: Re: updating, build and install order 
>
> As I recall it, sync marked the super block busy, and wrote that out last.
> A second sync would simply wait for the super block to become free, before
> starting - so when the 2nd sync started (when its prompt came back) you knew
> the first one was done.

I think the second sync will just return immediately, at least in V7:

/*
 * update is the internal name of
 * 'sync'. It goes through the disk
 * queues to initiate sandbagged IO;
 * goes through the I nodes to write
 * modified nodes; and it goes through
 * the mount table to initiate modified
 * super blocks.
 */
update()
{
	register struct inode *ip;
	register struct mount *mp;
	register struct buf *bp;
	struct filsys *fp;

	if(updlock)
		return;
        updlock++;
[[ .... ]]
	updlock = 0;
	bflush(NODEV);
}

However in Xenix I'm pretty sure even the first sync wouldn't return
until all the buffers were flushed, so in Xenix "sync;halt" really was
sufficient, though what you say about the third one was useful for
anyone paying attention because if the third prompt didn't appear
immediately then something was still running.  Of course if you really
did already have the ";halt" on the end of the command line then it was
too late anyway and all you learned was that you'd likely have some fsck
errors to deal with after rebooting and a bug in your shutdown procedure
to find and fix.


>   And that could take markedly longer to happen than
> the time to echo a few characters, even on an ASR33.

I was thinking more of the time it took to physically press the keys
than the time it took for the thing to print (or even the baud rate).  :-)

I remember this because when I first heard that bit of folklore about
typing sync three times I had just recently had the "opportunity" to use
an ASR33 for a little while and I was well aware of just how long it
would take to type "sync<LF>" three times and then type "halt<LF>".
(and I learned to type on a manual typewriter in high school and even
when I encountered the ASR my fingers were still quite accustomed to
banging pretty hard on long-travel keys! :-)

-- 
								Greg A. Woods

+1 416 218-0098;            <g.a.woods@ieee.org>;           <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>