Fix fsck_ffs Pass 1b error exit "bad inode number 2 to nextinode".

Pass 1b of fsck_ffs runs only when Pass 1 has found duplicate blocks.
When starting up, Pass 1b failed to properly skip over the two unused
inodes at the beginning of the filesystem resulting in the above error
message when it tried to read the filesystem root inode.

Reported by:  Chuck Silvers
Tested by:    Chuck Silvers
MFC after:    3 days
Sponsored by: Netflix
This commit is contained in:
Kirk McKusick 2021-03-24 16:50:24 -07:00
parent ec8f1ea8d5
commit bc444e2ec6

View File

@ -78,8 +78,10 @@ pass1b(void)
continue;
setinodebuf(c, inosused);
for (i = 0; i < inosused; i++, inumber++) {
if (inumber < UFS_ROOTINO)
if (inumber < UFS_ROOTINO) {
(void)getnextinode(inumber, 0);
continue;
}
dp = getnextinode(inumber, 0);
idesc.id_number = inumber;
idesc.id_type = inoinfo(inumber)->ino_idtype;