From 7bcd1fab5a035e0f532dcd80307fa66d2707ad34 Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Tue, 19 Feb 2019 20:12:12 +0000 Subject: [PATCH] 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 --- sbin/fsck_ffs/inode.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c index ecaeeea4b197..79c1c29436bb 100644 --- a/sbin/fsck_ffs/inode.c +++ b/sbin/fsck_ffs/inode.c @@ -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;