From: utzoo!decvax!harpo!utah-cs!sask!hssg40!peachey Newsgroups: net.bugs.usg Title: System III ialloc() bug Article-I.D.: hssg40.314 Posted: Tue Mar 22 15:42:12 1983 Received: Wed Mar 23 20:02:52 1983 There appears to be a bug in the ialloc() subroutine of the System III alloc.c source file. s_inode[0] is used as a "low water mark" of free inodes. It is necessary to compute the inode number "ino" for the first inode in the same block as s_inode[0]. The code used is ino = (fp->s_inode[0]&~7) + 1; This code gives an incorrect value if the s_inode[0] is the last inode of a block. The correct code is ino = ((fp->s_inode[0] - 1) & ~(INOPB-1)) + 1; (where it is assumed that INOPB is a power of 2). The effect of the bug would be to miss one free inode in the disk scan for free inodes that is done when s_inode becomes empty. Moreover, the inode is missed only if (s_inode[0] & 07) == 0. Thus, the fix is more important esthetically than practically. Darwyn Peachey Hospital Systems Study Group harpo!utah-cs!sask!hssg40!peachey OR decvax!utzoo!utcsrgv!sask!hssg40!peachey