[news.sysadmin] Newzheimer's Syndrome

kent@happym.UUCP (Kent Forschmiedt) (09/18/88)

In article <576@mbph.UUCP> hybl@mbph.UUCP (Albert Hybl  Dept of Biophysics  SM)
relates how he has discovered that his system has the SYSV inode cache bug.

I was going to reply by mail, but this hasn't been explained in public
lately, so I'll give it a go.

There is a boundary error in many System V's which causes a file system 
to fail to refill its inode cache when it runs out under a certain 
(internal) condition.  The problem is not likely to occur except when 
hundreds or thousands of files are created with no intervening 
deletions.  News, processing batches, does that routinely, so it tends 
to trigger the bug. 

The problem causes no file system damage, and fsck refills the inode 
cache. Since filling the cache defers the problem, using fsck frequently 
enough prevents it.  My spool/news lives on its own partition, and my 
daily news demon unmounts, cleans, and remounts it before doing the rest 
of its business.  Before I started dong this, my file system screwed up 
about 3 or 4 times a month.  Now it almost never happens. 


# @(#) newsdemon.sh
#
TZ=PST8PDT
PATH=$HOME:$PATH

cd $HOME

# This needs to be setuid root, so it is not done in line...
# do it before running expire; there might be news queued up.
# If it fails, rnews is probably running.  If so, it probably
# isn't broken anyway.  I hope.
/usr/lib/news/fixnewsfs

trap "rm -f tmp$$" 0

DAY=`date +%d`
ODD=`expr $DAY / 2`
WD=`date +%w`

if [ $WD -eq 1 ]; then

	expire -n all,all.all -e 26 -E 32
	rm -f o.Log-WEEK.Z
	mv Log-WEEK o.Log-WEEK
	compress o.Log-WEEK

elif [ $ODD -eq 1 ]; then

	expire -n junk,control,rec.all,soc.all,talk.all -e 5 -E 32

else

	expire -n misc.all,alt.all -e 14 -E 32

fi

mv log tmp$$
>log
cat tmp$$ >>Log-WEEK
echo "-------------------- `date`" >>Log-WEEK

# END newsdemon.sh

/* fixnewsfs.c */
/* this is a binary instead of a script because setuid
   scripts don't work on my system */
main()
{
	/* euid is already 0... */
	setuid(0);

	system("/etc/umount /dev/dsk/m320_1s2")
		||
	system("/etc/fsck -y /dev/dsk/m320_1s2")
		||
	system("/etc/mount /dev/dsk/m320_1s2 /u/spool/news");
}

-- 
  kent@happym.UUCP, tikal!camco!happym!kent, Happy Man Corp. USA 206-282-9598

steve@alberta.UUCP (Stephen Samuel) (09/24/88)

From article <536@happym.UUCP>, by kent@happym.UUCP (Kent Forschmiedt):
} In article <576@mbph.UUCP> hybl@mbph.UUCP (Albert Hybl  Dept of Biophysics  SM)
} relates how he has discovered that his system has the SYSV inode cache bug.
} 
} There is a boundary error in many System V's which causes a file system 
} to fail to refill its inode cache when it runs out under a certain 
} (internal) condition.  The problem is not likely to occur except when 
} hundreds or thousands of files are created with no intervening 
} deletions.  News, processing batches, does that routinely, so it tends 
} to trigger the bug. 

unh, so, why not just have rnews create and delete dome random file 
every time it stores a new item (or after, say, every few items).

This should be easy enough to do.... (If nobody else does it, I 
might get around to it this week, myself...).