Ensure that inode updates are properly flushed out during the first

pass of fsck_ffs. Some changes, such as check-hash corrections were
being lost.

Reported by: Michael Tuexen (tuexen@)
Tested by:   Michael Tuexen (tuexen@)
MFC after:   3 days
This commit is contained in:
mckusick 2019-02-19 20:12:12 +00:00
parent 79ac8c17fb
commit 8bd0f002e1

View File

@ -349,9 +349,11 @@ getnextinode(ino_t inumber, int rebuildcg)
lastinum += fullcnt;
}
/*
* Flush old contents in case they have been updated.
* If getblk encounters an error, it will already have zeroed
* out the buffer, so we do not need to do so here.
*/
flush(fswritefd, &inobuf);
getblk(&inobuf, blk, size);
nextinop = inobuf.b_un.b_buf;
}
@ -461,6 +463,10 @@ void
freeinodebuf(void)
{
/*
* Flush old contents in case they have been updated.
*/
flush(fswritefd, &inobuf);
if (inobuf.b_un.b_buf != NULL)
free((char *)inobuf.b_un.b_buf);
inobuf.b_un.b_buf = NULL;