path: root/sbin/fsck_ffs/suj.c
diff options
authorKirk McKusick <mckusick@FreeBSD.org>2018-01-17 17:58:24 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2018-01-17 17:58:24 +0000
commit72f854ce8f359100d957a07da44ae98591d3dfd9 (patch)
tree6603c949e870e1510902951cb2391e730e174006 /sbin/fsck_ffs/suj.c
parent64e12b4140ffeaea04b7230d506ee0326e3b077d (diff)
Correct fsck journal-recovery code to update a cylinder-group
check-hash after making changes to the cylinder group. The problem was that the journal-recovery code was calling the libufs bwrite() function instead of the cgput() function. The cgput() function updates the cylinder-group check-hash before writing the cylinder group. This change required the additions of the cgget() and cgput() functions to the libufs API to avoid a gratuitous bcopy of every cylinder group to be read or written. These new functions have been added to the libufs manual pages. This was the first opportunity that I have had to use and document the use of the EDOOFUS error code. Reviewed by: kib Reported by: emaste and others
Notes: svn path=/head/; revision=328092
Diffstat (limited to 'sbin/fsck_ffs/suj.c')
1 files changed, 1 insertions, 2 deletions
diff --git a/sbin/fsck_ffs/suj.c b/sbin/fsck_ffs/suj.c
index 69ed3d5e59ac..186697c03103 100644
--- a/sbin/fsck_ffs/suj.c
+++ b/sbin/fsck_ffs/suj.c
@@ -1892,8 +1892,7 @@ cg_write(struct suj_cg *sc)
* before writing the block.
fs->fs_cs(fs, sc->sc_cgx) = cgp->cg_cs;
- if (bwrite(disk, fsbtodb(fs, cgtod(fs, sc->sc_cgx)), sc->sc_cgbuf,
- fs->fs_bsize) == -1)
+ if (cgput(disk, cgp) == -1)
err_suj("Unable to write cylinder group %d\n", sc->sc_cgx);