Author: mckusick Date: Tue Aug 6 18:10:34 2019 New Revision: 350651 URL: https://svnweb.freebsd.org/changeset/base/350651
Log: A race condition existed between the time a UFS/FFS superblock check hash was computed and the time that the superblock was copied to a buffer to be written to disk. The result was a failed superblock check hash the next time that the superblock was read. The fix is to compute the check hash after the superblock has been copied to a buffer to be written. PR: 236504 Reported by: Peter Holm Tested by: Peter Holm Sponsored by: Netflix Modified: head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Tue Aug 6 17:15:46 2019 (r350650) +++ head/sys/ufs/ffs/ffs_vfsops.c Tue Aug 6 18:10:34 2019 (r350651) @@ -1998,7 +1998,13 @@ ffs_use_bwrite(void *devfd, off_t loc, void *buf, int if (MOUNTEDSOFTDEP(ump->um_mountp)) softdep_setup_sbupdate(ump, (struct fs *)bp->b_data, bp); bcopy((caddr_t)fs, bp->b_data, (u_int)fs->fs_sbsize); - ffs_oldfscompat_write((struct fs *)bp->b_data, ump); + fs = (struct fs *)bp->b_data; + ffs_oldfscompat_write(fs, ump); + /* + * Because we may have made changes to the superblock, we need to + * recompute its check-hash. + */ + fs->fs_ckhash = ffs_calc_sbhash(fs); if (devfdp->suspended) bp->b_flags |= B_VALIDSUSPWRT; if (devfdp->waitfor != MNT_WAIT) _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"