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:
Kirk McKusick 2019-02-19 20:12:12 +00:00
parent 198fdaeda1
commit 7bcd1fab5a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=344302

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;